Skip to content
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

Closes issue #4287 #4356

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core/core.helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ module.exports = function(Chart) {
};
helpers.addEvent = function(node, eventType, method) {
if (node.addEventListener) {
node.addEventListener(eventType, method);
node.addEventListener(eventType, method, {passive: true});
Copy link
Member

Choose a reason for hiding this comment

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

Will adding this parameter cause issues on browsers other than Chrome? We should confirm that this doesn't break IE11 compatibility.

Copy link
Member

Choose a reason for hiding this comment

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

It's not supported in IE and Edge and therefore options support needs to be detected in order to call addEventListener with the correct arguments.

Copy link
Author

Choose a reason for hiding this comment

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

Is there any browser detection function which is already in Chart.js code? Then we could use that. I have found Chart.platform but I don't think it can be used to detect IE and Edge. Any thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

@asimkt while re-organizing our helpers, I moved addEvent and removeEvent in platform.core.js but also implemented this feature detection, I hope you don't mind (see #4424).

} else if (node.attachEvent) {
node.attachEvent('on' + eventType, method);
} else {
Expand Down