Skip to content

Make awesomplete instance awailable on input element - #16868

Open
vlazar wants to merge 1 commit into
nudeui:gh-pagesfrom
vlazar:feature/awesomplete-instance-on-input
Open

Make awesomplete instance awailable on input element#16868
vlazar wants to merge 1 commit into
nudeui:gh-pagesfrom
vlazar:feature/awesomplete-instance-on-input

Conversation

@vlazar

@vlazar vlazar commented Mar 13, 2016

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
Collaborator

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

vlazar commented Mar 14, 2016

Copy link
Copy Markdown
Collaborator Author

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
Copy Markdown
Collaborator

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.

2 participants