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

opt out of input events for ie 10 and 11 #4051

Merged
merged 1 commit into from
Oct 18, 2015
Merged

opt out of input events for ie 10 and 11 #4051

merged 1 commit into from
Oct 18, 2015

Conversation

jquense
Copy link
Contributor

@jquense jquense commented Jun 7, 2015

while supported, the "input" event is too noisy in IE. It Fires on
placeholder sets, and when an input is focused with a placeholder.

This is an potential alternative fix to #3826

cc @syranide

fixes #3377 and fixes #3484

@jquense
Copy link
Contributor Author

jquense commented Aug 8, 2015

Ditto this one, I know ya'll are the most busy, but it'd be great to get a fix for this into 0.14.

Let me know if there is anything I can do to help.

if (activeElement.attachEvent) {
activeElement.attachEvent('onpropertychange', handlePropertyChange);
} else {
activeElement.addEventListener('propertychange', handlePropertyChange, false);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this will work. According to MSDN, the propertychange event is only fired when listened via the attachEvent API

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ya I saw that as well, but right below that it also demonstrates it using addEventListener, and it does seem to work in my testing. It could probably stand further testing

@jimfb
Copy link
Contributor

jimfb commented Oct 16, 2015

This solution feels simple and clean to me, it avoids having a whole additional browser-dependent code path to follow (ie. better than #3826).

I'll leave it unmerged for a day so people can raise any objections. If there are none, let's ship it.

if (activeElement.attachEvent) {
activeElement.attachEvent('onchange', manualDispatchChangeEvent);
} else {
activeElement.addEventEventListener('change', manualDispatchChangeEvent, false);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this actually be reached? It's kind of hard to tell at first glance, but this only targets IE8 right? So it shouldn't be.

Copy link
Contributor

Choose a reason for hiding this comment

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

@syranide Prior to this change, this code path targeted IE8 and IE9. This change makes IE10 and IE11 also follow the same code path. IE11 does not have attachEvent which is why this is reachable. See #3826 (comment) for context.

Copy link
Contributor

Choose a reason for hiding this comment

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

@jimfb But...

  doesChangeEventBubble = isEventSupported('change') && (
    !('documentMode' in document) || document.documentMode > 8
  );
      if (doesChangeEventBubble) {
        getTargetIDFunc = getTargetIDForChangeEvent;
      } else {
        handleEventFunc = handleEventsForChangeEventIE8;
      }

doesChangeEventBubble should only be false for IE8 and thus it shouldn't go down that path for any other browser as far as I can tell. Or am I reading this wrong.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll defer to @jquense ; Jason, thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is currently unreachable yeah, Its been a few months but I may have just been overzealous refactoring. Let me remove it...

while supported then Input event is too noisy in IE. Firing on
placeholder sets, and when an input is focused with a placeholder.

fixes #3377 and fixes #3484
@facebook-github-bot
Copy link

@jquense updated the pull request.

jimfb added a commit that referenced this pull request Oct 18, 2015
opt out of input events for ie 10 and 11
@jimfb jimfb merged commit dd3c447 into facebook:master Oct 18, 2015
@jimfb
Copy link
Contributor

jimfb commented Oct 18, 2015

Thanks @jquense!

@zpao
Copy link
Member

zpao commented Oct 19, 2015

cc @salier as a heads up since you've been dealing with this sort of stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants