diff --git a/src/manipulation.js b/src/manipulation.js
index 35c9544ff..bc2af18dc 100644
--- a/src/manipulation.js
+++ b/src/manipulation.js
@@ -20,7 +20,23 @@ var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
col: [ 2, "
" ],
area: [ 1, "" ],
_default: [ 0, "", "" ]
- };
+ },
+ safeFragment = (function() {
+ var nodeNames = (
+ "abbr article aside audio canvas datalist details figcaption figure footer " +
+ "header hgroup mark meter nav output progress section summary time video"
+ ).split( " " ),
+ safeFrag = document.createDocumentFragment();
+
+ if ( safeFrag.createElement ) {
+ while ( nodeNames.length ) {
+ safeFrag.createElement(
+ nodeNames.pop()
+ );
+ }
+ }
+ return safeFrag;
+ })();
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
@@ -625,6 +641,9 @@ jQuery.extend({
depth = wrap[0],
div = context.createElement("div");
+ // Append wrapper element to unknown element safe doc fragment
+ safeFragment.appendChild( div );
+
// Go to html and back, then peel off extra wrappers
div.innerHTML = wrap[1] + elem + wrap[2];
diff --git a/src/support.js b/src/support.js
index 6608d9125..ad1bd9a57 100644
--- a/src/support.js
+++ b/src/support.js
@@ -24,7 +24,7 @@ jQuery.support = (function() {
// Preliminary tests
div.setAttribute("className", "t");
- div.innerHTML = " a";
+ div.innerHTML = " a";
all = div.getElementsByTagName( "*" );
@@ -69,6 +69,9 @@ jQuery.support = (function() {
// (IE uses styleFloat instead of cssFloat)
cssFloat: !!a.style.cssFloat,
+ // Make sure unknown elements (like HTML5 elems) are handled appropriately
+ unknownElems: !!div.getElementsByTagName( "nav" ).length,
+
// Make sure that if no value is specified for a checkbox
// that it defaults to "on".
// (WebKit defaults to "" instead)
diff --git a/test/index.html b/test/index.html
index 17baa4894..294e04316 100644
--- a/test/index.html
+++ b/test/index.html
@@ -51,6 +51,15 @@
+
+
diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js
index 4017cf196..3de3fa0b9 100644
--- a/test/unit/manipulation.js
+++ b/test/unit/manipulation.js
@@ -465,6 +465,38 @@ test("append the same fragment with events (Bug #6997, 5566)", function () {
jQuery("#listWithTabIndex li.test6997").eq(1).click();
});
+test("append HTML5 sectioning elements (Bug #6485)", function () {
+ expect(2);
+
+ jQuery("#qunit-fixture").append("");
+
+ var article = jQuery("article"),
+ aside = jQuery("aside");
+
+ equal( article.css("fontSize"), "10px", 'HTML5 elements are styleable');
+ equal( aside.length, 1, 'HTML5 elements do not collapse their children')
+});
+
+test("clone() (#6485)", function () {
+ expect(1);
+
+ jQuery("").appendTo("#qunit-fixture");
+
+ var clone = jQuery("article").clone();
+
+ jQuery("#qunit-fixture").append( clone );
+
+ equal( jQuery("aside").length, 2, "clone()ing HTML5 elems does not collapse them" );
+});
+
+test("html(String) with HTML5 (Bug #6485)", function() {
+ expect(2);
+
+ jQuery("#qunit-fixture").html("");
+ equal( jQuery("#qunit-fixture").children().children().length, 1, "Make sure HTML5 article elements can hold children. innerHTML shortcut path" );
+ equal( jQuery("#qunit-fixture").children().children().children().length, 1, "Make sure nested HTML5 elements can hold children." );
+});
+
test("append(xml)", function() {
expect( 1 );