W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2012

RE: [WebIDL] toJSON

From: Travis Leithead <travis.leithead@microsoft.com>
Date: Wed, 30 May 2012 21:30:15 +0000
To: Brendan Eich <brendan@mozilla.org>, David Bruant <bruant.d@gmail.com>, Cameron McCormack <cam@mcc.id.au>
CC: "public-script-coord@w3.org" <public-script-coord@w3.org>
Message-ID: <9768D477C67135458BF978A45BCF9B383836C74D@TK5EX14MBXW604.wingroup.windeploy.ntdev.microsoft.com>
> -----Original Message-----
> From: Brendan Eich [mailto:brendan@mozilla.org]
> 
> David Bruant wrote:
> > Le 30/05/2012 21:40, Travis Leithead a écrit :
> >> IE9 added a native toJSON method on the window.performance object in
> >> order to allow simple JSON of that accessor property to work nicely
> >> :)
> > I have mixed feelings on this news. On one hand I think it's a
> > brilliant idea, specifically for this property which holds a lot of
> > properties itself,
> 
> Yes, this is good and it should be spec'ed.
> 
> >   on the other hand, I wonder if it's part of any standard.
> > Is IE9 the only browser who did add a toJSON to window.performance? If
> > no, are all implementations consistent with one another?

The problem we ran into was that other implementations didn't properly support WebIDL [yet], and so a simple JSON.stringify(...) would work in those browsers but not in IE9. It was motivated more by practical purposes, but you raise a fair point.

> Hey, we can add one in Gecko. Would be happy to if it's spec'ed.
> 
> > I really think it's a brilliant idea. I just wish it was discussed in
> > standards mailing-lists first :-)
> 
> That's fair, but let's talk now. Better late than never!

For the window.performance thing, it should be raised as a potential feature of Navigation Timing [1] or similar spec.

[1] https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html

The larger question (in my mind) is whether toJSON extensions should get syntactic sugar in WebIDL or not. Since they are so similar (in principle) to toString extensions, I'd argue that it would be a good idea. Cameron, what do you think?
Received on Wednesday, 30 May 2012 21:30:53 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:06 UTC