Side navigation
#11051 closed bug (duplicate)
Opened December 17, 2011 04:30PM UTC
Closed December 17, 2011 04:59PM UTC
Last modified December 17, 2011 04:59PM UTC
.width() and css('width') report percentages incorrectly
Reported by: | trevor@udel.edu | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.7.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Hi,
If you have a image:
<div id="myDiv">
<img src="1.jpg" />
</div>
And a css rule:
#myDiv img {width:100%}
And then use jQuery:
console.log($("#myDiv img",this).css("width"));
console.log($("#myDivimg",this).width());
The result IN FIREFOX (4 and 8) is:
100px
100
In the first case, 100px is obviously wrong. It should be 100%.
In the second case, 100 is ambiguous.
In INTERNET EXPLORER, the result is:
undefined
null
In both cases, it would be helpful if it reported 100%. But, at least it doesn't incorrectly report 100px.
Thanks.
Trevor Moore
trevor@udel.edu