Firefox does not support click().
Running document.getElementById('first').click()
returns the following error click is not a function
So I added a snippet of code to add click() functionality to every element. This code was found after a painful series of google searches resulting in this thread.
The snippet is below and needs to be included just once on the page:
HTMLElement.prototype.click = function() {
var evt = this.ownerDocument.createEvent('MouseEvents');
evt.initMouseEvent('click', true, true, this.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
this.dispatchEvent(evt);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…