@@ -1826,11 +1826,25 @@ QUnit.test( "html(self-removing script) (gh-5377)", function( assert ) {
18261826
18271827$fixture . html (
18281828[
1829- "<script>document.currentScript.parentNode.removeChild( document.currentScript ); QUnit.assert.ok( true, 'removed document.currentScript' );</script>" ,
1829+ "<script id='gh5377-1'>" ,
1830+ "(function removeScript() {" ,
1831+ "var id = 'gh5377-1';" ,
1832+ "var script = document.currentScript || document.getElementById(id);" ,
1833+ "script.parentNode.removeChild( script );" ,
1834+ "QUnit.assert.ok( true, 'removed document.currentScript' );" ,
1835+ "})();" ,
1836+ "</script>" ,
18301837"<div>" ,
1831- "<script>document.currentScript.parentNode.removeChild( document.currentScript ); QUnit.assert.ok( true, 'removed inner document.currentScript' );</script>" ,
1838+ "<script id='gh5377-2'>" ,
1839+ "(function removeInnerScript() {" ,
1840+ "var id = 'gh5377-2';" ,
1841+ "var innerScript = document.currentScript || document.getElementById(id);" ,
1842+ "innerScript.parentNode.removeChild( innerScript );" ,
1843+ "QUnit.assert.ok( true, 'removed inner document.currentScript' );" ,
1844+ "})();" ,
1845+ "</script>" ,
18321846"</div>"
1833- ] . join ( "" )
1847+ ] . join ( "\n " )
18341848) ;
18351849} ) ;
18361850