W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2013

Re: [WebIDL] Should stringifiers use [[Get]] and [[Call]] or call the canonical getter/function?

From: Cameron McCormack <cam@mcc.id.au>
Date: Fri, 02 Aug 2013 14:45:42 +1000
Message-ID: <51FB3976.4080006@mcc.id.au>
To: Travis Leithead <travis.leithead@microsoft.com>
CC: Boris Zbarsky <bzbarsky@MIT.EDU>, public-script-coord@w3.org, Ian Hickson <ian@hixie.ch>
Ian Hickson wrote:
> On Fri, 5 Oct 2012, Boris Zbarsky wrote:
>> On 10/5/12 4:53 PM, Ian Hickson wrote:
>>> On Fri, 5 Oct 2012, Boris Zbarsky wrote:
>>>> And in particular, the way the spec is phrased right now means that this
>>>> bit of WebIDL from HTMLAnchorElement:
>>>>       stringifier attribute DOMString href;
>>>> does not have the same behavior as this bit would:
>>>>      attribute DOMString href;
>>>>      stringifier DOMString();
>>>> with prose defining DOMString to do the same thing as the href getter.
>>> Which do browsers do? (If either.)
>> In Chrome and Safari, I don't think it's possible to modify the behavior of
>> element.href, so it's impossible to test there.
>> In Gecko and Presto and IE9, this testcase:
>>    <pre><script>
>>      var a = document.createElement("a");
>>      a.href = "http://w3.org"
>>      document.writeln(a.toString());
>>      document.writeln(a.href);
>>      Object.defineProperty(a, "href", { value: "Haha" });
>>      document.writeln(a.toString());
>>      document.writeln(a.href);
>>    </script>
>> writes out "http://w3.org" three times, then "Haha". Which is consistent with
>> how I want the WebIDL spec to work, not with how it works right now.
> Makes sense to me. Heycam tells me he's going to fix this in WebIDL; if
> that ends up not happening, please let me know so I can fix it in HTML
> instead.

Using [[Get]] and [[Call]] seems the more obvious way to for this to, to 
be honest.  And it's consistent with how [PutForwards] works.  Travis, 
any view on this?
Received on Friday, 2 August 2013 04:46:23 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:17 UTC