[Bug 10340] New: The [OverrideBuiltins] annotation on the Window interface IDL block should be removed because it breaks sites

http://www.w3.org/Bugs/Public/show_bug.cgi?id=10340

           Summary: The [OverrideBuiltins] annotation on the Window
                    interface IDL block should be removed because it
                    breaks sites
           Product: HTML WG
           Version: unspecified
          Platform: All
               URL: http://dev.w3.org/html5/spec/browsers.html#the-window-
                    object
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P3
         Component: HTML5 spec (editor: Ian Hickson)
        AssignedTo: ian@hixie.ch
        ReportedBy: adrianba@microsoft.com
         QAContact: public-html-bugzilla@w3.org
                CC: mike@w3.org, public-html@w3.org


Existing text:
[OverrideBuiltins, ReplaceableNamedProperties]
interface Window {
  ...

New text:
[ReplaceableNamedProperties]
interface Window {
  ...


In IE9, as in both Chrome and Firefox’s OverrideBuiltins implementation,
OverrideBuiltins means “check the custom named getter for the object, then
check the prototype chain”. This can be observed by looking at the behavior of
OverrideBuiltins support on the HTMLFormElement in Firefox and Chrome (IE9
preview 4 gets it wrong but we’re fixing that):

<form id=”myForm”>
     <input id=”appendChild” />
     <img id=”hasOwnProperty” name=”hasOwnProperty” />
</form>

document.getElementById(‘myForm’).appendChild; // This is a reference to the
<input> element, not the built-in appendChild DOM API.
document.getElementById(‘myForm’).hasOwnProperty; // This is a reference to the
<img> element, not the built-in Object.prototype.hasOwnProperty API.

So, in early IE9 builds, we applied this behavior to the Window interface just
like the current spec says. However, this behavior breaks real websites because
many, many websites use element ids that conflict with the built-in properties
that they are expecting.

In IE9, all DOM operations and properties are represented by ES5 data
properties and accessor properties respectively. These DOM “built-ins” are
looked up in the prototype chain, just like everything else. The accessors of
the window object (e.g., the “document” accessor) are defined on
Window.prototype, which is the prototype of the global object. The HTML5 spec
defines an element with id=”document”. At that point, any window-scoped
requests for the “document” built-in return an HTMLElement instance, instead of
the built-in Document object, such as:

document.getElementById; // Script error, because “document” is a reference to
the specific HTMLElement type, which does not support the “getElementById”
property.

In our testing, Chrome doesn’t support OverrideBuiltins on window, nor does
Firefox. Opera does something else which is a different behavior than what we
found with the other browsers when applying the HTMLFormElement’s definition of
OverrideBultins to the window.

Due to the browser interop matrix as well as the site-compat problem, we
recommend removing the [OverrideBuiltins] annotation from the Window interface.

-- 
Configure bugmail: http://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 Tuesday, 10 August 2010 14:33:34 UTC