[whatwg] Focus, html vs body and the activeElement property

Hello.

I'm reading this part:
http://www.whatwg.org/specs/web-apps/current-work/#focus

The intro states:
"When an element is focused, key events received by the document must be
targeted at that element. There is always an element focused; in the
absence of other elements being focused, the document's root element is
it."

Under "Focus management", I read:

"The activeElement attribute must return the element in the document that
has focus. If no element specifically has focus, this must return the body
element."

First: Isn't this a contradiction? The first paragraph states that there
is always an element focused. The second gives a case where this is not so.

Second: I presume the document's root is defined as html, but the
activeElement returns the body element. Why?

This seems to refer to the same issue:
http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2007-October/012654.html
Searching through the archive I can't find a response, for example in  
Ian's "several messages" posts.

The spec also mentions "system focus" and seems to imply that this is
different from the focus of elements. But the term is not particularly
defined. I'm guessing this means that this is the page the user is
currently looking at, i.e. that the window containing the document has
focus? But then this line is confusing:

"The hasFocus attribute must return true if the document, one of its
nested browsing contexts, or any element in the document or its browsing
contexts currently has the system focus."

This seems to imply that an element inside a document can have system
focus. What does this mean?

-- 
Vennlig hilsen/best regards
Hans S. T?mmerholt
Developer, Web Applications, Opera Software ASA

Received on Wednesday, 30 April 2008 01:08:31 UTC