Bug Tracker

Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#10483 closed bug (invalid)

NAN value on 1.6.4 version

Reported by: Hagau Ioan Owned by: Hagau Ioan
Priority: undecided Milestone: None
Component: unfiled Version: 1.6.4
Keywords: Cc:
Blocked by: Blocking:

Description

Hi, I used the "slideToggle" from jquery version "jquery-1.6.4.min.js" on one big DIV element. The "DIV" element has inside more html elements. In internet explorer 8 (maybe on FF too) when I try to load the slideToggle function on this big DIV I received an error. Not sure what was the real cause of error but during my investigation I found a bug into the jquery:

_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"
a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}})

There are situations when "a" variable is "NAN". Because of this I got some errors. So I placed this check routine inside:

if(isNaN(a.now)){return;}

And all my problems gone.

_default:function(a){if(isNaN(a.now)){return;}a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"
a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}})

Change History (4)

comment:1 Changed 8 years ago by dmethvin

Owner: set to Hagau Ioan
Status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket!

There are situations when "a" variable is NaN

We need to know the inputs that would cause this problem, the test case will make this clear.

Be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.

comment:2 Changed 8 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

comment:3 Changed 7 years ago by anonymous

Had the same problem. But this fix seems to work. Don't know what causes "a" to be NaN though. Still fairly new to jQuery.

comment:4 Changed 7 years ago by anonymous

I ran into the same issue, but I do not have jsFiddle in my application. Instead I wrote my own code that targeted to center a div popup box by accessing width, height, outerWidth, and outerHeight from the window object and the div popup box itself.

It is clear that the issue happens in IE8 browser, currently I am testing on version 8.0.6001.19019.

So I went ahead and implemented the fixings accordingly instructions above and it solves the case. My div popup box still is being centered hen I scroll the window down and up.

The very same issue was found in the more recent jQuery versions which means that bug prevents jQuery being cross browser compatible for IE8. Any new release of jQuery requires to be touched in other to preserve backward compatibility, until IE8 has being killed.

Here are the details where I implement that fix. jQuery-1.4.2.min.js (line:144 Column:175) jQuery-1.4.4.min.js (line:156 Column:251) jQuery-1.7.1.js (line:8824 Column:31)

At the moment I am writting whit comment, jQuery-1.8.0 is already available for download. I inspected the code and it looks away different. I did not test yet, but comments about backward compatibility are in place.

Probably issue is fixed in the 1.8.0 version, anyway I hope this comment help people find solution for the bug when using old jQuery versions.

Note: See TracTickets for help on using tickets.