diff options
Diffstat (limited to 'test/unit/manipulation.js')
-rw-r--r-- | test/unit/manipulation.js | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index 131109448..8262516a9 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -2233,19 +2233,31 @@ QUnit.test( "domManip executes scripts containing html comments or CDATA (trac-9 "</script>" ].join( "\n" ) ).appendTo( "#qunit-fixture" ); + // This test requires XHTML mode as CDATA is not recognized in HTML. + // jQuery( [ + // "<script type='text/javascript'>", + // "<![CDATA[", + // "QUnit.assert.ok( true, '<![CDATA[ handled' );", + // "//]]>", + // "</script>" + // ].join( "\n" ) ).appendTo( "#qunit-fixture" ); + jQuery( [ "<script type='text/javascript'>", - "<![CDATA[", - "QUnit.assert.ok( true, '<![CDATA[ handled' );", - "//]]>", + "<!--//--><![CDATA[//><!--", + "QUnit.assert.ok( true, '<!--//--><![CDATA[//><!-- (Drupal case) handled' );", + "//--><!]]>", "</script>" ].join( "\n" ) ).appendTo( "#qunit-fixture" ); + // ES2015 in Annex B requires HTML-style comment delimiters (`<!--` & `-->`) to act as + // single-line comment delimiters; i.e. they should be treated as `//`. + // See gh-4904 jQuery( [ "<script type='text/javascript'>", - "<!--//--><![CDATA[//><!--", - "QUnit.assert.ok( true, '<!--//--><![CDATA[//><!-- (Drupal case) handled' );", - "//--><!]]>", + "<!-- Same-line HTML comment", + "QUnit.assert.ok( true, '<!-- Same-line HTML comment' );", + "-->", "</script>" ].join( "\n" ) ).appendTo( "#qunit-fixture" ); } ); |