-
-
Notifications
You must be signed in to change notification settings - Fork 489
expose findElementQueriesElements to ElementQueries #156
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
Conversation
src/ElementQueries.js
Outdated
function findElementQueriesElements() { | ||
var query = getQuery(); | ||
function findElementQueriesElements(container) { | ||
var query = (container) ? container.querySelectorAll.bind(container) : getQuery(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should move this to getQuery(container)
since we support jquery selector engine when available, which can be bound to a context/container as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I understood jQuery or Mootools are only used if document.activeElement is not available. According to https://developer.mozilla.org/en-US/docs/Web/API/Document/activeElement it is available in IE4+, Chrome 2+, Firefox 3.0+ etc.
That's the reason for skipping this if a container is available (I also wrote #157 for removing the legacy code)
Should I still add it to getQuery()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any updates on this? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, jquery or mootools are used when document.querySelectorAll is not defined. See
css-element-queries/src/ElementQueries.js
Lines 185 to 187 in 134443d
if (document.querySelectorAll) query = document.querySelectorAll.bind(document); | |
if (!query && 'undefined' !== typeof $$) query = $$; | |
if (!query && 'undefined' !== typeof jQuery) query = jQuery; |
So either we drop support for that or we continue to support both.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Marc,
you are right, it is only used if document.querySelectorAll is not defined. This only happens, if the browser doesn't support it. According to http://caniuse.com/#feat=queryselector every browser (except IE 8 and below) supports document.querySelectorAll. So jQuery and mootools will never be used. Do you understand what I mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please maintain old behaviour with jQuery/Mootools support.
src/ElementQueries.js
Outdated
} | ||
|
||
return query; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should really not just delete that code. It removes features from the whole library and that change is not even related to the given pull request description.
fixes #95