@@ -193,15 +193,9 @@ class AuthorFormControlElement extends AuthorBaseElement(HTMLElement) {
193193 }
194194
195195 this . PRIVATE . initSelectSurrogate ( select , document . createElement ( 'author-select' ) )
196- }
197- } )
198-
199- this . UTIL . monitorChildren ( ( mutations , observer ) => {
200- let filtered = mutations . filter ( record => record . addedNodes . item ( 0 ) . nodeType !== 3 )
201-
202- filtered . forEach ( ( record , index , array ) => {
203- let node = record . addedNodes . item ( 0 )
196+ } ,
204197
198+ transformChild : node => {
205199 switch ( node . nodeName ) {
206200 case 'LABEL' :
207201 return this . PRIVATE . initLabel ( node )
@@ -212,7 +206,7 @@ class AuthorFormControlElement extends AuthorBaseElement(HTMLElement) {
212206 return this . PRIVATE . initInput ( node )
213207 }
214208
215- let adjacentElement = array [ index + 1 ] . addedNodes . item ( 0 )
209+ let adjacentElement = array [ index + 1 ] . addedNodes . item ( 0 ) ;
216210
217211 if ( ! adjacentElement || adjacentElement . nodeName !== 'DATALIST' ) {
218212 return this . PRIVATE . initInput ( node )
@@ -231,16 +225,25 @@ class AuthorFormControlElement extends AuthorBaseElement(HTMLElement) {
231225 return this . PRIVATE . initMultipleSelectMenu ( node )
232226
233227 default :
234- this . initialValue = node . value
228+ this . initialValue = node . value ;
235229 return
236230 }
231+ }
232+ } )
233+
234+ this . UTIL . monitorChildren ( ( mutations , observer ) => {
235+ let filtered = mutations . filter ( record => record . addedNodes . item ( 0 ) . nodeType !== 3 )
236+
237+ filtered . forEach ( ( record , index , array ) => {
238+ this . PRIVATE . transformChild ( record . addedNodes . item ( 0 ) )
237239 } )
238240
239241 observer . disconnect ( )
240242 } )
241243
242244 this . UTIL . registerListeners ( this , {
243- connected : ( ) => this . PRIVATE . guid = this . UTIL . generateGuid ( 'control_' )
245+ connected : ( ) => this . PRIVATE . guid = this . UTIL . generateGuid ( 'control_' ) ,
246+ rendered : ( ) => Array . from ( this . children ) . forEach ( child => this . PRIVATE . transformChild ( child ) )
244247 } )
245248 }
246249
0 commit comments