Last modified: 2013-05-16 00:08:39 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 T50523, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 48523 - Parsoid: Expose order of template parameters call
Parsoid: Expose order of template parameters call
Status: RESOLVED WONTFIX
Product: Parsoid
Classification: Unclassified
General (Other open bugs)
unspecified
All All
: Unprioritized normal
: ---
Assigned To: Gabriel Wicke
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-16 00:02 UTC by Krinkle
Modified: 2013-05-16 00:08 UTC (History)
3 users (show)

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


Attachments

Description Krinkle 2013-05-16 00:02:31 UTC
VisualEditor is currently unable to display the parameters in the template editor in the same order as the wikitext because they are provided as a plain object.

And per the JSON specification (and as proven by inconsistent behaviour in different browsers), objects are "an unordered set of name/value pairs"[1].

And even if JSON would support it, once in javascript, we have the for-in statement and Object.keys() which do not have a reliable cross-browser logic for the order of the keys.

Though Parsoid is able to roundtrip the order (since it has the original wikitext and can put them in the right order), we can't.

I'd recommend the output is updated to output an array of some kind.

So instead of :
 { foo: bar, bar: quux }

It'd be something like this:

 [ { foo: bar }, { bar: quux } ]

or (Trevor's idea):

 { keys: ['foo', 'bar'], values: ['bar', 'quux' ] }


[1] http://json.org/
Comment 1 Gabriel Wicke 2013-05-16 00:08:39 UTC
Only the name of parameters is significant, the order is a syntactic detail. You can do a numeric sort on numeric parameter names for UI purposes, but generally our API only talks about named parameters.

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


Navigation
Links