Side navigation
#9338 closed bug (cantfix)
Opened May 18, 2011 07:08PM UTC
Closed May 23, 2012 12:27PM UTC
jQuery .css() does not return properties for div elements not yet appended to DOM in Chrome
Reported by: | purohit@gmail.com | 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.
Attachments (0)
Change History (7)
Changed May 18, 2011 07:14PM UTC by comment:1
component: | unfiled → css |
---|---|
priority: | undecided → low |
status: | new → open |
Changed May 18, 2011 07:23PM UTC by comment:2
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.
Changed October 18, 2011 03:19AM UTC by comment:3
Changed December 19, 2011 03:39AM UTC by comment:4
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)
:-\\
Changed January 08, 2012 04:47AM UTC by comment:5
owner: | → 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.
Changed January 08, 2012 05:03AM UTC by comment:6
Changed May 23, 2012 12:27PM UTC by comment:7
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.