Bug Tracker

Modify

Ticket #11051 (closed bug: duplicate)

Opened 18 months ago

Last modified 18 months ago

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

Reported by: trevor@… Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.1
Keywords: Cc:
Blocking: Blocked by:

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

comment:1 Changed 18 months ago by dmethvin

  • Status changed from new to closed
  • Resolution set to duplicate

comment:2 Changed 18 months ago by dmethvin

Duplicate of #10782.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.