prototype: Make String#unescapeHTML strip tags in IE. Closes #10173.

This commit is contained in:
Tobie Langel 2008-03-09 07:21:45 +00:00
parent bfee207d1a
commit c7e0a3d93c
3 changed files with 4 additions and 1 deletions

View File

@ -1,3 +1,5 @@
* Make String#unescapeHTML strip tags in IE. Closes #10173. [kangax]
* Stop form observers in unit tests. Closes #10938. [kangax]
* Performance improvements for Enumerables. Closes #11264. [Ben, Samuel Lebeau]

View File

@ -211,7 +211,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.replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');
return this.stripTags().replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');
}
});

View File

@ -287,6 +287,7 @@
assertEqual(largeTextUnescaped, largeTextEscaped.unescapeHTML());
assertEqual('1\n2', '1\n2'.unescapeHTML());
assertEqual('Pride & Prejudice', '<h1>Pride &amp; Prejudice</h1>'.unescapeHTML());
benchmark(function(){
largeTextEscaped.unescapeHTML();