[whatwg] activeElement

Hallvord R M Steen hallvors at gmail.com
Thu May 17 14:54:26 PDT 2007

if WHATWG is defining document.activeElement, perhaps the WHAT spec
should match IE's behaviour more closely on some points. I refer to:

Following up some Opera bug report I had a 10 minute go at working out
what IE is doing, and I came up with this:


Quoting the four main observations, with comments:
* when the document is loaded, before any interaction activeElement is
the body element (!) (probably not important, I doubt any site would
rely on this)

* activeElement is set after mousedown. (important, maybe implied by
other stuff about focus handling? I didn't test keydown for e.g.
tabbing but pretty sure the same applies.)

* it is set to the event's target if it is "focusable" (A, INPUT,
BUTTON etc.), otherwise it is set to the event's target's
.offsetParent (important, and the offsetParent stuff isn't covered in
the current spec )

* it keeps pointing to the same element until another interaction with
the document sets it again (important)

Hallvord R. M. Steen

More information about the whatwg mailing list