Skip to content

Commit bd9145f

Browse files
brodergibson042
authored andcommittedDec 29, 2016
Tests: Added tests for symbol-separated tag names
Fixes gh-2006 Closes gh-3473
1 parent bf3a43e commit bd9145f

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed
 

‎test/unit/core.js

+18-9
Original file line numberDiff line numberDiff line change
@@ -687,17 +687,26 @@ QUnit.test( "jQuery('html')", function( assert ) {
687687
assert.equal( jQuery( "\\<div\\>" ).length, 0, "Ignore escaped html characters" );
688688
} );
689689

690-
QUnit.test( "jQuery(tag-hyphenated elements) gh-1987", function( assert ) {
691-
assert.expect( 17 );
690+
QUnit.test( "jQuery(element with non-alphanumeric name)", function( assert ) {
691+
assert.expect( 36 );
692+
693+
jQuery.each( [ "-", ":" ], function( i, symbol ) {
694+
jQuery.each( [ "thead", "tbody", "tfoot", "colgroup", "caption", "tr", "th", "td" ],
695+
function( j, tag ) {
696+
var tagName = tag + symbol + "test";
697+
var el = jQuery( "<" + tagName + "></" + tagName + ">" );
698+
assert.ok( el[ 0 ], "Create a " + tagName + " element" );
699+
assert.ok( jQuery.nodeName( el[ 0 ], tagName.toUpperCase() ),
700+
tagName + " element has expected node name" );
701+
}
702+
);
692703

693-
jQuery.each( "thead tbody tfoot colgroup caption tr th td".split( " " ), function( i, name ) {
694-
var j = jQuery( "<" + name + "-d></" + name + "-d>" );
695-
assert.ok( j[ 0 ], "Create a tag-hyphenated elements" );
696-
assert.ok( jQuery.nodeName( j[ 0 ], name.toUpperCase() + "-D" ), "Tag-hyphenated element has expected node name" );
704+
var tagName = [ "tr", "multiple", "symbol" ].join( symbol );
705+
var el = jQuery( "<" + tagName + "></" + tagName + ">" );
706+
assert.ok( el[ 0 ], "Create a " + tagName + " element" );
707+
assert.ok( jQuery.nodeName( el[ 0 ], tagName.toUpperCase() ),
708+
tagName + " element has expected node name" );
697709
} );
698-
699-
var j = jQuery( "<tr-multiple-hyphens></tr-multiple-hyphens>" );
700-
assert.ok( jQuery.nodeName( j[ 0 ], "TR-MULTIPLE-HYPHENS" ), "Element with multiple hyphens in its tag has expected node name" );
701710
} );
702711

703712
QUnit.test( "jQuery('massive html #7990')", function( assert ) {

0 commit comments

Comments
 (0)