From c7e0a3d93c05f4268df30a80ed227cb395672e3c Mon Sep 17 00:00:00 2001 From: Tobie Langel Date: Sun, 9 Mar 2008 07:21:45 +0000 Subject: [PATCH] prototype: Make String#unescapeHTML strip tags in IE. Closes #10173. --- CHANGELOG | 2 ++ src/string.js | 2 +- test/unit/string.html | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index c30a25c..8c74f9d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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] diff --git a/src/string.js b/src/string.js index 4074402..15791b7 100644 --- a/src/string.js +++ b/src/string.js @@ -211,7 +211,7 @@ if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.proto return this.replace(/&/g,'&').replace(//g,'>'); }, unescapeHTML: function() { - return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'); + return this.stripTags().replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'); } }); diff --git a/test/unit/string.html b/test/unit/string.html index 320c687..babb58c 100644 --- a/test/unit/string.html +++ b/test/unit/string.html @@ -287,6 +287,7 @@ assertEqual(largeTextUnescaped, largeTextEscaped.unescapeHTML()); assertEqual('1\n2', '1\n2'.unescapeHTML()); + assertEqual('Pride & Prejudice', '

Pride & Prejudice

'.unescapeHTML()); benchmark(function(){ largeTextEscaped.unescapeHTML();