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
Feature/pass target to awesomplete select #16819
Feature/pass target to awesomplete select #16819
Conversation
I think that
|
With this PR and your #16795 landing it will be easier to do a frequently requested key/value (aka arrays of objects) feature among other things. |
It wasn't cut, just had a typo. The last Tjanky you for doing all this work, by the way |
Maybe an Btw, minor code nitpick: Please don't use variables when they are only used once. It's an indirection for humans reading the code (as they need to pointlessly look up the variable definition) and bloats the code size too. In this case, using |
I've been thinking about using
I'll change this. Wasn't intended as a way to save a property reference though. The |
How about an |
Maybe The more I think about it, // existing option; I prefer to replace/deprecate it in 2.0 with next option
text: itemText,
// most useful property (text when items are strings, object if items are array of objects)
item: itemTextOrItemObject,
// allows to do something with selected element
// less useful, especially if item property above added
element: selectedItemElement,
// very specific use case
// the least useful, if at all
// maybe there is a better way for original use case for added `originalEvent` option
origin: clickedChildOfItemElement |
@LeaVerou Can you please look at PR in the current state, and if you can't think of better name I'll clean this up and merge? And my comment above #16819 (comment) with possible properties for next PRs. I think |
I'm a bit confused with all the PRs, but I just left a comment in the other one. |
Sorry for confusion. Just let me know if this PR should be merged. This PR is only about 2 & 3 as you already agreed in #16818 (comment) |
Sure, this is fine. |
Closing in favor of #16823 |
Addresses #16818
I'm not happy with option named
target
though.Since an
awesomplete-select
is fired on INPUT, inside itthis
,event.target
andevent.currentTarget
are references to INPUT originally. In clicktarget
is a reference to clicked element, but inawesomplete-select
it may be misleading.Eventually we need to pass 2 elements to
awesomplete-select
event for new features:I can't come up with good aligned names for those 2 new fields in
awesomplete-select
event.Any ideas?