Skip to content

Commit ab0444d

Browse files
gibson042mgol
authored andcommitted
Manipulation: Generalize a test to support IE
Ref gh-5378 Closes gh-5391 (cherry picked from commit 88690eb)
1 parent 69c77ce commit ab0444d

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

test/unit/manipulation.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1878,11 +1878,25 @@ QUnit.test( "html(self-removing script) (gh-5377)", function( assert ) {
18781878

18791879
$fixture.html(
18801880
[
1881-
"<script>document.currentScript.parentNode.removeChild( document.currentScript ); QUnit.assert.ok( true, 'removed document.currentScript' );</script>",
1881+
"<script id='gh5377-1'>",
1882+
"(function removeScript() {",
1883+
"var id = 'gh5377-1';",
1884+
"var script = document.currentScript || document.getElementById(id);",
1885+
"script.parentNode.removeChild( script );",
1886+
"QUnit.assert.ok( true, 'removed document.currentScript' );",
1887+
"})();",
1888+
"</script>",
18821889
"<div>",
1883-
"<script>document.currentScript.parentNode.removeChild( document.currentScript ); QUnit.assert.ok( true, 'removed inner document.currentScript' );</script>",
1890+
"<script id='gh5377-2'>",
1891+
"(function removeInnerScript() {",
1892+
"var id = 'gh5377-2';",
1893+
"var innerScript = document.currentScript || document.getElementById(id);",
1894+
"innerScript.parentNode.removeChild( innerScript );",
1895+
"QUnit.assert.ok( true, 'removed inner document.currentScript' );",
1896+
"})();",
1897+
"</script>",
18841898
"</div>"
1885-
].join( "" )
1899+
].join( "\n" )
18861900
);
18871901
} );
18881902

0 commit comments

Comments
 (0)