[Bug 12404] New: Structured Clone and Arrays (implementation notes and clarifications sought)

http://www.w3.org/Bugs/Public/show_bug.cgi?id=12404

           Summary: Structured Clone and Arrays (implementation notes and
                    clarifications sought)
           Product: HTML WG
           Version: unspecified
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HTML5 spec (editor: Ian Hickson)
        AssignedTo: ian@hixie.ch
        ReportedBy: travil@microsoft.com
         QAContact: public-html-bugzilla@w3.org
                CC: mike@w3.org, public-html-wg-issue-tracking@w3.org,
                    public-html@w3.org


In some recent testing of structured cloning across various browsers using
Arrays, we found some de-facto conformity that diverges from a literal
interpretation of the spec text of step 5 of the _internal structured cloning
algorithm_ (section 2.8.5). We're proposing some clarifying text be added to
the spec.

-----

a = ["zero","one"];
a.foo = "bar";

Clarifiction 1: 
Per step 5 of the algorithm, an implementation should clone "each enumerable
property". In the example, a has 3 enumerable properties, but in all browsers
tested only the properties "0" and "1" (and their values) were cloned.

We propose that this section have a special section for Array objects and note
that only the index properties of the array be cloned.

Clarification 2:

a.length = 4;

Now the Array a has a length of 4, but only two entries (a sparce-array). In
all browsers tested (with the exception of Safari 5), only the first two
entries in the array were cloned. The length of the resultant clone was
truncated to the last non-null/undefined value in the array (2).

We propose that sparce-arrays likewise be "clipped" to the last
non-null/undefined value, or that the behavior for sparce-arrays be otherwise
more clearly described in the algorithm.

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Thursday, 31 March 2011 06:51:42 UTC