Join MDN and developers like you at Mozilla's View Source conference, 12-14 September in Berlin, Germany. Learn more at https://viewsourceconf.org

Node.isSameNode

已废弃
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

概述

判断两个节点是否是相同的节点,即指向同一个对象.

警告:该方法已在DOM level 4中被废弃,最近的浏览器版本(Gecko 10.0 (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey 2.7).)已经删除了这个方法.
也就是说,不要再使用
  node1.isSameNode(node2)
而使用
  node1 === node2  或者  node1 == node2
来代替.

语法

var isSameNode = node.isSameNode(other);
  • other是要和node判断相同性的另一个节点.

规范

文档标签和贡献者

 此页面的贡献者: teoli, AshfaqHossain, ziyunfei
 最后编辑者: AshfaqHossain,