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
targetthough.Since an
awesomplete-selectis fired on INPUT, inside itthis,event.targetandevent.currentTargetare references to INPUT originally. In clicktargetis a reference to clicked element, but inawesomplete-selectit may be misleading.Eventually we need to pass 2 elements to
awesomplete-selectevent for new features:I can't come up with good aligned names for those 2 new fields in
awesomplete-selectevent.Any ideas?