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

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.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Tuesday, 18 December 2012 23:16:41 UTC