var a = document.getElementById('a'); var b = document.getElementById('a'); a.isSameNode(b); // true a === b; // true
What is the browser compatibility of each approach?
isSameNode is deprecated in DOM v4 . Firefox has dropped support in version 10. I believe that other major browsers support this now.
Recommended approach is to use '==='