[whatwg] activeElement

Hi,
if WHATWG is defining document.activeElement, perhaps the WHAT spec
should match IE's behaviour more closely on some points. I refer to:
http://www.whatwg.org/specs/web-apps/current-work/#activeelement

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:

http://my.opera.com/hallvors/blog/2007/05/16/quick-spec-for-ies-document-activeelement

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

Received on Thursday, 17 May 2007 14:54:26 UTC