Doc says that "jQuery can interpret CSS and DOM formatting the properties of multiple words in the same way," but in fact he does it through crude and ready-made hacks that don't always behave predictably.
In particular, if you specify the camelCaseName DOM style, it will first try to access the inline style declaration as style.camelCaseName . Then, if this fails (usually because the style was not set in the string), it returns to trying to getComputedStyle with camelCaseName converted to hyphen-separated-name (*). A calculated style is not the same as a declared style: the browser can allow various relative declarations in the calculated style, for example, converting lengths to pixel units.
However, the opposite is not true! If you specify a hyphen-separated-name CSS style, it will go straight into the computed style code (*) without trying to convert it to camelCaseName and look at the inline style.
I donβt think I would like to rely on this behavior ... it smells a little to me. If you can keep the inline style declaration from the element you want to measure, you must be sure that you will always get the calculated style no matter what type of name you use. But then again, jQuery does not give you this as a documented promise. This is the nature of the attempt to hide the complex model behind the seemingly simple βDo What I Meanβ interface.
(*): except IE, where there is no getComputedStyle function, so it goes back to the weird and fragile combination of currentStyle , runtimeStyle and document changes to try to get a computed style.
source share