Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Conversation

@alejandroSuch
Copy link

perf(jqLite): Add passive event listeners

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Changes in sqLite to add passive event listeners

What is the current behavior? (You can also link to an open issue here)
Chrome warns with lots of messages telling us to add passive event listeners

What is the new behavior (if this is a feature change)?
Warnings disappear and there are less page blockings

Does this PR introduce a breaking change?
No

Please check if the PR fulfills these requirements

Other information:

@dcherman
Copy link
Contributor

dcherman commented Jun 1, 2017

From the MDN:

passive: A Boolean indicating that the listener will never call preventDefault(). If it does, the user agent should ignore it and generate a console warning. See Improving scrolling performance with passive listeners to learn more.

You can't guarantee this for any listeners other than your own, so this would be a massive, gigantic breaking change to .on

@gkalpak
Copy link
Member

gkalpak commented Jun 1, 2017

Idea: Make the default (passive or not) configurable and allow overwriting the default per case (e.g. ng-click="..." ng-click-passive="true/false").
This definitely needs more thought and discussion.

@dcherman
Copy link
Contributor

dcherman commented Jun 1, 2017

You wouldn't be able to do that without a corresponding change in jQuery though unless you're willing to diverge from their API.

Also FWIW, I think it would be valid to allow this option to be usable with the ng- event handlers, but it would be a nightmare for plugin authors if you couldn't guarantee how your handlers will behave. Would rather see this be an opt-in behavior rather than potentially an opt-out.

@gkalpak
Copy link
Member

gkalpak commented Jun 2, 2017

Oh, you are right. I thought this was only about the ng-<event> directives, not jqLite's .on(). So, yeah, we have no intention of deviating from the jQuery API (unless there is a significant reason), because the idea of jqLite is to remain as compatible as possible with jQuery.

Closing as won't fix. We can re-consider if/when jQuery makes a similar change.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants