Skip to main content

Bug Tracker

Side navigation

#7557 closed bug (fixed)

Opened November 19, 2010 12:57AM UTC

Closed May 26, 2011 12:00AM UTC

Last modified March 08, 2012 10:36PM UTC

outerWidth()

Reported by: songofchrist@hotmail.com Owned by: timmywil
Priority: blocker Milestone: 1.6.2
Component: css Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:
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.

Attachments (0)
Change History (14)

Changed November 19, 2010 10:15AM UTC by jitter comment:1

owner: → songofchrist@hotmail.com
status: newpending

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

test case

Changed November 19, 2010 04:16PM UTC by anonymous comment:2

Replying to [comment:1 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.

Changed November 22, 2010 02:22AM UTC by jitter comment:3

owner: songofchrist@hotmail.com
status: pendingnew

Changed November 22, 2010 07:12AM UTC by snover comment:4

component: unfiledcss
keywords: → regression
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.

Changed January 01, 2011 03:05AM UTC by snover comment:5

resolution: → worksforme
status: openclosed

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

Changed January 08, 2011 05:01AM UTC by jitter comment:6

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

Changed May 13, 2011 12:36PM UTC by scottgonzalez comment:7

milestone: 1.5
resolution: worksforme
status: closedreopened

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

Changed May 13, 2011 12:37PM UTC by scottgonzalez comment:8

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

Changed May 13, 2011 02:04PM UTC by timmywil comment:9

keywords: regression
milestone: → 1.6.2
owner: → timmywil
status: reopenedassigned

Changed May 21, 2011 01:39PM UTC by mikesherov comment:10

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/

Changed May 21, 2011 02:15PM UTC by mikesherov comment:11

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.

Changed May 25, 2011 09:49PM UTC by mikesherov comment:12

Changed May 26, 2011 12:00AM UTC by timmywil comment:13

resolution: → fixed
status: assignedclosed

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

Changeset: edb2286544270dc53550180e06668e61c231fb5d

Changed February 08, 2012 09:25PM UTC by rp@skedge.me comment:14

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?