-
-
Notifications
You must be signed in to change notification settings - Fork 698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
eql does not work to compare Nodes in Firefox #120
Comments
Hmm, definitely an oversight. I'm not sure what the state of the art for deep-equal algorithms is. Any advice on the DOM element case in particular? |
The main reason I was using eql was to compare two arrays with nodes. For now I just ended up adding arrayEqual but I was told that eql was supposed to cover this use case. I think there will be more cases like this in the future where people end up using getters on the prototype chain (like the DOM). |
@logicalparadox any ideas on how we should modify the deep equal algorithm for this? As @arv says, there are plenty of objects with getters in their prototype chain for which this might be important. I believe I guess my initial thought is to just expand our current algorithm to include non-own properties as well. |
Agreed, it seems best to start with non-own properties and go from there; see if this satisfies the requirement. If we can avoid implementing different algorithms for different browsers, I think everyone involved would be much happier. |
eql uses Object.keys which only includes enumerable own properties. For DOM Nodes we have no own properties so they end up considered to be equal.
chai.expect(document.createTextNode('a')).to.not.eql(document.createTextNode('b'))
The text was updated successfully, but these errors were encountered: