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

Avoid "Member not found exception" in IE10 #7343

Merged
merged 1 commit into from
Jul 31, 2016
Merged
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
8 changes: 7 additions & 1 deletion src/renderers/dom/client/syntheticEvents/SyntheticEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,15 @@ Object.assign(SyntheticEvent.prototype, {

if (event.stopPropagation) {
event.stopPropagation();
} else {
} else if (typeof event.cancelBubble !== 'unknown') { // eslint-disable-line valid-typeof
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm assuming this fails the lint line length rule?

Copy link
Contributor Author

@nhunzaker nhunzaker Jul 29, 2016

Choose a reason for hiding this comment

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

Technically no, though it's against the React style guide all the same.

ESLint seems to struggle with else if. The only other valid option I can manage is:

if (event.stopPropagation) {
  event.stopPropagation();

  /* eslint-disable valid-typeof */
} else if (typeof event.cancelBubble !== 'unknown') {
  /* eslint-enable valid-typeof */
}

Or we could flip the if to place typeof event.cancelBubble before the event.stopPropagation check.

I know this is annoying and silly. Thank you for your patience on this.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm care-face on this (not my decision). If it's a problem just leave it as is and they'll complain if need be.

// The ChangeEventPlugin registers a "propertychange" event for
// IE. This event does not support bubbling or cancelling, and
// any references to cancelBubble throw "Member not found". A
// typeof check of "unknown" circumvents this issue (and is also
// IE specific).
event.cancelBubble = true;
}

this.isPropagationStopped = emptyFunction.thatReturnsTrue;
},

Expand Down