<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>27428</bug_id>
          
          <creation_ts>2014-11-25 10:58:42 +0000</creation_ts>
          <short_desc>[ArrayClass] should serialize as an array by default</short_desc>
          <delta_ts>2017-06-21 21:23:13 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>WebIDL</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Simon Pieters">zcorpan</reporter>
          <assigned_to name="Cameron McCormack">cam</assigned_to>
          <cc>annevk</cc>
    
    <cc>bzbarsky</cc>
    
    <cc>d</cc>
    
    <cc>mike</cc>
    
    <cc>public-script-coord</cc>
    
    <cc>tobie.langel</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>115457</commentid>
    <comment_count>0</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2014-11-25 10:58:42 +0000</bug_when>
    <thetext>http://heycam.github.io/webidl/#ArrayClass

[[
[ArrayClass]
]]

It seems currently the JSON serialization of DOMRectList is a bit ugly:

http://software.hixie.ch/utilities/js/live-dom-viewer/saved/3315

Blink
{&quot;0&quot;:{&quot;height&quot;:16,&quot;width&quot;:1645,&quot;left&quot;:8,&quot;bottom&quot;:24,&quot;right&quot;:1653,&quot;top&quot;:8},&quot;length&quot;:1}

WebKit
{&quot;0&quot;:{},&quot;length&quot;:1}

Gecko
{&quot;0&quot;:{}}

Assuming DOMRectList stays for Web compat, it would be nice to have it serialize as an array. Would it make sense for WebIDL to serialize [ArrayClass] interfaces as an array by default? (Or whatever replaces [ArrayClass].)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>115459</commentid>
    <comment_count>1</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-11-25 11:05:59 +0000</bug_when>
    <thetext>[ArrayClass] just puts Array on the prototype chain. That&apos;s it. If you want Blink&apos;s behavior you&apos;d have to define that in the specification.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>115460</commentid>
    <comment_count>2</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2014-11-25 11:08:22 +0000</bug_when>
    <thetext>I don&apos;t want Blink&apos;s behavior (for this bug, anyway). If we assume that DOMRect should serialize as {} then I want:

[{}]</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>115470</commentid>
    <comment_count>3</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-11-25 14:06:02 +0000</bug_when>
    <thetext>This could be done fairly easily by just having a toJSON method on the object that returns an array with the DOMRects, right?

Assuming we want to do it, that is...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>115471</commentid>
    <comment_count>4</comment_count>
    <who name="Domenic Denicola">d</who>
    <bug_when>2014-11-25 15:58:26 +0000</bug_when>
    <thetext>JSON.stringify is indeed the easy way to fix this.

The alternate fix is to make DOMRectList a proper Array subclass. Browsers don&apos;t support subclassing arrays yet though, except the IE 12 preview.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128659</commentid>
    <comment_count>5</comment_count>
    <who name="Tobie Langel">tobie.langel</who>
    <bug_when>2017-06-21 20:47:13 +0000</bug_when>
    <thetext>Fixed in https://github.com/heycam/webidl/commit/a505f33</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128660</commentid>
    <comment_count>6</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2017-06-21 20:55:53 +0000</bug_when>
    <thetext>It is?  I don&apos;t see any ArrayClass provisions in there... am I just missing them?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128661</commentid>
    <comment_count>7</comment_count>
    <who name="Tobie Langel">tobie.langel</who>
    <bug_when>2017-06-21 21:02:06 +0000</bug_when>
    <thetext>My understanding from the above was that interfaces with the LegacyArrayClass extended attribute could just define their own JSONification strategy, e.g. by defining a toJSON operation which returns a sequence.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128662</commentid>
    <comment_count>8</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2017-06-21 21:21:56 +0000</bug_when>
    <thetext>That&apos;s fine with me, but it sounds more like a wontfix than a fixed.  ;)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128663</commentid>
    <comment_count>9</comment_count>
    <who name="Tobie Langel">tobie.langel</who>
    <bug_when>2017-06-21 21:23:13 +0000</bug_when>
    <thetext>(In reply to Boris Zbarsky from comment #8)
&gt; That&apos;s fine with me, but it sounds more like a wontfix than a fixed.  ;)

That&apos;s a good point.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>