Bug Tracker

Opened 12 years ago

Closed 12 years ago

#3022 closed bug (wontfix)

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)

patch_nan_css.patch (440 bytes) - added by rodnaph 12 years ago.

Download all attachments as: .zip

Change History (5)

Changed 12 years ago by rodnaph

Attachment: patch_nan_css.patch added

comment:1 Changed 12 years ago by rodnaph

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

comment:2 Changed 12 years ago by flesler

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.

comment:3 Changed 12 years ago by rodnaph

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.

comment:4 Changed 12 years ago by flesler

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 :)

Note: See TracTickets for help on using tickets.