Opened 12 years ago
Closed 11 years ago
#9338 closed bug (cantfix)
jQuery .css() does not return properties for div elements not yet appended to DOM in Chrome
Reported by: | Owned by: | mikesherov | |
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | css | Version: | 1.6.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
jQuery's .css() won't return the correct values for an element not yet appended to the DOM in Chrome, but it will in Firefox. See test case.
Change History (7)
comment:1 Changed 12 years ago by
Component: | unfiled → css |
---|---|
Priority: | undecided → low |
Status: | new → open |
comment:2 Changed 12 years ago by
I'm not sure that's possible to fix if the native treatment of disconnected nodes differs. I think we'd have to connect the node to retrieve consistent css, but that could have a drastic impact on the page depending on the css applied to that node.
comment:3 Changed 11 years ago by
comment:4 Changed 11 years ago by
Also important to note that for disconnected nodes, the value should be 10px in the example, as per CSSOM spec which says that margin/padding/border/width for elements that have a display of none (including disconnected nodes) should return 0px.
However, in IE: 0px (incorrect) in chrome: empty string (incorrect) in FF: resolved value (correct)
:-\
comment:5 Changed 11 years ago by
Owner: | set to mikesherov |
---|---|
Status: | open → assigned |
I'm taking this ticket as I'm advocating for it's fix in webkit proper. There will be no fix in jQuery though unless some miracle allows us to find a hack here.
comment:7 Changed 11 years ago by
Resolution: | → cantfix |
---|---|
Status: | assigned → closed |
So, I'm going to close this ticket as CANTFIX because this behavior is consistent across chrome, safari, opera, IE9, and IE10. Only Firefox exhibits the behavior you'd like. I will continue to advocate for this as the W3C and browser vendor level, but I can't promise anything, and there is no hack I've found in any of the browsers.
Confirmed in Chrome latest.