Last modified: 2014-07-19 12:40:21 UTC
I'm getting "TypeError: re.query is undefined" whenever I put the mouse over the "Expandir" link on https://pt.wikipedia.org/wiki/Golfinho#catlinks
Ideally there should be no error as the extension should not try to generate a popup.
Change 135188 had a related patch set uploaded by Prtksxna: renderer: Ignore links meant for JavaScript https://gerrit.wikimedia.org/r/135188
Change 135188 merged by jenkins-bot: renderer: Ignore `#` links https://gerrit.wikimedia.org/r/135188
Gerrit change #135188 ignores '#', which is often the href of "links" that trigger JavaScript operations such as expand/contract, etc. However, you also see this error in the console when hovering over a section link in a ToC, because it goes to #Section_name and the title for it is empty. So a better, more comprehensive fix should be to a) test if (link.attr( 'href').indexOf( '#' ) === 0 ) and b) never access object.keyA.keyB in a JS structure without testing object.keyA first and c) don't issue the API query for an empty or otherwise invalid title (bug. The title is usually (always?) empty for section links. But I'm confused, shouldn't the test for href is or starts with '#' go in mw.popups.setupTriggers(), which is already testing href?
(In reply to spage in comment #4) #134266 moves the selector to a single function that is reused in `removeTooltips` and `setupTriggers`. `setupTriggers` still does have some logic for the shortlisting links on the basis of it `href`. Moving that logic to `selectPopupElements` should solve the problem. We also have to keep in mind that has as soon as we start with the reference popups we'll have to remove some of these checks and move them into the renderer instead which'll pass it along to either the article or the reference renderer. We can put (a) as the citation links always have the name after the `#`. I didn't understand the relevance of (b) in this context. We are checking for empty title in `selectPopupsElements` so I guess we won't have to worry about (c) then.