[whatwg] Document.activeElement should return the root element in non-HTML documents when no element has focus

Boris Zbarsky bzbarsky at MIT.EDU
Mon Feb 3 04:36:37 PST 2014


On 2/3/14 5:29 AM, Anne van Kesteren wrote:
> So how does that work for text/xml? Do you dispatch on namespace of
> the root element?

What Gecko does is that if the document is an HTMLDocument (so is 
text/html or application/xhtml+xml) and hence has a .body property we 
use that.  Otherwise we use .documentElement.

Of course the spec has no concept of HTMLDocument and has a .body on all 
documents...

-Boris



More information about the whatwg mailing list