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

React to mutations in original <datalist> #16923

Open
petephm opened this issue Jul 22, 2016 · 15 comments
Open

React to mutations in original <datalist> #16923

petephm opened this issue Jul 22, 2016 · 15 comments

Comments

@petephm
Copy link

petephm commented Jul 22, 2016

Hi Lea,

Is there a destroy method for Awesomplete?

@vlazar
Copy link
Collaborator

vlazar commented Jul 22, 2016

No.

@LeaVerou
Copy link
Owner

Perhaps we should add one, it would be pretty short I think.

@petephm
Copy link
Author

petephm commented Jul 22, 2016

I could really use a destroy method

@LeaVerou
Copy link
Owner

Do you want to describe your use case a bit? It would help.

@petephm
Copy link
Author

petephm commented Jul 22, 2016

Sorry, so I've got a select input which "filters" the autocomplete results of the awesomplete input.

I'm disabling items in the datalist that don't match the selected filter. However making changes to the initial datalist after awesomplete has been initialised doesn't hide those options.

There's probably a better way but, I was going to destroy the original awesomplete instance and then reinitialise with the disabled options?

@LeaVerou
Copy link
Owner

Yes, there is :) You could set the .list property of the Awesomplete instance. However, a better way to solve this would be for us to add a mutation observer that observes changes to the original list's childList and automatically updates the list property. @vlazar any chance you have time for this? I'm swamped :(

@petephm
Copy link
Author

petephm commented Jul 22, 2016

Ahh!! Yea didn't think of that, I need to sleep haha. Yeah that would be awesome. Thanks for your help :)

@TxHawks
Copy link
Contributor

TxHawks commented Jul 22, 2016

A mutation observer would be a nicer solution, but unfortunately, it is
only support in ie11 and up

On Fri, Jul 22, 2016, 19:37 Peter Pham [email protected] wrote:

Ahh!! Yea didn't think of that, I need to sleep haha. Yeah that would be
awesome. Thanks for your help :)


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#16923 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFZXkvxg-WMyufRTKaYBFYDrfP4oUQtDks5qYPGtgaJpZM4JSips
.

@LeaVerou
Copy link
Owner

LeaVerou commented Jul 22, 2016

A mutation observer would be a nicer solution, but unfortunately, it is only support in ie11 and up

Whoever is supporting IE10 and below is wasting their time. Check the actual usage stats, they are about 0.5% for each version of IE.

@vlazar
Copy link
Collaborator

vlazar commented Jul 22, 2016

@vlazar any chance you have time for this? I'm swamped :(

Same here right now :( I can take a look at this as soon I have time, but we have much older issues to deal with.

Whoever is supporting IE10 and below is wasting their time. Check the actual usage stats.

LOL, Lea :) #16821 (comment)

Does it mean we can drop IE10 support and related hacks in code?

@LeaVerou
Copy link
Owner

Does it mean we can drop IE10 support and related hacks in code?

Do we have many of those? I think we can wait a bit for that, but let's not expend more energy supporting obsolete crap, especially for features that not everyone uses like this one. Checking if self.MutationObserver is defined so that there are no errors in IE10- is sufficient.

@LeaVerou LeaVerou changed the title Destroy Method? React to mutations in original <datalist> Jul 22, 2016
@vlazar
Copy link
Collaborator

vlazar commented Jul 22, 2016

As far as I remember these hacks were much simpler without IE10 support https://github.com/LeaVerou/awesomplete/blob/gh-pages/awesomplete.js#L298-L311

@LeaVerou
Copy link
Owner

Oh, because of __proto__, right? Well, we did the work now, so no point rushing to revert it. But going forward, when it's a non-critical feature, let's just aim at not throwing errors in IE10.

@nunoarruda
Copy link

nunoarruda commented Jul 24, 2016

I just got into a situation where I need a way to un-instantiate Awesomplete. I have a country select list and I use Awesomplete to show post codes suggestions only when the country is Australia. So I need to un-instantiate Awesomplete when the country is not Australia.

@vedraj
Copy link

vedraj commented Aug 3, 2016

Does it update datalist if user type a new word ?

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

No branches or pull requests

6 participants