是否有任何重要的浏览器缺少HTML文档的document.documentElement? [英] Is any significant browser missing document.documentElement for an HTML doc?

查看:125
本文介绍了是否有任何重要的浏览器缺少HTML文档的document.documentElement?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

document.documentElement 是一个 DOM1属性等,因此在13年前被指定。在我的实验中,它是可靠的IE6向前和在最近的版本(我没有回过远的),Firefox,Chrome,Safari,Mobile Safari,Opera和Konqueror在我使用HTML5 doctype。所以这涵盖了一系列布局引擎:Trident,Gecko,WebKit,Presto和KHTML。

document.documentElement is a DOM1 property and so was specified more than 13 years ago. In my experiments, it's reliable in IE6 onward and in vaguely recent versions (I haven't gone back far) of Firefox, Chrome, Safari, Mobile Safari, Opera, and Konqueror when I use the HTML5 doctype. So that covers a fair range of layout engines: Trident, Gecko, WebKit, Presto, and KHTML.

(如果我省略了实际的 html 标记[我是允许在HTML5中执行 —显然,即使IE6添加了它,尽管它从来没有听说过HTML5 但是几乎肯定从来不会在实践中。)

(It even works if I omit the actual html tag in my markup [which I'm allowed to do in HTML5 — and apparently even IE6 adds it in for me despite it never having heard of HTML5 — but almost certainly never will in practice].)

是否有任何重要的浏览器 —黑莓? Android? —在其中我不能假设 document.documentElement 将存在,将引用一个HTML文档中的根 html 元素?

Is there any significant browser — Blackberry? Android? — in which I cannot assume document.documentElement will be present and will refer to the root html element in an HTML document?

推荐答案

取决于您的要求。早期版本的黑莓浏览器,在版本6的操作系统之前,可能没有支持它。但是浏览器太糟糕了,任何启用JavaScript的网站几乎不起作用。

Depends on your requirements. Older versions of Blackberry's Browser, before version 6 of the OS, may not have had support for it. But the browser was so bad that any JavaScript enabled site hardly worked anyway.

根据维基百科,所有主要rending引擎支持它。似乎该表使用的是IE版本,而不是Trident的实际版本。 Trident(IE),Gecko(Firefox),Webkit(Safari,Chrome)和Presto(Opera)都支持它。 Tasman渲染引擎基本上已过时和未使用。我不会担心。

According to Wikipedia, all major rending engines support it. It seems like that table is using the IE version rather than the actual version of Trident. Trident (IE), Gecko (Firefox), Webkit (Safari, Chrome), and Presto (Opera) all support it. The Tasman rendering engine is largely obsolete and unused. I wouldn't worry about it.

在我个人的经验中,我没有在自己或客户在合理的现代浏览器上使用该属性的问题。

In my personal experience, I've had no problems from myself or customers using that property on a reasonably modern browser.

所有移动浏览器,Safari / iOS,Android,甚至Windows Phone 7上的Internet Explorer都支持它。最近的BlackBerries也一样。

All mobile browsers, Safari/iOS, Android, even Internet Explorer on Windows Phone 7 support it. Recent BlackBerries do as well.

这篇关于是否有任何重要的浏览器缺少HTML文档的document.documentElement?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆