jsdom bug : jQuery.support.opacity detection error #425

fishbar opened this Issue Mar 26, 2012 · 3 comments

4 participants


in jQuery src support , it set a HTML node's style as : style='top:1px;float:left;opacity:.55;'

see the opacity property, it is '.55'

in jsdom runtime, using DOMElement.style.opacity to read the opacity above , it will return ".55" ,but not "0.55" ,

so it fail when test opacity support:

opacity: /^0.55/.test( a.style.opacity )

so this is different with browser's return value !!!


DOMElement.style.opacity should return a normal Number like 0.55 , but not .55

@chad3814 chad3814 referenced this issue in chad3814/CSSStyleDeclaration Oct 17, 2012

return values with the right type #2


Are you sure? I thought all properties of .style should be of type 'string'. That's certainly how it's in the browser (Chromium):

typeof document.body.style.opacity

and CSS2Properties's IDL also describes them as of type 'DOMString'


Yeah should be a String and not a Number, but first it should be parsed into a Number and then toString() called.

@domenic domenic closed this Jul 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment