Bug Tracker

Opened 9 years ago

Closed 9 years ago

#14761 closed bug (notabug)

.click() event does not work correctly in Firefox

Reported by: Redsandro Owned by: Redsandro
Priority: undecided Milestone: None
Component: unfiled Version: 1.11.0
Keywords: Cc:
Blocked by: Blocking:


On a selected virtual anchor element, .click() fires a click event in Chromium. This is correct.

In Firefox however, it does not. You need to manually create a click mouseEvent.

I've created this jsfiddle to explain exactly what I mean:


Change History (5)

comment:1 Changed 9 years ago by Redsandro

(I was meaning to file this under Events but I cannot seem to edit that.)

comment:2 Changed 9 years ago by dmethvin

Owner: set to Redsandro
Status: newpending

It works if you append to the body: http://jsfiddle.net/D572L/2/

Is there a reason to not append the link to the body? In general, detached DOM often has issues.

comment:3 Changed 9 years ago by anonymous

In the fiddle you don't even use jQuery!

In this line


you access the native element via [0] and try to trigger the native click event.

comment:4 Changed 9 years ago by Redsandro

Status: pendingnew

@dmethvin Is there a reason to not append the link to the body?

Just want to offer some client side text as a download. There is no semantic purpose for the anchor in the Document/DOM. This seems like logical thing to do. I don't need to end up with a bunch of irrelevant elements in my DOM like empty soda cans polluting the street.

Either way, thanks for the workaround. I guess it's human nature to leave trash behind. ;) But still, I think that jQuery should be able to handle this in the way I proposed.

@anonymous $(anchor).click(); doesn't work either.

Last edited 9 years ago by Redsandro (previous) (diff)

comment:5 Changed 9 years ago by scottgonzalez

Resolution: notabug
Status: newclosed

Regardless, this isn't a jQuery bug. This is how the browser behaves.

Note: See TracTickets for help on using tickets.