Manipulation: Generalize a test to support IE

Ref gh-5378
Closes gh-5391
This commit is contained in:
Richard Gibson 2024-01-12 18:19:33 -05:00 committed by GitHub
parent e06ff08849
commit 88690ebfc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1826,11 +1826,25 @@ QUnit.test( "html(self-removing script) (gh-5377)", function( assert ) {
$fixture.html( $fixture.html(
[ [
"<script>document.currentScript.parentNode.removeChild( document.currentScript ); QUnit.assert.ok( true, 'removed document.currentScript' );</script>", "<script id='gh5377-1'>",
"(function removeScript() {",
"var id = 'gh5377-1';",
"var script = document.currentScript || document.getElementById(id);",
"script.parentNode.removeChild( script );",
"QUnit.assert.ok( true, 'removed document.currentScript' );",
"})();",
"</script>",
"<div>", "<div>",
"<script>document.currentScript.parentNode.removeChild( document.currentScript ); QUnit.assert.ok( true, 'removed inner document.currentScript' );</script>", "<script id='gh5377-2'>",
"(function removeInnerScript() {",
"var id = 'gh5377-2';",
"var innerScript = document.currentScript || document.getElementById(id);",
"innerScript.parentNode.removeChild( innerScript );",
"QUnit.assert.ok( true, 'removed inner document.currentScript' );",
"})();",
"</script>",
"</div>" "</div>"
].join( "" ) ].join( "\n" )
); );
} ); } );