Commit 1d61fd9
committed
Manipulation: Make jQuery.htmlPrefilter an identity function
Closes gh-4642
(cherry picked from />" ).appendTo( "#qunit-fixture" );101+ jQuery( "<a id='tAnchor6' href='#5'></a>" ).appendTo( "#qunit-fixture" );102102 assert.equal( jQuery( "#tAnchor5" ).prop( "href" ), jQuery( "#tAnchor6" ).prop( "href" ), "Check for absolute href prop on an anchor" );103103
104104 jQuery( "<script type='jquery/test' src='#5' id='scriptSrc'></script>" ).appendTo( "#qunit-fixture" );@@ -136,7 +136,7 @@ QUnit.test( "attr(String)", function( assert ) {136136 assert.equal( $img.attr( "height" ), "53", "Retrieve height attribute on an element with display:none." );137137
138138 // Check for style support139- styleElem = jQuery( "<div/>" ).appendTo( "#qunit-fixture" ).css( {139+ styleElem = jQuery( "<div></div>" ).appendTo( "#qunit-fixture" ).css( {140140 background: "url(UPPERlower.gif)"141141 } );142142 assert.ok( !!~styleElem.attr( "style" ).indexOf( "UPPERlower.gif" ), "Check style attribute getter" );@@ -158,11 +158,11 @@ QUnit.test( "attr(String)", function( assert ) {158158 $a = jQuery( "<a href='#' onclick='something()'>Click</a>" ).appendTo( "#qunit-fixture" );159159 assert.equal( $a.attr( "onclick" ), "something()", "Retrieve ^on attribute without anonymous function wrapper." );160160
161- assert.ok( jQuery( "<div/>" ).attr( "doesntexist" ) === undefined, "Make sure undefined is returned when no attribute is found." );162- assert.ok( jQuery( "<div/>" ).attr( "title" ) === undefined, "Make sure undefined is returned when no attribute is found." );163- assert.equal( jQuery( "<div/>" ).attr( "title", "something" ).attr( "title" ), "something", "Set the title attribute." );161+ assert.ok( jQuery( "<div></div>" ).attr( "doesntexist" ) === undefined, "Make sure undefined is returned when no attribute is found." );162+ assert.ok( jQuery( "<div></div>" ).attr( "title" ) === undefined, "Make sure undefined is returned when no attribute is found." );163+ assert.equal( jQuery( "<div></div>" ).attr( "title", "something" ).attr( "title" ), "something", "Set the title attribute." );164164 assert.ok( jQuery().attr( "doesntexist" ) === undefined, "Make sure undefined is returned when no element is there." );165- assert.equal( jQuery( "<div/>" ).attr( "value" ), undefined, "An unset value on a div returns undefined." );165+ assert.equal( jQuery( "<div></div>" ).attr( "value" ), undefined, "An unset value on a div returns undefined." );166166 assert.strictEqual( jQuery( "<select><option value='property'></option></select>" ).attr( "value" ), undefined, "An unset value on a select returns undefined." );167167
168168 $form = jQuery( "#form" ).attr( "enctype", "multipart/form-data" );@@ -180,7 +180,7 @@ QUnit.test( "attr(String) on cloned elements, #9646", function( assert ) {180180
181181 assert.strictEqual( input.clone( true ).attr( "name", "test" )[ 0 ].name, "test", "Name attribute should be changed on cloned element" );182182
183- div = jQuery( "<div id='tester' />" );183+ div = jQuery( "<div id='tester'></div>" );184184 div.attr( "id" );185185
186186 assert.strictEqual( div.clone( true ).attr( "id", "test" )[ 0 ].id, "test", "Id attribute should be changed on cloned element" );@@ -299,7 +299,7 @@ QUnit.test( "attr(String, Object)", function( assert ) {299299 $input = jQuery( "<input type='checkbox'/>" ).attr( "checked", true );300300 assert.equal( $input.prop( "checked" ), true, "Setting checked updates property (verified by .prop)" );301301 assert.equal( $input[ 0 ].checked, true, "Setting checked updates property (verified by native property)" );302- $input = jQuery( "<option/>" ).attr( "selected", true );302+ $input = jQuery( "<option></option>" ).attr( "selected", true );303303 assert.equal( $input.prop( "selected" ), true, "Setting selected updates property (verified by .prop)" );304304 assert.equal( $input[ 0 ].selected, true, "Setting selected updates property (verified by native property)" );305305
@@ -592,7 +592,7 @@ QUnit.test( "removeAttr(String)", function( assert ) {592592 assert.expect( 12 );593593 var $first;594594
595- assert.equal( jQuery( "<div class='hello' />" ).removeAttr( "class" ).attr( "class" ), undefined, "remove class" );595+ assert.equal( jQuery( "<div class='hello'></div>" ).removeAttr( "class" ).attr( "class" ), undefined, "remove class" );596596 assert.equal( jQuery( "#form" ).removeAttr( "id" ).attr( "id" ), undefined, "Remove id" );597597 assert.equal( jQuery( "#foo" ).attr( "style", "position:absolute;" ).removeAttr( "style" ).attr( "style" ), undefined, "Check removing style attribute" );598598 assert.equal( jQuery( "#form" ).attr( "style", "position:absolute;" ).removeAttr( "style" ).attr( "style" ), undefined, "Check removing style attribute on a form" );@@ -692,7 +692,7 @@ QUnit.test( "prop(String, Object)", function( assert ) {692692 assert.equal( jQuery( "#select2" ).prop( "selectedIndex" ), 3, "Check for selectedIndex attribute" );693693 assert.equal( jQuery( "#foo" ).prop( "nodeName" ).toUpperCase(), "DIV", "Check for nodeName attribute" );694694 assert.equal( jQuery( "#foo" ).prop( "tagName" ).toUpperCase(), "DIV", "Check for tagName attribute" );695- assert.equal( jQuery( "<option/>" ).prop( "selected" ), false, "Check selected attribute on disconnected element." );695+ assert.equal( jQuery( "<option></option>" ).prop( "selected" ), false, "Check selected attribute on disconnected element." );696696
697697 assert.equal( jQuery( "#listWithTabIndex" ).prop( "tabindex" ), 5, "Check retrieving tabindex" );698698 jQuery( "#text1" ).prop( "readonly", true );@@ -837,16 +837,16 @@ QUnit.test( "option.prop('selected', true) affects select.selectedIndex (gh-2732837837
838838 function addOptions( $elem ) {839839 return $elem.append(840- jQuery( "<option/>" ).val( "a" ).text( "One" ),841- jQuery( "<option/>" ).val( "b" ).text( "Two" ),842- jQuery( "<option/>" ).val( "c" ).text( "Three" )840+ jQuery( "<option></option>" ).val( "a" ).text( "One" ),841+ jQuery( "<option></option>" ).val( "b" ).text( "Two" ),842+ jQuery( "<option></option>" ).val( "c" ).text( "Three" )843843 )844844 .find( "[value=a]" ).prop( "selected", true ).end()845845 .find( "[value=c]" ).prop( "selected", true ).end();846846 }847847
848848 var $optgroup,849- $select = jQuery( "<select/>" );849+ $select = jQuery( "<select></select>" );850850
851851 // Check select with options852852 addOptions( $select ).appendTo( "#qunit-fixture" );@@ -856,7 +856,7 @@ QUnit.test( "option.prop('selected', true) affects select.selectedIndex (gh-2732856856 $select.empty();857857
858858 // Check select with optgroup859- $optgroup = jQuery( "<optgroup/>" );859+ $optgroup = jQuery( "<optgroup></optgroup>" );860860 addOptions( $optgroup ).appendTo( $select );861861 $select.find( "[value=b]" ).prop( "selected", true );862862
@@ -970,7 +970,7 @@ QUnit.test( "val()", function( assert ) {970970 assert.equal( $button.val(), "foobar", "Value retrieval on a button does not return innerHTML" );971971 assert.equal( $button.val( "baz" ).html(), "text", "Setting the value does not change innerHTML" );972972
973- assert.equal( jQuery( "<option/>" ).val( "test" ).attr( "value" ), "test", "Setting value sets the value attribute" );973+ assert.equal( jQuery( "<option></option>" ).val( "test" ).attr( "value" ), "test", "Setting value sets the value attribute" );974974} );975975
976976QUnit.test( "val() with non-matching values on dropdown list", function( assert ) {@@ -1029,7 +1029,7 @@ var testVal = function( valueObj, assert ) {10291029 assert.equal( document.getElementById( "text1" ).value, "", "Check for modified (via val(null)) value of input element" );10301030
10311031 var j,1032- $select = jQuery( "<select multiple><option value='1'/><option value='2'/></select>" ),1032+ $select = jQuery( "<select multiple><option value='1'></option><option value='2'></option></select>" ),10331033 $select1 = jQuery( "#select1" );10341034
10351035 $select1.val( valueObj( "3" ) );@@ -1145,7 +1145,7 @@ QUnit.test( "val(select) after form.reset() (Bug #2551)", function( assert ) {11451145QUnit.test( "select.val(space characters) (gh-2978)", function( assert ) {11461146 assert.expect( 37 );11471147
1148- var $select = jQuery( "<select/>" ).appendTo( "#qunit-fixture" ),1148+ var $select = jQuery( "<select></select>" ).appendTo( "#qunit-fixture" ),11491149 spaces = {11501150 "\\t": {11511151 html: "	",@@ -1230,7 +1230,7 @@ var testAddClass = function( valueObj, assert ) {12301230 j.addClass( valueObj( "asdf" ) );12311231 assert.ok( j.hasClass( "asdf" ), "Check node,textnode,comment for addClass" );12321232
1233- div = jQuery( "<div/>" );1233+ div = jQuery( "<div></div>" );12341234
12351235 div.addClass( valueObj( "test" ) );12361236 assert.equal( div.attr( "class" ), "test", "Make sure there's no extra whitespace." );@@ -1669,17 +1669,17 @@ QUnit.test( "coords returns correct values in IE6/IE7, see #10828", function( as16691669 assert.expect( 1 );16701670
16711671 var area,1672- map = jQuery( "<map />" );1672+ map = jQuery( "<map></map>" );16731673
1674- area = map.html( "<area shape='rect' coords='0,0,0,0' href='#' alt='a' />" ).find( "area" );1674+ area = map.html( "<area shape='rect' coords='0,0,0,0' href='#' alt='a'></area>" ).find( "area" );16751675 assert.equal( area.attr( "coords" ), "0,0,0,0", "did not retrieve coords correctly" );16761676} );16771677
16781678QUnit.test( "should not throw at $(option).val() (#14686)", function( assert ) {16791679 assert.expect( 1 );16801680
16811681 try {1682- jQuery( "<option/>" ).val();1682+ jQuery( "<option></option>" ).val();16831683 assert.ok( true );16841684 } catch ( _ ) {16851685 assert.ok( false );| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
| 141 | + | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
152 | | - | |
| 152 | + | |
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
171 | | - | |
| 171 | + | |
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
| 176 | + | |
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
186 | | - | |
| 185 | + | |
| 186 | + | |
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
200 | | - | |
201 | | - | |
| 200 | + | |
| 201 | + | |
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| |||
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
461 | | - | |
| 461 | + | |
462 | 462 | | |
463 | 463 | | |
464 | 464 | | |
| |||
526 | 526 | | |
527 | 527 | | |
528 | 528 | | |
529 | | - | |
530 | | - | |
| 529 | + | |
| 530 | + | |
531 | 531 | | |
532 | 532 | | |
533 | 533 | | |
| |||
1356 | 1356 | | |
1357 | 1357 | | |
1358 | 1358 | | |
1359 | | - | |
| 1359 | + | |
1360 | 1360 | | |
1361 | 1361 | | |
1362 | 1362 | | |
| |||
0 commit comments