Visual diffing a change to a syntaxHighlight node causes JS error
Closed, ResolvedPublic1 Story Points

Description

  1. Go to https://en.wikipedia.beta.wmflabs.org/wiki/User:Jdforrester_(WMF)/sandbox?veaction=edit
  2. Edit the code block that begins with var question
  3. Try to view visual diff, get JS error

This happens because ve.ui.DiffElement#compareNodeAttributes calls .static.describeChanges( attributeChanges, attributeChange.newAttributes ); on the node class of the relevant node. Note that 2 parameters are passed. However, ve.dm.MWExtensionNode.static.describeChanges takes three parameters. The third parameter (element) ends up being undefined, and so calling ve.dm.nodeFactory.createFromElement( element ) results in an error.

For extra confusion, note that ve.dm.Model.static.describeChanges is defined to take only one parameter, despite being called with two and all subclasses' implementations taking either two, zero or three parameters.

Catrope created this task.Mar 17 2017, 4:40 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 17 2017, 4:40 AM

I've also found that this happens for hieroglyph nodes too, but not for math and score nodes, even though they're also subclasses of ve.dm.MWExtensionNode. For some reason, any changes to math and score nodes are rendered in the diff as deleting the old node and inserting the new node, whereas changed to syntaxHighlight and hiero nodes are correctly detected as attribute changes.

Change 343321 had a related patch set uploaded (by Catrope; owner: Jforrester):
[mediawiki/extensions/VisualEditor] Update VE core submodule to master (a63435906)

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

Change 343321 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor] Update VE core submodule to master (a63435906)

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

Jdforrester-WMF closed this task as Resolved.Mar 17 2017, 11:41 PM
Jdforrester-WMF assigned this task to Esanders.
Jdforrester-WMF triaged this task as High priority.
Jdforrester-WMF set the point value for this task to 1.
Restricted Application added a project: User-Ryasmeen. · View Herald TranscriptMar 17 2017, 11:41 PM