define( function() {
"use strict";
- // Match a standalone tag
+ // rsingleTag matches a string consisting of a single HTML element with no attributes
+ // and captures the element's name
return ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
} );
define( function() {
"use strict";
- return ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
+ // rtagName captures the name from the first start tag in a string of HTML
+ // https://html.spec.whatwg.org/multipage/syntax.html#tag-open-state
+ // https://html.spec.whatwg.org/multipage/syntax.html#tag-name-state
+ return ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
} );
assert.strictEqual( htmlOut, htmlExpected );
} );
+QUnit.test( "Make sure tags with single-character names are found (gh-4124)", function( assert ) {
+ assert.expect( 1 );
+
+ var htmlOut,
+ htmlIn = "<p>foo<!--<td>--></p>",
+ $el = jQuery( "<div/>" );
+
+ $el.html( htmlIn );
+
+ // Lowercase and replace spaces to remove possible browser inconsistencies
+ htmlOut = $el[ 0 ].innerHTML.toLowerCase().replace( /\s/g, "" );
+
+ assert.strictEqual( htmlOut, htmlIn );
+} );
+
QUnit.test( "Insert script with data-URI (gh-1887)", 1, function( assert ) {
Globals.register( "testFoo" );
Globals.register( "testSrcFoo" );