Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-47735 ECMAScript 7 Support
  3. QTBUG-62512

Object keys order is not always preserved as it should be

    XMLWordPrintable

    Details

    • Type: Technical task
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Fix Version/s: 5.12.0 Beta 1
    • Labels:
      None
    • Environment:

      Description

      Ok:

      var y = { a : 10, e: 20 }
      y.z = 100;
      y.d = 200;
      console.log(Object.keys(y).join(','))
      // prints: a,e,z,d
      

      Not ok:

      var x = { a : 10, foo: 20, c: 30 }
      console.log(Object.keys(x).join(','))
      // prints: a,c,foo
      // should print: a,foo,c
      

      All current browsers have that behaviour correct, afaik.

      The traversal order is defined in ECMAScript specification, and it should be followed to ensure compatibility between JS engine implementations.

      Spec refs:

      MDN refs:

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            laknoll Lars Knoll
            Reporter:
            chalker Сковорода Никита
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes