Relying on object property order for a styling API. Good or bad? eg. styles({ backgroundBlue: true, backgroundRed: true, }); In this case the background would be `red` as it appears last. Relying on property order feels gross but can't think of a better API?
-
-
Is this a strong "this will never get removed" thing? I can imagine some peeps being like "we don't need this" creating a war between js factions
-
If a JS engine implements behaviour that's different than the spec, then it's not JavaScript.
End of conversation
New conversation -
-
-
ES5 spec says specifically that order is not guaranteed.
- 1 more reply
New conversation -
-
-
Semi-standard - nothing false about a de facto partial standard.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
This Tweet is unavailable.
-
-
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
This Tweet is unavailable.
-
“Before that it was pseudo-standard”. Browsers have done it for a loooong time.
- 3 more replies
-
-
-
But if the misconception is so common that means relying on it is against the principle of least astonishment. People will reorder properties and expect things to still work. There are literally lint rules that enforce alphabetic property order
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
he/him 