Permalink
Browse files

update element.write to fix comments issues

  • Loading branch information...
1 parent 42089de commit da9ae246157afe18b13f9a4f18f1237d9c4d1199 @iamnoah committed May 30, 2012
Showing with 11 additions and 2 deletions.
  1. +1 −1 lib/element.write
  2. +10 −1 test/tests2.js
View
@@ -70,7 +70,7 @@ require(['jquery','../writeCapture2','qunit/qunit'],function($,wc) {
});
test("var to global",function() {
- testSanitize( '<script>var hello = "Hello World";</script><script>document.write("Foo");document.write(hello);document.write("Bar");</script>', 'FooHello WorldBar', true);
+ testSanitize( '<script>var hello = "Hello World";</script><script>document.write("Foo");document.write(hello);document.write("Bar");</script>', 'FooHello WorldBar', true);
});
test("xdomain getElementById",function() { // issue #5
@@ -159,4 +159,13 @@ require(['jquery','../writeCapture2','qunit/qunit'],function($,wc) {
test('incomplete HTML inside a written script',function() {
// TODO what if the writer needs text from a subwriter? is that possible?
});
+
+ test('comment in a script tag',function() {
+ expect(1);
+ stop();
+ $('#foo').empty().write('<script><!--//<![CDATA[\n\ndocument.write("<scrip"+"t type=\\"text/javascript\\" src=\\"baz.js\\"> </scr"+"ipt>");\n//]]>--></script>',function() {
+ equals(trim($('#foo').find('script').remove().end().text()),'bArFoobAr');
+ start();
+ });
+ });
});

0 comments on commit da9ae24

Please sign in to comment.