Bug Tracker

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#11051 closed bug (duplicate)

.width() and css('width') report percentages incorrectly

Reported by: trevor@… 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@…

Change History (2)

comment:1 Changed 6 years ago by dmethvin

Resolution: duplicate
Status: newclosed

comment:2 Changed 6 years ago by dmethvin

Duplicate of #10782.

Note: See TracTickets for help on using tickets.