jquery/jquery — comment on commit 7f6a991313380b74d5fb18782fb6b99fd6c4a22d
File:  line 0
By heygrady:

That's fair enough. Interpretation of the CSSOM is the conversation going on in the WebKit bugs. In some ways that's irrelevant here because we're trying to make `$.css` return the *used value* instead of the *computed value*. It's equally irrelevant if WebKit is already doing things 100% correctly. My testing showed that among the most recent stable versions of IE, Safari, Firefox and Chrome on Windows (as of Christmas 2011) the **only** browser that was returning percentages was WebKit (Safari/Chrome). The [margin bug in the WebKit tracker](https://bugs.webkit.org/show_bug.cgi?id=73334) is supposedly fixed in the dev version of WebKit but there's still an [open issue for the positioning properties](https://bugs.webkit.org/show_bug.cgi?id=29084). It's also unclear based on the Mozilla documentation if the margin bug should've been fixed independent of the other bugs based on the Mozilla definitions of *used value* and *current value* -- it seems like the bugs are highly related.

Thankfully we're working in JavaScript and don't need to get tangled up in complicated standards arguments quite as deeply. The **expected** behavior is the `$.css` function will return a px unit (unless it's a string like `font-family` or something). That's how this margin bug got reported to jQuery in the first place.

Anway:
- WebKit returns percentage in some cases (top, bottom, left, right, margin, text-indent) as of Chrome 16 and Safari 5.1 (This is a bigger deal in the cases of Mobile WebKit and Safari since those don't get updated nearly as often as Chrome)
- WebKit and Opera returns auto in some cases when an illegal value was set, like setting `top: 1em` on a `position: static` element.
- Mozilla returns *specified value* when an illegal value was set, like setting `top: 1em` on a `position: static` element.
- IE9 seems to work as expected (hooray)
- IE8 and below only return *specified value* so we have to get really hacky and use the special pixel properties (and jQuery already does a fine job fixing this but I would personally change it slightly to always use a pixel property if it exists).