Fix order of replacement in String#unescapeHTML [#544 state:resolved] (SWeini, kangax)

This commit is contained in:
Andrew Dupont 2009-02-23 20:07:43 -06:00
parent 432a9422d6
commit e3845ba0f6
3 changed files with 5 additions and 1 deletions

View File

@ -1,3 +1,5 @@
* Fix order of replacement in String#unescapeHTML [#544 state:resolved] (SWeini, kangax)
* Fix issue where a Selector query rooted on a node that had not been attached to the document failed in IE. [#464 state:resolved] (jddalton, kangax, Douglas Fraser, Andrew Dupont)
* Fix Selector to match elements with attributes containing hyphens. [#285 state:resolved] (leiyou, jddalton, kangax)

View File

@ -431,7 +431,7 @@ if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.proto
return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
},
unescapeHTML: function() {
return this.stripTags().replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');
return this.stripTags().replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&amp;/g,'&');
}
});

View File

@ -255,6 +255,8 @@ new Test.Unit.Runner({
this.assertEqual('1\n2', '1\n2'.unescapeHTML());
this.assertEqual('Pride & Prejudice', '<h1>Pride &amp; Prejudice</h1>'.unescapeHTML());
this.assertIdentical('&lt;', '&amp;lt;'.unescapeHTML());
this.benchmark(function() { largeTextEscaped.unescapeHTML() }, 1000);
},