Page MenuHomePhabricator

inArray's use of strict equals in es.ContentView.js may be inappropriate (FIX attached)
Closed, InvalidPublic

Description

Author: acocaracha

Description:
I've noticed a problem with es.ContentView.js when implementing tex equation support. When you click text outside an annotation and then click back into the annotation, the new content is determined to have a different type than the surrounding text. I believe this is because inArray uses strict equals and really the only thing it should be comparing is the type key and I don't think that necessarily needs to be strict (although I guess it could be).

Here is a copy of the old code: https://jalto.net/equationdb/VisualEditor_save/demo/

And the new code: https://jalto.net/equationdb/VisualEditor_old/demo/

Steps to reproduce in old code:

  1. Create an inline equation
  2. Click a different section of the text
  3. Click in the middle of the inline equation
  4. Type something

The new code is working fine. The commits are:

https://github.com/jalto/VisualEditor/commit/5e544447e5d54b260f5c0333f4dc9da5f15124d7

and

https://github.com/jalto/VisualEditor/commit/0f5a139d24870f200070a95cd70539b04dc0ce33

Thanks,

John


Version: unspecified
Severity: normal

Details

Reference
bz33596

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 12:02 AM
bzimport added a project: VisualEditor.
bzimport set Reference to bz33596.
bzimport added a subscriber: Unknown Object (MLST).

acocaracha wrote:

Rereading this I should have mentioned I'm new to javascript and in general a bit rusty in programming. Here is a new commit to fix some of the mistakes I made in the previous ones. I've done more testing and I think this actually is working now.

https://github.com/jalto/VisualEditor/commit/f9b3cd519420df518c4d0189c32c36ae77a908c6

Again you can see the working copy at https://jalto.net/equationdb/VisualEditor_old/demo/ . The reason for the old is that I plan to made future changes and I wanted to keep a static copy.

Fixed with new version of VE (code replaced).

Mass-moving old VisualEditor tickets to the VE product. Search for this message to mass-delete bugmail.