Last modified: 2014-10-06 15:13:57 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 T57871, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 55871 - VisualEditor: Clean up constructor params to dm.Node subclasses
VisualEditor: Clean up constructor params to dm.Node subclasses
Status: RESOLVED FIXED
Product: VisualEditor
Classification: Unclassified
Technical Debt (Other open bugs)
unspecified
All All
: Normal enhancement
: VE-deploy-2014-06-12
Assigned To: Ed Sanders
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-18 12:50 UTC by Roan Kattouw
Modified: 2014-10-06 15:13 UTC (History)
4 users (show)

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


Attachments

Description Roan Kattouw 2013-10-18 12:50:41 UTC
* dm.LeafNode has (length, element), where length is ignored and forced to 0 by all subclasses except for dm.TextNode
* dm.BranchNode has (children, element), length is computed while children are added

The code in dm.Document constructing node trees needs to be aware of this, but at the same time it doesn't even use these parameters, because branch nodes are created as childless nodes that have their children added later, and text nodes are created with length zero and have the correct length set later. So we should just get rid of these parameters and make the constructors take a single element parameter, that would get them in line with other dm.Model subclasses (dm.Annotation and dm.MetaItem) as well.

While we're at it, we should also fix the documentation that claims that the element parameter is optional, it really isn't.
Comment 1 Krinkle 2013-10-18 15:00:17 UTC
(In reply to comment #0)
> While we're at it, we should also fix the documentation that claims that the
> element parameter is optional, it really isn't.


It is in fact optional. The lowest class (ve.dm.Model) has:
> element || { 'type': this.constructor.static.name }
Comment 2 Roan Kattouw 2014-10-06 10:14:07 UTC
https://gerrit.wikimedia.org/r/#/c/135878/

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


Navigation
Links