https://bugzilla.wikimedia.org/show_bug.cgi?id=48523
Web browser: ---
Bug ID: 48523
Summary: Parsoid: Expose order of template parameters call
Product: Parsoid
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: Unprioritized
Component: General
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected]
Classification: Unclassified
Mobile Platform: ---
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/
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l