@@ -24,10 +24,10 @@ test("jQuery()", function() {
24
24
main = jQuery ( "#qunit-fixture" ) ,
25
25
code = jQuery ( "<code/>" ) ,
26
26
img = jQuery ( "<img/>" ) ,
27
- div = jQuery ( "<div/ ><hr/ ><code/ ><b/ >" ) ,
27
+ div = jQuery ( "<div></div ><hr><code></code ><b></b >" ) ,
28
28
exec = false ,
29
29
lng = "" ,
30
- expected = 26 ,
30
+ expected = 24 ,
31
31
attrObj = {
32
32
"click" : function ( ) { ok ( exec , "Click executed." ) ; } ,
33
33
"text" : "test" ,
@@ -139,15 +139,13 @@ test("jQuery()", function() {
139
139
// manually clean up detached elements
140
140
elem . remove ( ) ;
141
141
142
- equal ( jQuery ( " <div/> " ) . length , 1 , "Make sure whitespace is trimmed." ) ;
143
- equal ( jQuery ( " a<div/>b " ) . length , 1 , "Make sure whitespace and other characters are trimmed." ) ;
142
+ equal ( jQuery ( "<div></div> " ) . length , 1 , "Make sure whitespace is trimmed." ) ;
144
143
145
144
for ( i = 0 ; i < 128 ; i ++ ) {
146
145
lng += "12345678" ;
147
146
}
148
147
149
- equal ( jQuery ( " <div>" + lng + "</div> " ) . length , 1 , "Make sure whitespace is trimmed on long strings." ) ;
150
- equal ( jQuery ( " a<div>" + lng + "</div>b " ) . length , 1 , "Make sure whitespace and other characters are trimmed on long strings." ) ;
148
+ equal ( jQuery ( "<div>" + lng + "</div> " ) . length , 1 , "Make sure whitespace is trimmed on long strings." ) ;
151
149
} ) ;
152
150
153
151
test ( "selector state" , function ( ) {
@@ -664,6 +662,13 @@ test("jQuery('html', context)", function() {
664
662
equal ( $span . length , 1 , "Verify a span created with a div context works, #1763" ) ;
665
663
} ) ;
666
664
665
+ test ( "jQuery.extend( true, ... ) Object.prototype pollution" , function ( assert ) {
666
+ expect ( 1 ) ;
667
+
668
+ jQuery . extend ( true , { } , JSON . parse ( "{\"__proto__\": {\"devMode\": true}}" ) ) ;
669
+ ok ( ! ( "devMode" in { } ) , "Object.prototype not polluted" ) ;
670
+ } ) ;
671
+
667
672
test ( "jQuery(selector, xml).text(str) - Loaded via XML document" , function ( ) {
668
673
expect ( 2 ) ;
669
674
@@ -980,6 +985,13 @@ test("jQuery.extend(Object, Object)", function() {
980
985
deepEqual ( options2 , options2Copy , "Check if not modified: options2 must not be modified" ) ;
981
986
} ) ;
982
987
988
+ QUnit . test ( "jQuery.extend( true, ... ) Object.prototype pollution" , function ( assert ) {
989
+ expect ( 1 ) ;
990
+
991
+ jQuery . extend ( true , { } , JSON . parse ( "{\"__proto__\": {\"devMode\": true}}" ) ) ;
992
+ ok ( ! ( "devMode" in { } ) , "Object.prototype not polluted" ) ;
993
+ } ) ;
994
+
983
995
test ( "jQuery.each(Object,Function)" , function ( ) {
984
996
expect ( 14 ) ;
985
997
jQuery . each ( [ 0 , 1 , 2 ] , function ( i , n ) {
0 commit comments