Core: add support to tag-hyphenated elements

Ref #1987
This commit is contained in:
Leonardo Braga 2015-01-04 17:48:35 -05:00 committed by Oleg Gaidarenko
parent a4133ffafa
commit 534f13025a
2 changed files with 14 additions and 1 deletions

View File

@ -1,4 +1,4 @@
define(function() {
// Match a standalone tag
return (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);
return (/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/);
});

View File

@ -594,6 +594,19 @@ test("jQuery('html')", function() {
equal( jQuery( "\\<div\\>" ).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></" + 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("<tr-multiple-hyphens></tr-multiple-hyphens>");
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 );