Last modified: 2012-09-27 01:10:40 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T41504, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 39504 - JavaScript error thrown because of wrong css selectors in skins.vector javascript module
JavaScript error thrown because of wrong css selectors in skins.vector javasc...
Status: RESOLVED INVALID
Product: MediaWiki
Classification: Unclassified
Interface (Other open bugs)
unspecified
All All
: Unprioritized minor (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-20 16:12 UTC by Christian Thiele
Modified: 2012-09-27 01:10 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Christian Thiele 2012-08-20 16:12:45 UTC
See the javascript module "skins.vector"

http://bits.wikimedia.org/en.wikipedia.org/load.php?debug=true&lang=de&modules=skins.vector&only=scripts&skin=vector&*

On line 7 the following thing is done:
  $( 'h5:first a:first', this )

This could not work - "first" is no valid css pseudo-class, leading to an javascript error in the jQuery library. Maybe "first-child" is meant, but I do not really now, what the purpose of this script is, so I don't really know how to fix it.

At least it's annoying to have JavaScript errors thrown ;).
Comment 1 Michael M. 2012-08-21 08:54:19 UTC
This should work - http://api.jquery.com/first-selector/ - and it does work for me in FF 13: No JavaScript error and when I click the dropdown for move etc. it stays open as expected.
Comment 2 Christian Thiele 2012-08-21 11:06:51 UTC
As written on this page: "Because :first is a jQuery extension and not part of the CSS specification, queries using :first cannot take advantage of the performance boost provided by the native DOM querySelectorAll() method.". But the "h5:first a:first" is passed to querySelectorAll().

I now had a closer look at this and firefox doesn't throw an error because of a catch statement, but at least it seems weird to me to call a function which unavoidable throws an error and then catch it...

The call tree is:
  line 7 of skins.vector (see original bug report)
  line 27 of mediawiki jquery (jquery constructor)
  line 192 of mediawiki jquery (init function)
  line 5431 of mediawiki jquery (find function)
  line 5163 of mediawiki jquery

on line 5163 context.querySelectorAll( "[id='" + nid + "'] " + query ) is called and query is "h5:first a:first". This throws an SYNTAX_ERR which is cached at line 5166.

I'm okay with closing this bug because I didn't see the catch statement. But if there is an easy fix not calling querySelectorAll() with these parameters it would be cool, too ;).
Comment 3 Krinkle 2012-08-24 14:38:49 UTC
If you used the Chrome Developer Tools to find this error, make sure you set the exception listener to the second state (purple: pause on uncaught exceptions) as opposed to the first state (blue: pause on all exceptions).

Either way, this is not a MediaWiki bug. If anything, it is an enhancement request for jquery internally. If you feel like pursuing it further, feel free to bug it up at bugs.jquery.com.

Closing as invalid.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links