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

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

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Fri, 05 Oct 2012 17:32:46 -0400
Message-ID: <506F51FE.6070901@mit.edu>
To: Ian Hickson <ian@hixie.ch>
CC: public-script-coord@w3.org
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.

-Boris
Received on Friday, 5 October 2012 21:33:16 UTC

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