Skip to content

Conversation

@Amitesh
Copy link
Contributor

@Amitesh Amitesh commented Apr 10, 2018

fixes #1074 for activeElement is breaking $.contains() method for lower version of jQuery 1.7 but it works well with jQuery 2.1.3.

[https://codepen.io/amitesh/pen/PRLwvQ](Sample code on CodePen)

fixes amsul#1074 for activeElement is breaking $.contains() method for lower version of jQuery 1.7 but it works well with jQuery 2.1.3.

[https://codepen.io/amitesh/pen/PRLwvQ](Sample code on CodePen)
@DanielRuf
Copy link
Contributor

jQuery 1.7

and older is not really recommended anymore

@Amitesh
Copy link
Contributor Author

Amitesh commented Apr 10, 2018

Yes.
I suggest, we should ensure to provide DOM element to $.contains() method because it is expecting DOM element as parameters otherwise, it will always return false.
For jQuery 1.7 it is throwing error on console while for higher version like 2.1.3 silently giving false everytime.

The $.contains() method returns true if the DOM element provided by the second argument is a descendant of the DOM element provided by the first argument, whether it is a direct child or nested more deeply. Otherwise, it returns false. Only element nodes are supported; if the second argument is a text or comment node, $.contains() will return false.

For reference $.contains()

@DanielRuf DanielRuf self-requested a review April 10, 2018 22:35
@DanielRuf DanielRuf merged commit 92eb601 into amsul:master Apr 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

activeElement is breaking $.contains() method

2 participants