Bug Tracker

Modify

Ticket #7557 (closed bug: fixed)

Opened 3 years ago

Last modified 2 years ago

outerWidth()

Reported by: songofchrist@… Owned by: timmywil
Priority: blocker Milestone: 1.6.2
Component: css Version: 1.4.4
Keywords: Cc:
Blocking: Blocked by:

Description

Using Google Chrome a simple call to $(window).outerWidth() results in the message "Uncaught TypeError: Cannot read property 'width' of undefined". Same thing in Firefox and IE. Function worked fine in previous releases. Hope you can manage a fix. Keep up the good work.

Change History

comment:1 follow-up: ↓ 2 Changed 3 years ago by jitter

  • Owner set to songofchrist@…
  • Status changed from new to pending

Can you elaborate on this? In previous version $(window).outerWidth() returns NaN for me.

 test case

comment:2 in reply to: ↑ 1 Changed 3 years ago by anonymous

Replying to jitter:

Can you elaborate on this? In previous version $(window).outerWidth() returns NaN for me.

 test case

Yeah, that's what I mean. That's what you would expect -- a result that can be tested in a true/false fashion (in my code, the object outerWidth() is called on may be something besides window, something that does have an outer width value; $(window) is the default if nothing else is provided). The problem seems to be something internal. In the newest version, I don't get NaN. I get the internal error mentioned above, and the script stops executing. If we could get it to return NaN, that'd be great. Hope that helps.

comment:3 Changed 3 years ago by jitter

  • Owner songofchrist@… deleted
  • Status changed from pending to new

comment:4 Changed 3 years ago by snover

  • Keywords regression added
  • Priority changed from undecided to blocker
  • Status changed from new to open
  • Component changed from unfiled to css

So I guess we need to check that style properties exist in the cssHooks for width/height, though presumably we will end up returning undefined instead of NaN when all is said and done.

comment:5 Changed 3 years ago by snover

  • Status changed from open to closed
  • Resolution set to worksforme

Yay for quick release cycles. This is fixed in currently available release versions of Chrome.

comment:6 Changed 3 years ago by jitter

What about FF and IE (Opera?) original reporter claims it fails there too.

comment:7 Changed 3 years ago by scott.gonzalez

  • Status changed from closed to reopened
  • Resolution worksforme deleted
  • Milestone 1.5 deleted

This is not fixed, even in latest Chrome and latest jQuery.

comment:8 Changed 3 years ago by scott.gonzalez

Also, as mentioned by the original reporter and jitter, this isn't a Chrome or WebKit specific bug.

comment:9 Changed 3 years ago by timmywil

  • Keywords regression removed
  • Owner set to timmywil
  • Status changed from reopened to assigned
  • Milestone set to 1.6.2

comment:10 Changed 3 years ago by mikesherov

Just to beat a dead horse here, here are 2 JsFiddles "NaN" returned in jQuery 1.3.2 :  http://jsfiddle.net/kn3WM/ "Script Error." error in jQuery 1.4.4 :  http://jsfiddle.net/jSYRG/

comment:11 Changed 3 years ago by mikesherov

On the other hand, the documentation for this method specifically says: "This method is not applicable to window and document objects; for these, use .width() instead." So I don't think it's fair to expect consistent results across versions for this.

comment:13 Changed 3 years ago by timmywil

  • Status changed from assigned to closed
  • Resolution set to fixed

Return null for outer/inner width/height calls on window/document. Fixes #7557.

Changeset: edb2286544270dc53550180e06668e61c231fb5d

comment:14 Changed 2 years ago by rp@…

Seems like $myelement.outerWidth() does not work if your page is in an iframe. Has that being tested before closing the bug? Should I open a separate ticket for that?

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.