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

Prevent errors when document.documentElement.dataset is not present. #475

Merged

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Sep 30, 2015

If document.documentElement does not have a dataset property we will never mark the content script as loaded (and it cannot be an Ember app) this happens in some scenarios with Chrome 45+ and SVG elements.

Fixes #463
Closes #473

@rwjblue
Copy link
Member Author

rwjblue commented Sep 30, 2015

@teddyzeenny - Should be ready for review...

(document.documentElement && !document.documentElement.dataset) ||

// when the content script is loaded, this flag is set to `1`
document.documentElement.dataset.emberExtensions
Copy link
Contributor

Choose a reason for hiding this comment

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

This code wouldn't execute if it's not an Ember app.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, so you are saying that we do not need to guard here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Confirm

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated

@rwjblue rwjblue force-pushed the prevent-missing-dataset-from-erroring branch from 1be5d0b to a0dc523 Compare October 1, 2015 13:10
// let ember-debug know that content script has executed
document.documentElement.dataset.emberExtension = 1;
// document.documentElement.dataset is not present for SVG elements
// this guard (and a corresponding one in ember-debug/adapters/basic)
Copy link
Contributor

Choose a reason for hiding this comment

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

can you update the comment?

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated

if `document.documentElement` does not have a `dataset` property we
will never mark the content script as loaded (and it cannot be an Ember app)
this happens in some scenarios with Chrome 45+ and SVG elements.
@rwjblue rwjblue force-pushed the prevent-missing-dataset-from-erroring branch from a0dc523 to 89c9c86 Compare October 1, 2015 13:26
teddyzeenny added a commit that referenced this pull request Oct 1, 2015
…oring

Prevent errors when document.documentElement.dataset is not present.
@teddyzeenny teddyzeenny merged commit d6b8a25 into emberjs:master Oct 1, 2015
@teddyzeenny
Copy link
Contributor

Thank you!!

@rwjblue rwjblue deleted the prevent-missing-dataset-from-erroring branch October 1, 2015 13:35
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.

None yet

2 participants