如何强制Chrome(或任何其他WebKit浏览器)不使用“默认”标签名称? [英] How to force Chrome (or any other WebKit browser) not to use "default" tag names?

查看:170
本文介绍了如何强制Chrome(或任何其他WebKit浏览器)不使用“默认”标签名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于Chrome会自动引用DIV,因此我遇到了问题......它在Safari(桌面和移动设备)中以这种方式工作,而不是在Firefox中。



查看图片:





请参阅Fiddle(在Chrome中打开,然后在Firefox中打开):
http://jsfiddle.net/stefek99/Sqcff/



问题是 - 如何禁用此功能 ?我真的很喜欢在没有任何Google怪癖的严格模式下开发,只是为了确保我的代码符合跨浏览器。

解决方案

这是一个已知的问题,但我一直无法找到一种可靠的方法来禁用此功能。有人可能认为use strict; 应该可以禁用它,但似乎并非如此。



<无论如何,有更多的解释; 使用ID做DOM树元素变成全局变量吗?正如所解释的那样,可能在HTML5中进行标准化。这一切都始于非标准的IE功能,其中的某些课程在其他浏览器中被模仿。 Theres甚至是msdn 博文指出它是一个'问题',所以它似乎有点愚蠢HTML5工作组正试图将其标准化。



我想告诉任何人请不要依赖这个问题特性,因为它对于不知道它的程序员来说是非常模糊和难以调试的。


I was having issues because of Chrome automatically referencing DIV... It works that way in Safari (desktop and mobile), but not in Firefox.

See image:

See Fiddle (open in Chrome, then in Firefox): http://jsfiddle.net/stefek99/Sqcff/

The question is - how to disable this feature? I would really like to develop in "strict" mode without any Google quirks, just to make sure my code is cross-browser compliant.

解决方案

This is a known 'problem', however I have not been able to find a reliable method of disabling this. One might think that "use strict"; should probably disable it but that doesn't seem to be the case.

In any case, some more explanation on it; Do DOM tree elements with ids become global variables? As explained there it will probably be standardized in HTML5. It all started out as a non-standard IE feature, which ofcourse got mimicked in other browsers. Theres even a msdn blog post noting it as a 'problem' so it seems a bit silly the HTML5 working group is trying to standardize it now.

I would like to note to anybody to please not rely on this problem feature as it is very ambiguous and hard to debug for programmers who don't know of it.

这篇关于如何强制Chrome(或任何其他WebKit浏览器)不使用“默认”标签名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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