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

legacy IE bug with change events #7

Open
keyo321 opened this issue Aug 10, 2013 · 4 comments
Open

legacy IE bug with change events #7

keyo321 opened this issue Aug 10, 2013 · 4 comments

Comments

@keyo321
Copy link

keyo321 commented Aug 10, 2013

For some reason change events are not firing in IE8 and below:

Gator(document).on('change', '#someid', function(e) {
//do something -
});

click works tho.

@ccampbell
Copy link
Owner

Thanks for the ticket. It seems the change event does not bubble in old IE

http://stackoverflow.com/questions/265074/does-the-onchange-event-propagate
http://stackoverflow.com/questions/1637503/jquery-change-event-on-select-not-firing-in-ie

I will see if this is something I can handle in gator

In the mean time you could try binding directly to the element

Gator(document.getElementById('someid')).on('change', function() {
    // do something
});

@ccampbell
Copy link
Owner

So I was just looking into this. Binding directly to the element is definitely the best solution for now. I will try to get this added to Gator, but legacy IE support is not super high priority since this library was really designed with modern browsers in mind.

In order to implement I would have to change the way some things work in Gator itself.

For reference

I was just looking at the jQuery source to see how they handle this and it looks like they do something where they listen for propertychange for checkboxes and radio inputs and simulate a change event on the parent.

For selects, inputs, and other form elements they attach a click event and then once the click bubbles up they attach a change event to the target element the click came from (so it is lazy loaded).

Once the change event is attached to the element it does not attach it again on subsequent clicks. Once the change fires on the target it simulates a change event.

@tomasdev
Copy link

According to http://caniuse.com/matchesselector it doesn't work in oldIE, and in the code, the polyfill Gator.matchesSelector is an empty function...

@ccampbell
Copy link
Owner

@tomasdev there is a legacy.js file that adds some of the old ie functionality, it is specifically the change event that doesn't work:

https://github.com/ccampbell/gator/blob/master/plugins/gator-legacy.js

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

No branches or pull requests

3 participants