Permalink
Browse files

- Added CSS character unescaping

- Removed ampersand HTML entity escaping
  • Loading branch information...
1 parent 5db9773 commit 8213a607e9c973e66ec99f0a187fcf064a24c6ee @sebdeckers sebdeckers committed Jun 20, 2010
Showing with 6 additions and 4 deletions.
  1. +6 −4 Client/src/main/XHTML-IM.js
@@ -202,10 +202,12 @@ function FilterNode ( Message, HTMLElement, XMLTag )
if ( AttributeName == 'style' )
{
var Style = Attributes( i ).value
- .replace( /\/\*.*?(?:(?:\*\/)|$)/g, '' )
- .replace( '\\', '' )
- .replace( '&', '&' )
- .replace( '&', '&' );
+ // Unescape characters
+ .replace(/\\([0-9a-f]{6}|(?:[0-9a-f]{1,5}\s?))/gi, function (fullMatch, hexCodeMatch) {
+ return String.fromCharCode(parseInt(hexCodeMatch, 16))
+ })
+ // Strip comments
+ .replace(/\/\*.*?(?:(?:\*\/)|$)/g, "");
if ( ! BlackProtocolsRegEx.test( Style ) && ! BlackStylesRegEx.test( Style ) )
NodeHTMLElement.style.cssText = Style;
}

0 comments on commit 8213a60

Please sign in to comment.