Caja-HTML-Sanitizer icon indicating copy to clipboard operation
Caja-HTML-Sanitizer copied to clipboard

type conversion on boolean variables

Open robinrossow opened this issue 12 years ago • 2 comments

hey, I just encountered the problem that a boolean false got converted to the string "false" using your sanitize function:

console.log(typeof(worldhit)); > boolean console.log(typeof(sanitizer.sanitize(worldhit))); > string

the value of the variable is false and since !!"false" === true in javascript, it is always interpreted as true.

robinrossow avatar Sep 04 '12 10:09 robinrossow

Similar problems happening for undefined variables. If I pass an undefined variable, it makes it string "undefined" and all my if(variable) checks afterwards became broken.

Working on a pull request.

masumsoft avatar Dec 24 '14 03:12 masumsoft

Fixed (finally :wink: ) and released in 0.1.3

theSmaw avatar Dec 15 '15 10:12 theSmaw