[Webkit-unassigned] [Bug 202139] New: Object spread ({ ... } syntax): object key order is modified

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Sep 24 02:45:32 PDT 2019


https://bugs.webkit.org/show_bug.cgi?id=202139

            Bug ID: 202139
           Summary: Object spread ({ ... } syntax): object key order is
                    modified
           Product: WebKit
           Version: Other
          Hardware: Macintosh
                OS: macOS 10.14
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: dmnsgn at gmail.com

Version: Safari 13

Using Object assign as follow:
Object.assign({ a: 1, b: 100, c: 3 }, { b: 2 })
the output will be: {a: 1, b: 2, c: 3} where the object key order is a,b,c.

However, using Object spread syntax as follow:
{ ...{ a: 1, b: 100, c: 3 }, ...{ b: 2 } }
the output will be: {a: 1, c: 3, b: 2} where the object key order is a,c,b.

This behaviour is different from Chrome where key order is preserved and I guess the underlying question here is:
is this following ECMA specification? I thought the spec was clear since ES2015.

See the following jsfiddle output to compare: https://jsfiddle.net/dmnsgn/r1n8q6o2/

Thanks

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20190924/eb2f2e84/attachment.html>


More information about the webkit-unassigned mailing list