[whatwg] Should window.name be [Replaceable]?

Should window.name be [Replaceable]?

There are a number of "[Replaceable]" [1] properties on the window
object. However, "window.name" is not marked as such [2]. Not being
marked as replaceable means that if authors use a global variable
named "name" it will be coerced into a string. For many this causes
confusion. It seems some browsers have opted to make it replaceable.

Test case. You can test your browser at [3].

    (function() {
        var arr = [];
        arr.push( typeof window.name );
        window.name = 1;
        arr.push( typeof window.name );
        name = 1;
         // "number" if [Replaceable], "string" otherwise
        arr.push( typeof window.name );
        alert( arr );
    })();

Browser Results:

    - Safari 5 / WebKit Nightly and Chrome 5
      NOT [Replaceable], printing "string,string,string" 
    
    - Firefox 3.6.3 / 3.7a5 and Opera 10.5.3 / 10.6
      [Replaceable], printing  "string,string,number"

    - I didn't have access to IE to test. I'd appreciate
      someone giving it a shot to see how they act.

Has there been discussion on this in the past? I searched and
didn't find any discussion.

- Joe

[1]: http://dev.w3.org/2006/webapi/WebIDL/#Replaceable
[2]: http://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.html#the-window-object
[3]: https://bug-19967-attachments.webkit.org/attachment.cgi?id=60491

Received on Sunday, 4 July 2010 21:05:49 UTC