Skip to content

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

Closed
wants to merge 0 commits into from

Conversation

kaljak
Copy link
Contributor

@kaljak kaljak commented Mar 9, 2017

fixes #95

function findElementQueriesElements() {
var query = getQuery();
function findElementQueriesElements(container) {
var query = (container) ? container.querySelectorAll.bind(container) : getQuery();
Copy link
Owner

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.

Copy link
Contributor Author

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()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any updates on this? :)

Copy link
Owner

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

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.

Copy link
Contributor Author

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?

Copy link
Owner

@marcj marcj left a 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.

}

return query;
}
Copy link
Owner

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.

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.

Confirm: allowed to call ElementQueries.init multiple times?
2 participants