diff options
author | Richard Gibson <richard.gibson@gmail.com> | 2024-01-12 18:19:33 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-13 00:19:33 +0100 |
commit | 88690ebfc8b5ef8b1e444326c664b590ecc0b888 (patch) | |
tree | e34710d4ee38e48a6ae0e29136ce42a5b232a421 | |
parent | e06ff08849057cd099365bf43598c8952fe9956d (diff) | |
download | jquery-88690ebfc8b5ef8b1e444326c664b590ecc0b888.tar.gz jquery-88690ebfc8b5ef8b1e444326c664b590ecc0b888.zip |
Manipulation: Generalize a test to support IE
Ref gh-5378
Closes gh-5391
-rw-r--r-- | test/unit/manipulation.js | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index b40ba6056..8be07c1df 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -1826,11 +1826,25 @@ QUnit.test( "html(self-removing script) (gh-5377)", function( assert ) { $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>", - "<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>" - ].join( "" ) + ].join( "\n" ) ); } ); |