The XTools ArticleInfo gadget/script doesn't run mw.hook('wikipage.content').fire(...) after modifying the DOM. This prevents some scripts from being able to act on changes made by ArticleInfo. In particular, this happens the first time ArticleInfo queries a username (which is slower than subsequent queries). While it's possible for scripts to detect the changes with a MutationObserver, it seems like the intent of the hook is to keep things simple for script developers.
Steps to replicate the issue (include links if applicable):
- On English Wikipedia, load a user page in safemode (e.g., https://en.wikipedia.org/wiki/User:Jimbo_Wales?safemode=1).
- Open the Developer Tools JavaScript console.
- Paste this and hit enter to run both statements together: mw.loader.load('https://www.mediawiki.org/w/index.php?title=XTools/ArticleInfo.js&action=raw&ctype=text/javascript'); importScript('User:Novem Linguae/Scripts/UserHighlighterSimple.js');
What happens?:
- If XTools hasn't been run on a page/user recently, it's generally slower, so UserHighlighterSimple.js will fail to see the added elements, and the username part of "created by: Jimbo Wales" won't be highlighted in pink. If you reload the page and rerun the scripts, it will usually be pink on subsequent runs.
- (If it doesn't reproduce, try a page/user less likely to have been queried recently in XTools.)
What should have happened instead?:
ArticleInfo should properly notify other gadgets/scripts that it has changed the wiki page contents. For the above example, the UserhighlighterSimple script would highlight the username as pink the first time.
Other information (browser name/version, screenshots, etc.):
I'm using a Chromium-based browser.
While this is noted as a "TODO" at the bottom of https://en.wikipedia.org/wiki/User:Novem_Linguae/Scripts/UserHighlighterSimple.js, it seems like the fix should be done in ArticleInfo.