Skip to main content

Bug Tracker

Side navigation

#13376 closed bug (cantfix)

Opened February 03, 2013 10:25PM UTC

Closed February 24, 2013 10:05PM UTC

Last modified February 24, 2013 11:29PM UTC

Resize event is triggered in the middle of a running function called by setTimeout, when calling elem.height()

Reported by: perroazul64@gmail.com Owned by: perroazul64@gmail.com
Priority: undecided Milestone: None
Component: unfiled Version: 1.9.0
Keywords: Cc:
Blocked by: Blocking:
Description

So, I found this weird behaviour which I suspect might be a Firefox bug, but I can't tell since I don't know what jquery is doing. It's happening in Firefox 18.0.1 on Win7x64.

Here's a replication of the bug: http://jsfiddle.net/PerroAZUL/KtCgh/1/

Basically, a function is called which sets a flag to true at the beggining and sets it back to false at the end. A resize event is hooked which will show a message if the flag is true (which should never happen) and then call the function with a setTimeout.

To replicate the bug you must trigger multiple resize events and check the console to see if the message appears. I just open the console and resize it until the message is shown.

jsfiddle can be a bit laggy when resizing so here's the source of the complete html if you prefer to test it with a local file: http://hastebin.com/besisegoto.htm

The bug seems to only happen when calling height() on the element.

Attachments (0)
Change History (6)

Changed February 12, 2013 03:40AM UTC by dmethvin comment:1

owner: → perroazul64@gmail.com
status: newpending

Getting the height may require changing properties of the document, which could conceivably cause a resize event. Have you reported this to Firefox? Reducing it to a smaller test case without jQuery involved might help.

Changed February 12, 2013 04:10AM UTC by perroazul64@gmail.com comment:2

status: pendingnew

Replying to [comment:1 dmethvin]:

Getting the height may require changing properties of the document, which could conceivably cause a resize event. Have you reported this to Firefox? Reducing it to a smaller test case without jQuery involved might help.

Even if it fired a resize event, should the event handler be called right away? I haven't reported the issue to Firefox but I guess I should. It has something to do with the function being called through setTimeout, so I doubt it's a jQuery problem. I'll see if I can make a test case without using jQuery.

Changed February 12, 2013 05:01AM UTC by perroazul64@gmail.com comment:3

I managed to make a smaller test case without jQuery: http://jsfiddle.net/PerroAZUL/e4NEz/

The resize event handler is called when accessing the offsetWidth property of the element. From further testing I noticed that accessing the property doesn't trigger the event itself; rather, it forces the handler to be called, somehow.

Changed February 12, 2013 08:01PM UTC by perroazul64@gmail.com comment:4

Just for the record, I already reported the issue to Firefox.

Changed February 24, 2013 10:05PM UTC by dmethvin comment:5

resolution: → cantfix
status: newclosed

I'm not sure if synchronous event firing is a bug or not, but if it is then Firefox will need to fix it. Can you post a link to the Mozilla ticket here?

Changed February 24, 2013 11:29PM UTC by perroazul64@gmail.com comment:6