[Bug 11960] Consider making the global scope pollution by names/ids quirks-only

https://www.w3.org/Bugs/Public/show_bug.cgi?id=11960

--- Comment #23 from Simon Pieters <simonp@opera.com> 2012-03-26 10:04:14 UTC ---
Adrian pointed to a site on Twitter that relied on this (before at least):
http://slacker.com/

which has the following currently commented-out script:

                function getPluginObject(id) {
                    var f;
                    if (navigator.appName.indexOf("Microsoft") != -1) {
                        f = window[id];
                        if (f[0]) {  // in IE9, window['flash_mp3'] returns an
array with two elements: the object and the embed
                            f = f[0];
                        } 
                    } else if (navigator.appName.indexOf("Opera") != -1) {
                        f    = document.getElementById(id);
                    } else {
                        f = document[id];
                    }
                    return f;
                }

It currently uses an almost standards mode doctype. Looking through Web
Archive, it seems to have used the same doctype since 2007 (and used no doctype
before that).

In our BTS I have come across a URL that relies on this, but that also uses an
almost standards mode doctype: http://www.tam.com.br/

I did a search for "window[id]" in dotnetdotcom's web200904, and found only one
site that sniffs for "Microsoft" and relies on this in standards mode, but the
live site seems to have changed since then: http://ca.ning.com/

it had:

    function getSwf(id) {
        if (navigator.appName.indexOf("Microsoft") != -1) {
                return window[id];
        }
        else {
                return document[id];
        }
    }


What I'm trying to find out here is whether it would be possible to remove the
global scope pollution in standards mode but keep it in quirks mode and almost
standards mode. So far I have not seen any live URL where this would break.

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Monday, 26 March 2012 10:04:27 UTC