File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @author.io/element-control" ,
3- "version" : " 1.0.8 " ,
3+ "version" : " 1.0.9 " ,
44 "description" : " author-control custom element (web component)." ,
55 "main" : " dist/author-control.min.js" ,
66 "scripts" : {
Original file line number Diff line number Diff line change @@ -67,7 +67,6 @@ class AuthorFormControlElement extends AuthorBaseElement(HTMLElement) {
6767 this . type = 'select'
6868
6969 if ( ! customElements . get ( 'author-datalist' ) ) {
70- console . dir ( input ) ;
7170 input . id = this . PRIVATE . guid
7271 datalist . id = `${ input . id } _datalist`
7372 input . setAttribute ( 'list' , datalist . id )
@@ -103,7 +102,12 @@ class AuthorFormControlElement extends AuthorBaseElement(HTMLElement) {
103102 this . removeChild ( datalist )
104103 this . removeChild ( input )
105104
106- surrogate . inject ( input , datalist , this . PRIVATE . guid )
105+ // Use a select as sourceElement to preserve option indexes, since
106+ // datalist doesn't assign indexes to child options
107+ let select = document . createElement ( 'select' )
108+ Array . from ( datalist . children ) . forEach ( option => select . add ( option ) )
109+
110+ surrogate . inject ( input , select , this . PRIVATE . guid )
107111 this . appendChild ( surrogate )
108112 this . PRIVATE . input = surrogate
109113 } ,
You can’t perform that action at this time.
0 commit comments