[Bug 27428] [ArrayClass] should serialize as an array by default

# bugzilla at jessica.w3.org (3 years ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=27428

Anne annevk@annevk.nl changed:

       What    |Removed                     |Added

             CC|                            |annevk@annevk.nl

--- Comment #1 from Anne annevk@annevk.nl --- [ArrayClass] just puts Array on the prototype chain. That's it. If you want Blink's behavior you'd have to define that in the specification.

Contact us to advertise here
# bugzilla at jessica.w3.org (3 years ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=27428

--- Comment #2 from Simon Pieters simonp@opera.com ---

I don't want Blink's behavior (for this bug, anyway). If we assume that DOMRect should serialize as {} then I want:

[{}]

# bugzilla at jessica.w3.org (3 years ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=27428

Boris Zbarsky bzbarsky@mit.edu changed:

       What    |Removed                     |Added

             CC|                            |bzbarsky@mit.edu

--- Comment #3 from Boris Zbarsky bzbarsky@mit.edu ---

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...

# bugzilla at jessica.w3.org (3 years ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=27428

Domenic Denicola d@domenic.me changed:

       What    |Removed                     |Added

             CC|                            |d@domenic.me

--- Comment #4 from Domenic Denicola d@domenic.me ---

JSON.stringify is indeed the easy way to fix this.

The alternate fix is to make DOMRectList a proper Array subclass. Browsers don't support subclassing arrays yet though, except the IE 12 preview.

# bugzilla at jessica.w3.org (a day ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=27428

Tobie Langel tobie.langel@gmail.com changed:

       What    |Removed                     |Added

         Status|NEW                         |RESOLVED
     Resolution|---                         |FIXED
             CC|                            |tobie.langel@gmail.com

--- Comment #5 from Tobie Langel tobie.langel@gmail.com ---

Fixed in heycam/webidl/commit/a505f33

# bugzilla at jessica.w3.org (a day ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=27428

Boris Zbarsky bzbarsky@mit.edu changed:

       What    |Removed                     |Added

          Flags|                            |needinfo?(tobie.langel@gmai
               |                            |l.com)

--- Comment #6 from Boris Zbarsky bzbarsky@mit.edu ---

It is? I don't see any ArrayClass provisions in there... am I just missing them?

# bugzilla at jessica.w3.org (a day ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=27428

Tobie Langel tobie.langel@gmail.com changed:

       What    |Removed                     |Added

          Flags|needinfo?(tobie.langel@gmai |
               |l.com)                      |

--- Comment #7 from Tobie Langel tobie.langel@gmail.com ---

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.

# bugzilla at jessica.w3.org (a day ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=27428

--- Comment #8 from Boris Zbarsky bzbarsky@mit.edu ---

That's fine with me, but it sounds more like a wontfix than a fixed. ;)

# bugzilla at jessica.w3.org (a day ago)

www.w3.org/Bugs/Public/show_bug.cgi?id=27428

Tobie Langel tobie.langel@gmail.com changed:

       What    |Removed                     |Added

     Resolution|FIXED                       |WONTFIX

--- Comment #9 from Tobie Langel tobie.langel@gmail.com --- (In reply to Boris Zbarsky from comment #8)

That's fine with me, but it sounds more like a wontfix than a fixed. ;)

That's a good point.

Want more features?

Request early access to our private beta of readable email premium.