]> source.dussan.org Git - jquery.git/commitdiff
Make sure that &#...; entities are encoded properly. Fixes #6042.
authorjeresig <jeresig@gmail.com>
Sat, 6 Feb 2010 00:58:08 +0000 (19:58 -0500)
committerjeresig <jeresig@gmail.com>
Sat, 6 Feb 2010 00:58:08 +0000 (19:58 -0500)
src/manipulation.js
test/unit/manipulation.js

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