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

Make awesomplete instance awailable on input element #16868

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from

Conversation

vlazar
Copy link
Collaborator

@vlazar vlazar commented Mar 13, 2016

Having Awesomplete instance available in events as this.awesompelete will handy.
Discussed here #16821 (comment)

// in all event handlers:
var me = this.awesomplete;

me.ul.children[me.index]; // selected <li> DOM node
me.suggestions[me.index]; // selected suggestion item

// and so on...

@vlazar vlazar added this to the v1.1 milestone Mar 13, 2016
@LeaVerou
Copy link
Owner

How about a WeakMap on Awesomplete? Then to get the instance you'd do something like Awesomplete.inputs.get(element). Then we don't need to add properties to elements, which many people have a knee jerk reaction against.
Also, if we do end up making Bliss a dependency, we can add it to element._.

@vlazar
Copy link
Collaborator Author

vlazar commented Mar 14, 2016

We've discussed WeakMap before. I thought it wasn't an option for the nearest future with current support in browsers. #16821 (comment)

@LeaVerou
Copy link
Owner

As long as it's not used internally, people can always choose whether they want to use it or not and take the reduced browser support (or include a polyfill).
I’m not against having auxillary features with different browser support if it's clearly indicated in the docs.
We would, however, need to check for it before using it, to avoid breakage in environments where it's not supported.

@vlazar vlazar modified the milestones: V1.2, v1.1 Mar 16, 2016
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