Commit 7c4144fa authored by John Resig's avatar John Resig

Fixed the case where HTML that contained entities was being inserted as text...

Fixed the case where HTML that contained entities was being inserted as text strings instead of HTML. Thanks to dmethvin for the test case! Fixes #5483.
parent 449e099b
...@@ -4,7 +4,7 @@ var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, ...@@ -4,7 +4,7 @@ var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
rselfClosing = /^(?:abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i, rselfClosing = /^(?:abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i,
rtagName = /<([\w:]+)/, rtagName = /<([\w:]+)/,
rtbody = /<tbody/i, rtbody = /<tbody/i,
rhtml = /</, rhtml = /<|&\w+;/,
fcloseTag = function(all, front, tag){ fcloseTag = function(all, front, tag){
return rselfClosing.test(tag) ? return rselfClosing.test(tag) ?
all : all :
......
...@@ -643,7 +643,7 @@ test("val(Function)", function() { ...@@ -643,7 +643,7 @@ test("val(Function)", function() {
}) })
var testHtml = function(valueObj) { var testHtml = function(valueObj) {
expect(17); expect(20);
window.debug = true; window.debug = true;
...@@ -676,6 +676,12 @@ var testHtml = function(valueObj) { ...@@ -676,6 +676,12 @@ var testHtml = function(valueObj) {
equals( $div.html(valueObj( 5 )).html(), '5', 'Setting a number as html' ); equals( $div.html(valueObj( 5 )).html(), '5', 'Setting a number as html' );
equals( $div.html(valueObj( 0 )).html(), '0', 'Setting a zero as html' ); equals( $div.html(valueObj( 0 )).html(), '0', 'Setting a zero as html' );
var $div2 = jQuery('<div/>'), insert = "&lt;div&gt;hello1&lt;/div&gt;";
equals( $div2.html(insert).html(), insert, "Verify escaped insertion." );
equals( $div2.html("x" + insert).html(), "x" + insert, "Verify escaped insertion." );
equals( $div2.html(" " + insert).html(), " " + insert, "Verify escaped insertion." );
reset(); reset();
jQuery("#main").html(valueObj('<script type="something/else">ok( false, "Non-script evaluated." );</script><script type="text/javascript">ok( true, "text/javascript is evaluated." );</script><script>ok( true, "No type is evaluated." );</script><div><script type="text/javascript">ok( true, "Inner text/javascript is evaluated." );</script><script>ok( true, "Inner No type is evaluated." );</script><script type="something/else">ok( false, "Non-script evaluated." );</script></div>')); jQuery("#main").html(valueObj('<script type="something/else">ok( false, "Non-script evaluated." );</script><script type="text/javascript">ok( true, "text/javascript is evaluated." );</script><script>ok( true, "No type is evaluated." );</script><div><script type="text/javascript">ok( true, "Inner text/javascript is evaluated." );</script><script>ok( true, "Inner No type is evaluated." );</script><script type="something/else">ok( false, "Non-script evaluated." );</script></div>'));
......
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