浏览代码

Examples support for ie8.

zhixin 11 年之前
父节点
当前提交
413e996ceb
共有 1 个文件被更改,包括 15 次插入11 次删除
  1. 15 11
      docs/examples.js

+ 15 - 11
docs/examples.js

@@ -5,17 +5,21 @@ $(function() {
             codes = [],
             codes = [],
             spaces = 0;
             spaces = 0;
 
 
-        $.each(sources, function(i, text) {
-            if (!$.trim(text)) {
-                i > 0  && codes.push('');
-                return;
-            }
-            if (!spaces) {
-                spaces = text.match(/(^\s+)/)[1].length;
-            }
-            codes.push(text.substring(spaces));
-        });
-        $(this).next().find('code').html(codes.join('\n'));
+        try {
+            $.each(sources, function(i, text) {
+                if (!$.trim(text)) {
+                    i > 0  && codes.push('');
+                    return;
+                }
+                if (!spaces) {
+                    spaces = text.match(/(^\s+)/)[1].length;
+                }
+                codes.push(text.substring(spaces));
+            });
+            $(this).next().find('code').html(codes.join('\n'));
+        } catch (e) {
+            $(this).next().remove();
+        }
     });
     });
     $('#i18n').change(function() {
     $('#i18n').change(function() {
         $.getScript('../src/locale/bootstrap-table-' + $(this).val() + '.js', function() {
         $.getScript('../src/locale/bootstrap-table-' + $(this).val() + '.js', function() {