Ticket #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: | ||
| Blocking: | Blocked by: |
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
Change History
comment:1 Changed 5 years ago by rodnaph
Maybe this is a duplicate of #2954, probably a much better fix?
comment:2 Changed 5 years ago by flesler
- Status changed from new to closed
- Resolution set to invalid
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 5 years ago by rodnaph
- Status changed from closed to reopened
- Resolution invalid deleted
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 5 years ago by flesler
- Status changed from reopened to closed
- Resolution set to wontfix
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 :)
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

