Bug Tracker

Modify

Ticket #12293 (closed bug: invalid)

Opened 21 months ago

Last modified 21 months ago

function outerWidth doesn't work

Reported by: jquery@… Owned by:
Priority: low Milestone: None
Component: dimensions Version: 1.8.0
Keywords: Cc:
Blocking: Blocked by:

Description

In version 1.8.0 $('li#id').outerWidth() returns DOM object instead of integer.

Change History

comment:1 follow-up: ↓ 2 Changed 21 months ago by sindresorhus

  • Priority changed from undecided to low
  • Resolution set to invalid
  • Status changed from new to closed
  • Component changed from unfiled to dimensions

Cannot reproduce in IE6-9, Firefox 3.6 / latest, Chrome, Safari, Opera 12.

 http://jsfiddle.net/mofle/FhrPT/

comment:2 in reply to: ↑ 1 Changed 21 months ago by anonymous

Replying to sindresorhus:

Cannot reproduce in IE6-9, Firefox 3.6 / latest, Chrome, Safari, Opera 12.

 http://jsfiddle.net/mofle/FhrPT/

Well it doesn't work with jquery-ui-1.8.20/ui/minified/jquery.ui.core.min.js but it works with jquery-ui-1.8.22/ui/minified/jquery.ui.core.min.js.

comment:3 Changed 21 months ago by mikesherov

Please upgrade jqueryUI to 1.8.22, as that's the one that's compatible with jQuery 1.8

comment:4 Changed 21 months ago by anonymous

From my analysis

In 1.7.2, any truthy value passed to outerWidth would be considered include margin true.

 http://jsfiddle.net/rx7s9/

In 1.8.0, only true boolean is considered include margin true

 http://jsfiddle.net/KFPP6/

comment:5 Changed 21 months ago by mikesherov

  • Keywords needsdocs added

That's because in 1.8, the dimension functions are now setters too, and not just getters! You can do

$(elem).outerWidth(50);

And automatically set content+padding+border to 50! Or you can do:

$(elem).outerWidth(50, true);

And automatically set content+padding+border+margin to 50! Awesome, right?

Needs docs.

comment:6 Changed 21 months ago by TriBao

yes, that's awesome but VERY DANGEROUS change! a lot of code uses outerWidth() as getter. Now, everything's broken. Everybody needs a search-replace their code if they want to upgrade to 1.8.0. It's not a safe change for javascript code which has no compiler to make this change revealed.

comment:7 Changed 21 months ago by dmethvin

No problems. outerWidth() continues to work as a getter. Before, it accepted either no arguments or a single Boolean argument. If you were passing it something else, you were doing it wrong, which is VERY DANGEROUS because it could break when the API is updated.

comment:8 Changed 21 months ago by dmethvin

#12159 is a duplicate of this ticket.

comment:9 Changed 21 months ago by dmethvin

  • Keywords needsdocs removed

#10877 has the needsdocs.

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.