Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Commit fdffc23

Browse files
committed
+ IE7、IE8
1 parent 278948b commit fdffc23

File tree

6 files changed

+30
-6
lines changed

6 files changed

+30
-6
lines changed

demo/demo.bisheng.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,11 @@
145145
radioValue1: 0,
146146
radioValue2: 1,
147147
radioChecked1: true,
148-
radioChecked2: false,
148+
radioChecked2: false
149149
}
150150
}
151151
}
152-
for (var i = 0; i < 1000; i++) {
152+
for (var i = 0; i < 100; i++) {
153153
data.list.push({
154154
id: i
155155
})

dist/bisheng.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -805,10 +805,12 @@ define(
805805
*/
806806
define(
807807
'brix/bisheng/ast',[
808+
'underscore',
808809
'handlebars',
809810
'./locator'
810811
],
811812
function(
813+
_,
812814
Handlebars,
813815
Locator
814816
) {
@@ -873,7 +875,7 @@ define(
873875

874876
var prop = []
875877
if (node.isHelper) {
876-
node.params.forEach(function(param) {
878+
_.each(node.params, function(param, index) {
877879
if (param.type === 'ID') {
878880
prop.push(param.string)
879881
}
@@ -1160,7 +1162,13 @@ define(
11601162

11611163
// 扫描子节点
11621164
function scanChildNode(node) {
1163-
_.each([].slice.call(node.childNodes), function(childNode /*, index*/ ) {
1165+
// “Array.prototype.slice: 'this' is not a JavaScript object” error in IE8
1166+
// [].slice.call(node.childNodes)
1167+
var tmp = []
1168+
for (var i = 0, childNodes = node.childNodes, len = childNodes.length; i < len; i++) {
1169+
tmp.push(childNodes[i])
1170+
}
1171+
_.each(tmp, function(childNode /*, index*/ ) {
11641172
scanNode(childNode)
11651173
})
11661174
}

doc/dependencies.png

-3.73 KB
Loading

gulpfile.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/* global console */
33

44
var gulp = require('gulp')
5+
var connect = require('gulp-connect')
56
var jshint = require('gulp-jshint')
67
var mochaPhantomJS = require('gulp-mocha-phantomjs')
78
var rjs = require('gulp-requirejs')
@@ -22,6 +23,13 @@ ______ _ ______ _ _____ _
2223
}).toString().split('\n').slice(2, -2).join('\n') + '\n')
2324
})
2425

26+
// https://github.com/AveVlad/gulp-connect
27+
gulp.task('connect', function() {
28+
connect.server({
29+
port: 4246
30+
})
31+
})
32+
2533
// https://github.com/spenceralger/gulp-jshint
2634
gulp.task('jshint', function() {
2735
var globs = [

src/brix/bisheng/ast.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@
1616
*/
1717
define(
1818
[
19+
'underscore',
1920
'handlebars',
2021
'./locator'
2122
],
2223
function(
24+
_,
2325
Handlebars,
2426
Locator
2527
) {
@@ -84,7 +86,7 @@ define(
8486

8587
var prop = []
8688
if (node.isHelper) {
87-
node.params.forEach(function(param) {
89+
_.each(node.params, function(param, index) {
8890
if (param.type === 'ID') {
8991
prop.push(param.string)
9092
}

src/brix/bisheng/scan.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,13 @@ define(
179179

180180
// 扫描子节点
181181
function scanChildNode(node) {
182-
_.each([].slice.call(node.childNodes), function(childNode /*, index*/ ) {
182+
// “Array.prototype.slice: 'this' is not a JavaScript object” error in IE8
183+
// [].slice.call(node.childNodes)
184+
var tmp = []
185+
for (var i = 0, childNodes = node.childNodes, len = childNodes.length; i < len; i++) {
186+
tmp.push(childNodes[i])
187+
}
188+
_.each(tmp, function(childNode /*, index*/ ) {
183189
scanNode(childNode)
184190
})
185191
}

0 commit comments

Comments
 (0)