[[MediaWiki:Gadget-FastRevert.js]]

Jump to navigation Jump to search

How does changing ".innerHTML = .innerHTML + ..." to ".innerHTML += ..." fix anything? For all I know, JavaScript treats these two as equivalent (and if it does not, this language is even more fucked up than I thought): the DOM is still being thrashed, and event handlers forgotten (which is why the radio buttons do not disappear and reappear properly after that script fires). You should probably avoid innerHTML entirely, and just use document.createElement/.createTextNode and appendChild. (Though there is also insertAdjacentHTML, but I am not sure how widely it is supported.)

Also, I have read somewhere that addOnloadHook is deprecated, but I am not sure what the replacement should be.

Keφr20:31, 30 October 2013

You're completely right on all points. I've changed the script to use the normal DOM methods instead of modifying innerHTML.

The replacement for addOnloadHook is $(document).ready.

Yair rand (talk)22:33, 30 October 2013

Why not use it, then? We never know what is going to bite us next.

Keφr05:45, 31 October 2013