开发者

How to get <body> in *X*HTML where document.body is missing

开发者 https://www.devze.com 2023-02-14 20:23 出处:网络
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 o

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号