How to get <body> in *X*HTML where document.body is missing
What is the "official" way to ge开发者_开发知识库t the <body>
element in XHTML (=~XML) web page where there is no document.body
? I mean something better than quering it through querySelector
or getElementsByTagName
which I consider ugly.
EDIT: It doesn't work for me in Firefox 3.6 when in strict XHTML mode.
document.body
is an official, standard property and is part of DOM2. In addition, all browsers today support it.
I had a XML document. One should switch from application/xml
to application/xhtml+xml
.
精彩评论