为什么要在书签中检查 !document.xmlVersion
Why check for !document.xmlVersion in bookmarklets?
我看到书签代码的一个非常常见的样板模式:
javascript:var%20b=document.body;if(b&&!document.xmlVersion){void(/*do_something_AWESOME_here*/);}else{}
包含 !document.xmlVersion 检查背后的原因是什么? 这仅仅是排除旧版浏览器的问题吗?验证我们是否在 HTML 文档中,而不是 XML 文档中? 文档并没有完全澄清问题...我无法找到任何关于此的解释性陈述 - 它主要看起来像是复制粘贴的情况。
更新了 5/21/2012 以包含指向 Google 搜索模式的链接
因为文档建议旧版本需要检查文档是否呈现为 XML 而不是 HTML。 现在它在最新版本的浏览器中没有用。最新版本的浏览器中不使用 IT。
相关文章:
- 正在寻找比$(document).ready慢的$(window).load的替代方案
- document.open/document.write没有正确地清除chrome中的文档——这是chrome的错误吗
- 如何用更合适的内容替换document.write
- document.styleSheets不返回任何内容
- jQuery document.ready not working
- $(document).height()在刷新时随机化值(Safari 5.1.10)
- reactjs this.refs vs document.getElementById
- 如何通过adf中的document.getElementById获取inputText字段值
- window.opener.document在ie中不起作用
- contentWindow.document.body is null
- document.applet.method在Mounatin Lion上抛出safari 6+JDK7异常
- document.getElementById(“st”).click();不起作用
- $(document).height和$(window).heaght都返回相同的值-使用的是正确的doctype
- jQuery document.ready停止代码
- document.getElementById并使用id名称
- 使用jQuery 1.8.1准备好多个$(document).是否有任何开销
- document.getElementById在js中不起作用
- document.getElementById.style.backgroundImage not working
- 停止对document.ready函数的重定向/刷新
- 为什么要在书签中检查 !document.xmlVersion