From f19595cef4a01d52ade451e90b0a1d2ceb5afe43 Mon Sep 17 00:00:00 2001 From: Leonardo Braga Date: Sun, 4 Jan 2015 17:48:35 -0500 Subject: [PATCH] Core: add support to tag-hyphenated elements Ref #1987 Ref 534f13025aeb59a7d5893ce62efafa0b066a4934 --- src/core/var/rsingleTag.js | 2 +- test/unit/core.js | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/core/var/rsingleTag.js b/src/core/var/rsingleTag.js index 7e7090b77..a8176dc64 100644 --- a/src/core/var/rsingleTag.js +++ b/src/core/var/rsingleTag.js @@ -1,4 +1,4 @@ define(function() { // Match a standalone tag - return (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); + return (/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/); }); diff --git a/test/unit/core.js b/test/unit/core.js index 8fb260ed5..370484b25 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -599,6 +599,19 @@ test("jQuery('html')", function() { equal( jQuery( "\\" ).length, 0, "Ignore escaped html characters" ); }); +test("jQuery(tag-hyphenated elements) gh-1987", function() { + expect( 17 ); + + jQuery.each( "thead tbody tfoot colgroup caption tr th td".split(" "), function( i, name ) { + var j = jQuery("<" + name + "-d>"); + ok( j[0], "Create a tag-hyphenated elements" ); + ok( jQuery.nodeName(j[0], name.toUpperCase() + "-D"), "Tag-hyphenated element has expected node name" ); + }); + + var j = jQuery(""); + ok( jQuery.nodeName(j[0], "TR-MULTIPLE-HYPHENS"), "Element with multiple hyphens in its tag has expected node name" ); +}); + test("jQuery('massive html #7990')", function() { expect( 3 ); -- 2.39.5