Opened 12 years ago
Closed 12 years ago
#8388 closed bug (fixed)
.css(prop) fails in IE for detached elements
Reported by: | 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"
Change History (8)
comment:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
Component: | unfiled → manipulation |
---|---|
Priority: | undecided → high |
Status: | new → open |
Confirmed.
comment:3 Changed 12 years ago by
Keywords: | needsreview added |
---|
comment:4 Changed 12 years ago by
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.
comment:5 Changed 12 years ago by
Component: | manipulation → css |
---|
We should be checking to see if the node is disconnected and just using .style.top instead. Confirmed in bug triage.
comment:8 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
Landing pull request 553. Fallback to elem.style for disconnected nodes in width/height retrieval. Fixes #8388.
More Details:
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/