Bug Tracker

Opened 9 years ago

Closed 8 years ago

Last modified 7 years ago

#7557 closed bug (fixed)


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


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 (14)

comment:1 Changed 9 years ago by jitter

Owner: set to songofchrist@…
Status: newpending

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

test case

comment:2 in reply to:  1 Changed 9 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 9 years ago by jitter

Owner: songofchrist@… deleted
Status: pendingnew

comment:4 Changed 9 years ago by snover

Component: unfiledcss
Keywords: regression added
Priority: undecidedblocker
Status: newopen

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 8 years ago by snover

Resolution: worksforme
Status: openclosed

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

comment:6 Changed 8 years ago by jitter

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

comment:7 Changed 8 years ago by scottgonzalez

Milestone: 1.5
Resolution: worksforme
Status: closedreopened

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

comment:8 Changed 8 years ago by scottgonzalez

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

comment:9 Changed 8 years ago by timmywil

Keywords: regression removed
Milestone: 1.6.2
Owner: set to timmywil
Status: reopenedassigned

comment:10 Changed 8 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 8 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 8 years ago by timmywil

Resolution: fixed
Status: assignedclosed

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

Changeset: edb2286544270dc53550180e06668e61c231fb5d

comment:14 Changed 7 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?

Note: See TracTickets for help on using tickets.