[whatwg] Fixing activeElement spec to match IE

Ojan Vafai ojan at chromium.org
Mon May 16 16:44:25 PDT 2011


IE's behavior is better than the current spec because it allows a page to
find the focused element even if the focused element is in a frame by
walking down the frame tree if the activeElement is a frame.

There is existing code that depends on this:
http://www.google.com/codesearch/p?hl=en#epIciakqvFc/trunk/closure/goog/ui/popupbase.js&q=activeElement%20package:http://closure-library%5C.googlecode%5C.com&l=477
.

On Mon, May 16, 2011 at 3:39 PM, Erik Arvidsson <arv at chromium.org> wrote:

> Currently, the spec[1] says:
>
>  "The activeElement attribute on HTMLDocument objects must return the
> element in the document that is focused. If no element in the Document
> is focused, this must return the body element."
>
> This does not fully match IE, or is underspecified. If the document
> has frames in it and a frame contains the focused element, the
> activeElement of the HTMLDocument should return the frame element
> which contains the focus.
>
> I have a patch for WebKit [2] to match IE's behavior as described above.
>
> [1] http://dev.w3.org/html5/spec/Overview.html#document-level-focus-apis
> [2] https://bugs.webkit.org/show_bug.cgi?id=49509
>
> erik
>



More information about the whatwg mailing list