From 00a05ad98513d037d1fde190626ec75dd9326f9e Mon Sep 17 00:00:00 2001 From: cmcnulty Date: Fri, 25 Feb 2011 11:40:05 -0800 Subject: [PATCH 1/4] #6782 - optimized regex to allow more html snippets to user innerHTML --- src/manipulation.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/manipulation.js b/src/manipulation.js index ba31697155..9da9b6fac6 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -6,6 +6,7 @@ var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, rtagName = /<([\w:]+)/, rtbody = / Date: Fri, 25 Feb 2011 11:45:04 -0800 Subject: [PATCH 2/4] --- test/unit/manipulation.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index 34425ed3a4..e05200c4cb 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -1080,6 +1080,19 @@ var testHtml = function(valueObj) { equals( jQuery("#main").children()[0].nodeName.toUpperCase(), "STYLE", "And that a style element was inserted." ); QUnit.reset(); + + jQuery("#main").html(valueObj("")); + ok((jQuery("#main").children().length > 0), "Make sure there is a child EMBED element." ); + equals( jQuery("#main").children()[0].nodeName.toUpperCase(), "EMBED", "And that an embed element was inserted." ); + + QUnit.reset(); + + jQuery("#main").html(valueObj("")); + equals( jQuery("#main").children().length, 1, "Make sure there is a child OBJECT element." ); + equals( jQuery("#main").children()[0].nodeName.toUpperCase(), "OBJECT", "And that an object element was inserted." ); + + QUnit.reset(); + // using contents will get comments regular, text, and comment nodes var j = jQuery("#nonnodes").contents(); j.html(valueObj("bold")); From 4aafe727daa4ba6b0ac632f6ee79556eacd7712c Mon Sep 17 00:00:00 2001 From: cmcnulty Date: Fri, 25 Feb 2011 12:26:04 -0800 Subject: [PATCH 3/4] Forgot to update the test counts --- test/unit/manipulation.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index e05200c4cb..a5b7189318 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -1053,7 +1053,7 @@ test("clone() on XML nodes", function() { } var testHtml = function(valueObj) { - expect(31); + expect(35); jQuery.scriptorder = 0; @@ -1141,7 +1141,7 @@ test("html(String)", function() { test("html(Function)", function() { testHtml(functionReturningObj); - expect(33); + expect(37); QUnit.reset(); From 2746d7f29976462499fa98181986f47c75258c94 Mon Sep 17 00:00:00 2001 From: cmcnulty Date: Wed, 9 Mar 2011 12:44:46 -0800 Subject: [PATCH 4/4] move embed tests to area where objects tests are already happening --- test/unit/manipulation.js | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index a5b7189318..34e140b965 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -898,7 +898,7 @@ test("clone() (#8070)", function () { }); test("clone()", function() { - expect(37); + expect(40); equals( 'This is a normal link: Yahoo', jQuery('#en').text(), 'Assert text for #en' ); var clone = jQuery('#yahoo').clone(); equals( 'Try them out:Yahoo', jQuery('#first').append(clone).text(), 'Check for clone' ); @@ -965,6 +965,14 @@ test("clone()", function() { cloneEvt.remove(); divEvt.remove(); + // Test both html() and clone() for ").html(''); + + clone = div.clone(true); + equals( clone.length, 1, "One element cloned" ); + equals( clone.html(), div.html(), "Element contents cloned" ); + equals( clone[0].nodeName.toUpperCase(), "DIV", "DIV element cloned" ); + // this is technically an invalid object, but because of the special // classid instantiation it is the only kind that IE has trouble with, // so let's test with it too. @@ -1053,7 +1061,7 @@ test("clone() on XML nodes", function() { } var testHtml = function(valueObj) { - expect(35); + expect(31); jQuery.scriptorder = 0; @@ -1081,18 +1089,6 @@ var testHtml = function(valueObj) { QUnit.reset(); - jQuery("#main").html(valueObj("")); - ok((jQuery("#main").children().length > 0), "Make sure there is a child EMBED element." ); - equals( jQuery("#main").children()[0].nodeName.toUpperCase(), "EMBED", "And that an embed element was inserted." ); - - QUnit.reset(); - - jQuery("#main").html(valueObj("")); - equals( jQuery("#main").children().length, 1, "Make sure there is a child OBJECT element." ); - equals( jQuery("#main").children()[0].nodeName.toUpperCase(), "OBJECT", "And that an object element was inserted." ); - - QUnit.reset(); - // using contents will get comments regular, text, and comment nodes var j = jQuery("#nonnodes").contents(); j.html(valueObj("bold")); @@ -1141,7 +1137,7 @@ test("html(String)", function() { test("html(Function)", function() { testHtml(functionReturningObj); - expect(37); + expect(33); QUnit.reset();