🌐 AI搜索 & 代理 主页
Skip to content

Commit c4c820e

Browse files
committed
Made jQuery('<div/>') and jQuery('<div></div>') use the same code path (making the second one faster). Fixes #5293.
1 parent d933e9c commit c4c820e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/core.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ var jQuery = function( selector, context ) {
3232
rtrim = /^\s+|\s+$/g,
3333

3434
// Match a standalone tag
35-
rsingleTag = /^<(\w+)\s*\/?>$/,
35+
rsingleTag = /<(\w+)\s*\/?>(?:<\/\1>)?$/,
3636

3737
// Keep a UserAgent string for use with jQuery.browser
3838
userAgent = navigator.userAgent.toLowerCase(),

test/unit/core.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ test("isXMLDoc - XML", function() {
310310
}
311311

312312
test("jQuery('html')", function() {
313-
expect(13);
313+
expect(15);
314314

315315
reset();
316316
jQuery.foo = false;
@@ -339,6 +339,9 @@ test("jQuery('html')", function() {
339339
ok( j.length >= 2, "Check node,textnode,comment creation (some browsers delete comments)" );
340340

341341
ok( !jQuery("<option>test</option>")[0].selected, "Make sure that options are auto-selected #2050" );
342+
343+
ok( jQuery("<div></div>")[0], "Create a div with closing tag." );
344+
ok( jQuery("<table></table>")[0], "Create a table with closing tag." );
342345
});
343346

344347
test("jQuery('html', context)", function() {

0 commit comments

Comments
 (0)