Commit 6cdca88e authored by timmywil's avatar timmywil

Restore rhtmlString to its original form. 1.9 will come with starts-with html...

Restore rhtmlString to its original form. 1.9 will come with starts-with html matching. For now, we are warning against broad use of jQuery() to parse html.
parent c20e0310
...@@ -41,8 +41,7 @@ var ...@@ -41,8 +41,7 @@ var
// A simple way to check for HTML strings // A simple way to check for HTML strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521) // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
// Ignore html if within quotes "" '' or brackets/parens [] () rhtmlString = /^(?:[^#<]*(<[\w\W]+>)[^>]*$)/,
rhtmlString = /^(?:[^#<\\]*(<[\w\W]+>)(?![^\[]*\])(?![^\(]*\))(?![^']*')(?![^"]*")[^>]*$)/,
// Match a standalone tag // Match a standalone tag
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
......
...@@ -605,7 +605,7 @@ test("isWindow", function() { ...@@ -605,7 +605,7 @@ test("isWindow", function() {
}); });
test("jQuery('html')", function() { test("jQuery('html')", function() {
expect( 22 ); expect( 18 );
QUnit.reset(); QUnit.reset();
jQuery.foo = false; jQuery.foo = false;
...@@ -638,10 +638,10 @@ test("jQuery('html')", function() { ...@@ -638,10 +638,10 @@ test("jQuery('html')", function() {
ok( jQuery("<div></div>")[0], "Create a div with closing tag." ); ok( jQuery("<div></div>")[0], "Create a div with closing tag." );
ok( jQuery("<table></table>")[0], "Create a table with closing tag." ); ok( jQuery("<table></table>")[0], "Create a table with closing tag." );
equal( jQuery("element[attribute='<div></div>']").length, 0, "When html is within brackets, do not recognize as html." ); // equal( jQuery("element[attribute='<div></div>']").length, 0, "When html is within brackets, do not recognize as html." );
equal( jQuery("element[attribute=<div></div>]").length, 0, "When html is within brackets, do not recognize as html." ); // equal( jQuery("element[attribute=<div></div>]").length, 0, "When html is within brackets, do not recognize as html." );
equal( jQuery("element:not(<div></div>)").length, 0, "When html is within parens, do not recognize as html." ); // equal( jQuery("element:not(<div></div>)").length, 0, "When html is within parens, do not recognize as html." );
equal( jQuery("\\<div\\>").length, 0, "Ignore escaped html characters" ); // equal( jQuery("\\<div\\>").length, 0, "Ignore escaped html characters" );
// Test very large html string #7990 // Test very large html string #7990
var i; var i;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment