Page MenuHomePhabricator

CodeMirror load breaks at $button.toggleClass(...)
Closed, ResolvedPublic


CodeMirror breaks JavaScript on load in ext.CodeMirror.js: line 187:3 with:

load.php?debug=false&lang=en&modules=jquery%2Cmediawiki|mediawiki.legacy.wikibits&only=scripts&skin=vector&version=1faydix:52 Uncaught TypeError: $button.toggleClass(...).data(...) is not a function
    at updateToolbarButton (load.php?debug=false&lang=en&modules=ext.CodeMirror||ext.CodeMirror.mode.mediawiki|ext.centralauth.centralautologin.clearcookie|ext.echo.api%2Cinit|ext.math.editbutton.enabler|ext.wikimediaEvents.loggedin|jquery.tipsy|mediawiki.action.edit.preview|mediawiki.api.messages|mediawiki.diff.styles||oojs-ui-core%2Csite&skin=vector&version=089p435:4)
    at HTMLDocument.<anonymous> (load.php?debug=false&lang=en&modules=ext.CodeMirror||ext.CodeMirror.mode.mediawiki|ext.centralauth.centralautologin.clearcookie|ext.echo.api%2Cinit|ext.math.editbutton.enabler|ext.wikimediaEvents.loggedin|jquery.tipsy|mediawiki.action.edit.preview|mediawiki.api.messages|mediawiki.diff.styles||oojs-ui-core%2Csite&skin=vector&version=089p435:6)
    at mightThrow (load.php?debug=false&lang=en&modules=jquery%2Cmediawiki|mediawiki.legacy.wikibits&only=scripts&skin=vector&version=1faydix:49)
    at process (load.php?debug=false&lang=en&modules=jquery%2Cmediawiki|mediawiki.legacy.wikibits&only=scripts&skin=vector&version=1faydix:50)

(tested in Firefox and Chrome on Commons)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

I'm not able to reproduce. Try editing a page in safemode by adding safemode=1 in the URL, for instance (random file):

Do you still see the error? If not the issue may be with an unrelated script.

@MusikAnimal: Yes I still see the error. In addition I have to say that it only occurs when the classic toolbar (which will be removed soon from core) is used or the Wikieditor is disabled.

Got it. I can now reproduce as well. Not sure what the issue is, but indeed only 2003 and 2006 editors are affected.

I have got this error message when I click edit.
Error: at line 6: TypeError: $button.toggleClass(...).data(...) is not a function

Ah, I found this too.

This is
.data( 'setActive' ) returns undefined if you have the old style wiki toolbar instead of WikiEditor 2010 (enhanced toolbar) enabled.

See also change in:

TheDJ triaged this task as Low priority.Jun 17 2018, 8:37 PM


There is a problem on frwiki that seems similar to the problem described here.

When the old toolbar is used on preferences, the extra buttons added by gadgets to the old style toolbar are not functional (they produce no effect).

This problem only occurs when CoreMirror is enabled. Whenever CodeMirror is enabled (or disabled) in the editor, this error message appears on the JS console:

TypeError: $button.toggleClass(...).data(...) is not a function load.php:6:700

This problem has been reported on the frwiki village pump :

(sorry for my bad english)

Change 440761 had a related patch set uploaded (by MusikAnimal; owner: TheDJ):
[mediawiki/extensions/CodeMirror@master] Accessibility: mark syntaxhighlight button as a switch

Change 440761 merged by jenkins-bot:
[mediawiki/extensions/CodeMirror@master] Accessibility: mark syntaxhighlight button as a switch

matmarex assigned this task to TheDJ.
matmarex removed a project: Patch-For-Review.
matmarex added a subscriber: matmarex.
Vvjjkkii renamed this task from CodeMirror load breaks at $button.toggleClass(...) to nkbaaaaaaa.Jul 1 2018, 1:05 AM
Vvjjkkii reopened this task as Open.
Vvjjkkii removed TheDJ as the assignee of this task.
Vvjjkkii raised the priority of this task from Low to High.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed subscribers: gerritbot, Aklapper.
CommunityTechBot renamed this task from nkbaaaaaaa to CodeMirror load breaks at $button.toggleClass(...) .Jul 2 2018, 4:40 AM
CommunityTechBot closed this task as Resolved.
CommunityTechBot assigned this task to TheDJ.
CommunityTechBot lowered the priority of this task from High to Low.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot added subscribers: gerritbot, Aklapper.