在DOM中是节点ids的情况敏感? [英] In the DOM are node ids case sensititve?

查看:94
本文介绍了在DOM中是节点ids的情况敏感?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个HTML是否有效?或者是id'a'与id'A'相同?

 < div id =a>阿尔法< / DIV> 
< div id =A> Alpha< / div>


解决方案

是的。它是区分大小写的。属性值始终区分大小写。不同的浏览器似乎在做不同的事情。



处理 document.getElementById 在浏览器之间是不同的:


  1. Mozilla 执行区分大小写的搜索。


  2. Internet Explorer :IE 8及更高版本执行区分大小写搜索,而IE 7和更早版本则执行区分大小写搜索。



Is this HTML valid? Or is the id 'a' the same as the id 'A'?

<div id="a">alpha</div>
<div id="A">Alpha</div>

解决方案

Yes. It is case-sensitive. Attribute values are always case-sensitive. Different browsers seem to be doing different things though.

Handling document.getElementById is different across browsers:

  1. Mozilla performs case-sensitive search.

  2. Internet Explorer: IE 8 and later performs case-sensitive search, while IE 7 and earlier performs case-insensitive search.

这篇关于在DOM中是节点ids的情况敏感?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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