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

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