Node: phương thức isSameNode()
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since August 2016.
Phương thức isSameNode() của giao diện Node trả về true nếu hai nút là cùng một đối tượng.
Cú pháp
js
isSameNode(otherNode)
Tham số
otherNode-
Nút cần so sánh.
Giá trị trả về
true nếu hai biến tham chiếu đến cùng một nút, ngược lại false.
Ví dụ
js
const node1 = document.querySelector("p");
const node2 = node1;
console.log(node1.isSameNode(node2)); // true
Thông số kỹ thuật
| Thông số kỹ thuật |
|---|
| DOM> # dom-node-issamenode> |