Will == and === work correctly in all browsers for DOM elements?
Yes, these equality operators will work as defined by the ECMAScript standard.
One word of caution, == often does things that developers do not expect, such as casting a string to a comparison against a string value. This would make the following statement true, although this may not be the desired result:
document.createElement('div') == '[object HTMLDivElement]'
In most cases, you need to use the === operator.
source share