Page MenuHomePhabricator

MobileFrontend uses unsupported jQuery Sizzle selector
Closed, ResolvedPublic

Description

When trying to upgrade MediaWiki from jQuery 1.11.3 to jQuery 1.12.0 (supposed to be a minor release) one unit test fails in MobileFrontend.

Observed at https://gerrit.wikimedia.org/r/266093 and https://integration.wikimedia.org/ci/job/mediawiki-extensions-qunit/27568.

Chromium 47.0.2526 (Ubuntu 0.0.0) MobileFrontend toggle.js: Mobile mode. Clicking hash links FAILED

Error: Syntax error, unrecognized expression: [href=#First_Section]
 at Sizzle.tokenize
 at jQuery.fn.extend.find

See also http://blog.jquery.com/2016/01/08/jquery-2-2-and-1-12-released/. This previously worked by accident due to jQuery's selector parser being more tolerant than the standard/native implementation. The older version often needlessly used the fallback. The new one does not.

document.querySelectorAll('[href=#Foo]')
// Uncaught DOMException: Failed to execute 'querySelectorAll' on 'Document': '[href=#Foo]' is not a valid selector.(…)

Event Timeline

Krinkle raised the priority of this task from to Needs Triage.
Krinkle updated the task description. (Show Details)
Krinkle subscribed.
Jdforrester-WMF set Security to None.

Change 266667 had a related patch set uploaded (by Florianschmidtwelzow):
Use correct selector syntax in QUnit test

https://gerrit.wikimedia.org/r/266667

Change 266667 merged by jenkins-bot:
Use correct selector syntax in QUnit test

https://gerrit.wikimedia.org/r/266667