@@ -24,10 +24,10 @@ test("jQuery()", function() {
2424 main = jQuery ( "#qunit-fixture" ) ,
2525 code = jQuery ( "<code/>" ) ,
2626 img = jQuery ( "<img/>" ) ,
27- div = jQuery ( "<div/ ><hr/ ><code/ ><b/ >" ) ,
27+ div = jQuery ( "<div></div ><hr><code></code ><b></b >" ) ,
2828 exec = false ,
2929 lng = "" ,
30- expected = 26 ,
30+ expected = 24 ,
3131 attrObj = {
3232 "click" : function ( ) { ok ( exec , "Click executed." ) ; } ,
3333 "text" : "test" ,
@@ -139,15 +139,13 @@ test("jQuery()", function() {
139139 // manually clean up detached elements
140140 elem . remove ( ) ;
141141
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." ) ;
144143
145144 for ( i = 0 ; i < 128 ; i ++ ) {
146145 lng += "12345678" ;
147146 }
148147
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." ) ;
151149} ) ;
152150
153151test ( "selector state" , function ( ) {
@@ -664,6 +662,13 @@ test("jQuery('html', context)", function() {
664662 equal ( $span . length , 1 , "Verify a span created with a div context works, #1763" ) ;
665663} ) ;
666664
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+
667672test ( "jQuery(selector, xml).text(str) - Loaded via XML document" , function ( ) {
668673 expect ( 2 ) ;
669674
@@ -980,6 +985,13 @@ test("jQuery.extend(Object, Object)", function() {
980985 deepEqual ( options2 , options2Copy , "Check if not modified: options2 must not be modified" ) ;
981986} ) ;
982987
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+
983995test ( "jQuery.each(Object,Function)" , function ( ) {
984996 expect ( 14 ) ;
985997 jQuery . each ( [ 0 , 1 , 2 ] , function ( i , n ) {
0 commit comments