Bug Tracker

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#13376 closed bug (cantfix)

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

Reported by: perroazul64@… Owned by: perroazul64@…
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.

Change History (6)

comment:1 Changed 7 years ago by dmethvin

Owner: set to perroazul64@…
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.

comment:2 in reply to:  1 Changed 7 years ago by perroazul64@…

Status: pendingnew

Replying to 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.

comment:3 Changed 7 years ago by perroazul64@…

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.

comment:4 Changed 7 years ago by perroazul64@…

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

comment:5 Changed 7 years ago by dmethvin

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?

comment:6 Changed 7 years ago by perroazul64@…

Note: See TracTickets for help on using tickets.