Side navigation
#8388 closed bug (fixed)
Opened February 25, 2011 11:15PM UTC
Closed October 22, 2011 08:12PM UTC
.css(prop) fails in IE for detached elements
Reported by: | jaredjacobs@gmail.com | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | 1.next |
Component: | css | Version: | 1.5.1 |
Keywords: | needsreview | Cc: | |
Blocked by: | Blocking: |
Description
This seems to be a regression introduced in 1.4.3 and still broken in 1.5.1. (1.4.2 does not have the bug.)
In most browsers:
$("<div/>").css("top", 10).css("top") > "10px"
However, in IE (I tried IE 8):
$("<div/>").css("top", 10).css("top") > null
even though:
$("<div/>").css("top", 10)[0].style.top > "10px"
Attachments (0)
Change History (8)
Changed February 25, 2011 11:25PM UTC by comment:1
Changed March 07, 2011 12:19AM UTC by comment:2
component: | unfiled → manipulation |
---|---|
priority: | undecided → high |
status: | new → open |
Confirmed.
Changed March 07, 2011 12:42AM UTC by comment:3
keywords: | → needsreview |
---|
Changed April 22, 2011 01:50AM UTC by comment:4
Most likely because it's getting the computed style and not the literal css string. I don't know if this is a reasonable request of the browser since top
doesn't make a lot of sense on a disconnected element.
Changed July 12, 2011 07:30PM UTC by comment:5
component: | manipulation → css |
---|
We should be checking to see if the node is disconnected and just using .style.top instead. Confirmed in bug triage.
Changed October 18, 2011 02:50AM UTC by comment:6
Changed October 22, 2011 08:12PM UTC by comment:8
resolution: | → fixed |
---|---|
status: | open → closed |
Landing pull request 553. Fallback to elem.style for disconnected nodes in width/height retrieval. Fixes #8388.
More Details:
- https://github.com/jquery/jquery/pull/553
- http://bugs.jquery.com/ticket/10254
- http://bugs.jquery.com/ticket/8388
Changeset: e502012c0f8e7604eaabe4065ba769af04eec180
A workaround is attaching the element to the document:
P.S. Here's a jsfiddle demonstrating the problem (in IE):
http://jsfiddle.net/qrXen/1/