Page MenuHomePhabricator

JS function getElementsByClassName() should not be deprecated and overriden
Closed, InvalidPublic


In wikibits.js, the function getElementsByClassName() is marked as deprecated.
But it shouldn't be, because nowadays it is a native browser function. (MDN reference)

And most importantly, the function is overriden and always return an empty array.

mw.log.deprecate( win, 'getElementsByClassName', function () { return []; }, msg );

Because of this, many edits I recently made are broken!

Event Timeline

Od1n created this task.Feb 4 2017, 7:27 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 4 2017, 7:27 AM
Od1n triaged this task as Unbreak Now! priority.Feb 4 2017, 7:27 AM
Restricted Application added subscribers: Jay8g, TerraCodes. · View Herald TranscriptFeb 4 2017, 7:27 AM
Od1n updated the task description. (Show Details)Feb 4 2017, 7:28 AM
Legoktm added a subscriber: Legoktm.Feb 4 2017, 7:32 AM

I'm a bit confused. wikibits.js is deprecating window.getElementsByClassName(), while your MDN link is about document.getElementsByClassName(). Aren't those different?

Od1n added a comment.Feb 4 2017, 7:38 AM

Mmmm, that's a very good point. I didn't notice it.


Od1n closed this task as Invalid.Feb 4 2017, 7:39 AM
Od1n added a comment.EditedFeb 4 2017, 7:45 AM

I'm pretty sure previously I got similarly mistaken.

Maybe a little comment in the wikibits.js file would be worth it.