Bug 4366; fixing $.each(document.styleSheets) from throwing errors in IE
This commit is contained in:
parent
2555a5a232
commit
3296116041
|
@ -610,8 +610,11 @@ jQuery.extend({
|
|||
}
|
||||
}
|
||||
} else {
|
||||
for ( var value = object[0];
|
||||
i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {}
|
||||
for ( ; i < length; ) {
|
||||
if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -784,7 +784,7 @@ test("jQuery.extend(Object, Object)", function() {
|
|||
});
|
||||
|
||||
test("jQuery.each(Object,Function)", function() {
|
||||
expect(13);
|
||||
expect(14);
|
||||
jQuery.each( [0,1,2], function(i, n){
|
||||
equals( i, n, "Check array iteration" );
|
||||
});
|
||||
|
@ -816,6 +816,13 @@ test("jQuery.each(Object,Function)", function() {
|
|||
f[i] = 'baz';
|
||||
});
|
||||
equals( "baz", f.foo, "Loop over a function" );
|
||||
|
||||
var stylesheet_count = 0;
|
||||
jQuery.each(document.styleSheets, function(i){
|
||||
stylesheet_count++;
|
||||
});
|
||||
equals(stylesheet_count, 2, "should not throw an error in IE while looping over document.styleSheets and return proper amount");
|
||||
|
||||
});
|
||||
|
||||
test("jQuery.makeArray", function(){
|
||||
|
|
Loading…
Reference in a new issue