Put xmlns attribute first
I know that JavaScript object attributes officially don’t have an order, but I prefer to keep the xmlns attribute at the start of the style element, and this code works for me (in Chrome).
See https://github.com/citation-style-language/styles/commit/33ab94fe27856d8f14a8bcd0bbd02ca5a1ea389c#diff-6a52dc4de6b126dc7e28e0902fe7f752 for an example of where we reorder this attribute with my Python script.
I got it to work by deep-cloning the object (http://stackoverflow.com/a/4591639/1712389), deleting all attributes except xmlns (http://stackoverflow.com/questions/19316857/removing-all-properties-from-a-object), and then repopulating the object with the deleted attributes.
To test, load a repository style in the Visual Editor from disk, change the value of "default-locale" under Global Formatting Options, and switch to the Code Editor. With this PR, "xmlns" no longer gets appended to the end of the attribute list on <style/>.
And if this can be simplified, I'm all ears. (for comparison, I put the "rel" attribute on <link/> elements last via a similar approach in the Python script at https://github.com/citation-style-language/utilities/blob/d6bc1f23f560c1d92d8b5772dece7aba37c6bb55/csl-reindenting-and-info-reordering.py#L122)
I've seen this, and while I haven't tested it I'm convinced it will work, but am worried about performance. How often does this run? Only on save and switching to the code editor?
The inner workings of the editor are a bit of a mystery to me, but I doubt performance is a concern here. The new code itself is rather light-weight, and I'm pretty sure it doesn't run often. processNodeProperties is only called within Schema.js in a schema initialization routine (https://github.com/citation-style-language/csl-editor/search?utf8=%E2%9C%93&q=processNodeProperties&type=).