Skip to main content

Bug Tracker

Side navigation

#3022 closed bug (wontfix)

Opened June 11, 2008 10:53AM UTC

Closed June 12, 2008 11:09PM UTC

Setting CSS to NaN throws IE error

Reported by: rodnaph Owned by:
Priority: minor Milestone: 1.3
Component: core Version: 1.2.6
Keywords: Cc:
Blocked by: Blocking:
Description

If you try to set a css property to NaN it throws an 'Invalid argument' exception in IE. Should jQuery test for this for robustness?

Example:

$( 'body' ).css({ height: 'a'*1 });

Suggested patch attached.

Attachments (1)
Change History (4)

Changed June 11, 2008 10:59AM UTC by rodnaph comment:1

Maybe this is a duplicate of #2954, probably a much better fix?

Changed June 11, 2008 10:22PM UTC by flesler comment:2

resolution: → invalid
status: newclosed

Why would you set NaN as a css value ?

The other ticket isn't related to this.

NaN is just an invalid value, so I don't see any need to check this.

Please reopen if you have anything else to add.

Changed June 12, 2008 08:11AM UTC by rodnaph comment:3

resolution: invalid
status: closedreopened

I know that normally you'd never set NaN as a value, but the reason I thought it could have been a problem is because it creates different behaviour across browsers. Firefox happily ignores the value when it's set, but IE throws an error dialog. I understand if it's not something that you think needs attention though.

Changed June 12, 2008 11:09PM UTC by flesler comment:4

resolution: → wontfix
status: reopenedclosed

I think jQuery needs to provide normalize methods to do needed tasks.

The fact that they behave differently doesn't mean that needs to be normalized.

Just make sure NaN's don't slip in by accident :)