-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
preserve order of text containing list items #364
Comments
This may related to fact that objects in Javascript do not preserve the order. obj = {
a:4545,
b:"test",
c:4.5
}; With the iteration over the variables of the object
and you create the output abover with the following code for (var variable in obj) {
if (obj.hasOwnProperty(variable)) {
console.log(obj.variable)
}
} But order of variable/keys of the object is not deterministic in all browsers. You could also get in another browser C the following result:
This problem could lead to additional workload to preserve the variable order of an object. E.g. with an array of variable names/keys: obj = {
a:4545,
b:"test",
c:4.5
};
myorder = ["a","b","c"]
for (var i = 0; i < myorder.length; i++) {
console.log( obj[myorder[i]] )
} The array preserves the order of variables/keys of the object browser independently. |
Hey Niebert. Object-key order should be predictable in modern browsers, but still this is good to keep in mind. |
Using a customized wtf-debug instance and looking at the console.log() of wtf list objects of this example, could we not just add an increasing order number (which resets for each section, or even better perhaps: some global numbering scheme like eg. This way we would get the natural order of things, and would be able to render them in that order if so desired. For some elements a different presentation order may be desirable and that could still work, if the user ignores/removes that element (or those types of elements) from the ordered list and places it somewhere else. If this could work, it would solve a lot of inline-content issues. Eg. to show the "quote" at the right position in the section or the list. A first step to tackle this could be by just adding this "3-level" ordering data to all objects and later reviewing it in the debugger by parsing the objects in order. |
example
Sometimes the parsed list is moved to the beginning of a section.
The text was updated successfully, but these errors were encountered: