Commit d7438999 authored by jeresig's avatar jeresig

Make sure that &#...; entities are encoded properly. Fixes #6042.

parent 54bd004e
...@@ -4,7 +4,7 @@ var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, ...@@ -4,7 +4,7 @@ var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
rselfClosing = /^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i, rselfClosing = /^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,
rtagName = /<([\w:]+)/, rtagName = /<([\w:]+)/,
rtbody = /<tbody/i, rtbody = /<tbody/i,
rhtml = /<|&\w+;/, rhtml = /<|&#?\w+;/,
rnocache = /<script|<object|<embed/i, rnocache = /<script|<object|<embed/i,
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, // checked="checked" or checked (html5) rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, // checked="checked" or checked (html5)
fcloseTag = function( all, front, tag ) { fcloseTag = function( all, front, tag ) {
......
...@@ -851,7 +851,7 @@ test("clone() on XML nodes", function() { ...@@ -851,7 +851,7 @@ test("clone() on XML nodes", function() {
} }
var testHtml = function(valueObj) { var testHtml = function(valueObj) {
expect(24); expect(26);
jQuery.scriptorder = 0; jQuery.scriptorder = 0;
...@@ -868,6 +868,9 @@ var testHtml = function(valueObj) { ...@@ -868,6 +868,9 @@ var testHtml = function(valueObj) {
equals( div.children().length, 2, "Make sure two child nodes exist." ); equals( div.children().length, 2, "Make sure two child nodes exist." );
equals( div.children().children().length, 1, "Make sure that a grandchild exists." ); equals( div.children().children().length, 1, "Make sure that a grandchild exists." );
equals( jQuery("<div/>").html(valueObj("&#160;"))[0].innerHTML, "&nbsp;", "Make sure entities are passed through correctly." );
equals( jQuery("<div/>").html(valueObj("&amp;"))[0].innerHTML, "&amp;", "Make sure entities are passed through correctly." );
reset(); reset();
// using contents will get comments regular, text, and comment nodes // using contents will get comments regular, text, and comment nodes
var j = jQuery("#nonnodes").contents(); var j = jQuery("#nonnodes").contents();
......
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