[Bug] JS error: "unrecognized expression: unsupported pseudo: wikibase-statementview" on old revisions of items
Closed, ResolvedPublic

Description

On old revisions of Wikibase items, e.g. https://www.wikidata.org/w/index.php?title=Q2748803&oldid=186055537, current Firefox gives a JavaScript "Error: Syntax error, unrecognized expression: unsupported pseudo: wikibase-statementview".

JanZerebecki updated the task description. (Show Details)
JanZerebecki raised the priority of this task from to Needs Triage.
JanZerebecki added a subscriber: JanZerebecki.
Krinkle removed a subscriber: Krinkle.Jan 5 2015, 3:39 PM

This is caused by the AuthorityControl gadget:

$( ':wikibase-statementview' ).each( function () {

jQuery doesn't understand what's that :wikibase-statementview pseudo-element. Looks like an error of the gadget.

This gadget seems to be enabled also for anons, so the error happens for everyone.

JanZerebecki set Security to None.
Lydia_Pintscher triaged this task as High priority.Jan 5 2015, 5:12 PM
Lydia_Pintscher added a project: Wikidata.org.
Lydia_Pintscher moved this task from incoming to ready to go on the Wikidata board.

This is caused by the AuthorityControl gadget:

$( ':wikibase-statementview' ).each( function () {

jQuery doesn't understand what's that :wikibase-statementview pseudo-element. Looks like an error of the gadget.

This gadget seems to be enabled also for anons, so the error happens for everyone.

The code you quoted is not run due to this block:

if ( mw.config.get( 'wgNamespaceNumber' ) !== 0 || !mw.config.exists( 'wbEntityId' ) ) {
	// Only item pages feature appropriate statements.
	return;
}

and to 'wbEntityId' not existing on diff pages.

Ricordisamoa renamed this task from JS error: unrecognized expression: unsupported pseudo: wikibase-statementview to JS error: "unrecognized expression: unsupported pseudo: wikibase-statementview" on old revisions of items.Jan 10 2015, 10:52 AM
Ricordisamoa updated the task description. (Show Details)

The jquery.wikibase.entityview module is supposed to register pseudos, but it isn't loaded on old revisions.

hoo added a subscriber: hoo.Jan 10 2015, 11:56 AM

The jquery.wikibase.entityview module is supposed to register pseudos, but it isn't loaded on old revisions.

Wikibase entityview JavaScript is not executed on old revision/ diffs as it's only needed for editing. We did that mainly for performance reasons and to be able to keep things simpler.

Adding jquery.wikibase.entityview as a dependency to https://www.wikidata.org/wiki/MediaWiki:Gadgets-definition should do it, right?

aude added a comment.Jan 13 2015, 8:18 AM

adding jquery.wikibase.entityview seems to work (at least no longer get the js error, though nothing linked).

ps: some addition changes will be needed (no longer to use statementview.getReferences() and get references directly from the statement instead) when we deploy new code on wikidata sometime in the next weeks. but think the changes can be applied now.

https://test.wikidata.org/w/index.php?title=MediaWiki%3AGadget-AuthorityControl.js&diff=9622&oldid=9619

aude added a comment.Jan 13 2015, 1:03 PM

updated the gadget code more on test.wikidata

https://test.wikidata.org/wiki/MediaWiki:Gadget-AuthorityControl.js

the hardcoded "if ( claimId === 'P368' ) {" needs to be changed accordingly for wikidata (and would be nice if it wasn't hardcoded quite like that)

He7d3r added a subscriber: He7d3r.Sep 24 2015, 8:09 PM

This is still happening. I got the message the first I accessed
https://www.wikidata.org/wiki/Q8366
today.

JanZerebecki reopened this task as Open.Sep 25 2015, 10:39 AM

Can't reproduce, we probably have different gadgets enabled.
Can you disable them all and see if the error vanishes?
Does the error also happen on https://www.wikidata.org/wiki/Q8366?debug=1 ?
Do you have a way to locate where the error happens, like a backtrace? Do you have any other information that might help?

JanZerebecki moved this task from ready to go to incoming on the Wikidata board.Sep 25 2015, 10:40 AM

The error is intermittent. I only notice it because I'm subscribed to the error events (by means of mw.trackSubscribe( 'global.error', function ( topic, err ) {...}). This way, I can notice when these random JS errors happen, even if my console is not open.

hoo added a comment.Sep 28 2015, 8:08 AM

Still used (or at least mentioned) in some gadgets:

hoo@terbium:~$ mwgrep wikibase-statementview
## Public wiki results
testwikidatawiki    MediaWiki:Gadget-AuthorityControl.js
wikidatawiki        MediaWiki:Gadget-AuthorityControl.js
wikidatawiki        MediaWiki:Gadget-DraggableSitelinks.js
wikidatawiki        MediaWiki:Gadget-DuplicateReferences.js
wikidatawiki        MediaWiki:Gadget-PrimarySources.js

(total: 5, shown: 5)
In T85804#1680042, @hoo wrote:

wikidatawiki MediaWiki:Gadget-AuthorityControl.js

Has the necessary dependency.

wikidatawiki MediaWiki:Gadget-DraggableSitelinks.js
wikidatawiki MediaWiki:Gadget-DuplicateReferences.js
wikidatawiki MediaWiki:Gadget-PrimarySources.js

All 3 are a different use, no :wikibase-statementview (no : where its used).

So those don't explain it.

I just got the error

{
	"errorMessage": "Error: Syntax error, unrecognized expression: unsupported pseudo: wikibase-statementview",
	"url": "https://www.wikidata.org/w/load.php?debug=false&lang=pt&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=VI%2BaIjZR",
	"lineNumber": 20,
	"columnNumber": 177,
	"errorObject": {}
}

when I opened
https://www.wikidata.org/wiki/Q382486

Each widget gets a pseudo registered under its name. The previous fixes were wrong.

https://github.com/Wikidata-lib/PropertySuggester/pull/150

The dependency of MediaWiki:Gadget-AuthorityControl.js needs to be jquery.wikibase.statementview (instead of jquery.wikibase.entityview).

The dependency of MediaWiki:Gadget-AuthorityControl.js needs to be jquery.wikibase.statementview (instead of jquery.wikibase.entityview).

https://www.wikidata.org/wiki/?diff=255326749

hoo closed this task as Resolved.Oct 8 2015, 9:04 AM

I think we got everything covered. Please reopen if there's more.

hoo moved this task from Review to Done on the Wikidata-Sprint-2015-09-29 board.Oct 8 2015, 9:04 AM
JanZerebecki reopened this task as Open.Oct 8 2015, 1:50 PM

It still needs a PropertySuggester tag which needs to be included in the build.

Tobi_WMDE_SW removed JanZerebecki as the assignee of this task.Oct 13 2015, 1:27 PM
Lydia_Pintscher renamed this task from JS error: "unrecognized expression: unsupported pseudo: wikibase-statementview" on old revisions of items to [Bug] JS error: "unrecognized expression: unsupported pseudo: wikibase-statementview" on old revisions of items.Oct 14 2015, 12:28 PM
hoo closed this task as Resolved.Oct 14 2015, 9:08 PM
hoo claimed this task.

Just tagged PropertySuggester 2.4.4.

hoo moved this task from Backlog to Done on the Wikidata-Sprint-2015-10-13 board.Oct 14 2015, 9:08 PM