@@ -232,29 +232,37 @@ export class BaseCustomWebComponentNoAttachedTemplate extends HTMLElement {
232232 b ( true , false ) ;
233233 }
234234 } else if ( a . value [ 0 ] === '{' && a . value [ 1 ] === '{' && a . value [ a . value . length - 1 ] === '}' && a . value [ a . value . length - 2 ] === '}' ) {
235- const attributeValues = a . value . substring ( 2 , a . value . length - 2 ) . split ( '::' ) ;
236- let nm = a . name ;
237- if ( nm [ 0 ] == '.' )
238- nm = nm . substring ( 1 ) ;
239- let value = attributeValues [ 0 ] ;
240- let event = ( node instanceof HTMLInputElement || node instanceof HTMLTextAreaElement ) ? 'input' : ( node instanceof HTMLSelectElement ? 'change' : nm + '-changed' ) ;
241- if ( attributeValues . length > 1 && attributeValues [ 1 ] )
242- event = attributeValues [ 1 ] ;
243- const camelCased = nm . replace ( / - ( [ a - z ] ) / g, ( g ) => g [ 1 ] . toUpperCase ( ) ) ;
244- let noNull = false ;
245- if ( value [ 0 ] === '?' ) {
246- value = value . substring ( 1 ) ;
247- noNull = true ;
248- }
249- const b = ( firstRun ?: boolean , onlyWhenChanged ?: boolean ) => this . _bindingSetNodeValue ( firstRun , node , a , camelCased , value , repeatBindingItems , removeAttributes , host , context , noNull , onlyWhenChanged ) ;
250- this . _bindings . push ( [ b , null ] ) ;
251- b ( true , false ) ;
252- if ( event ) {
253- for ( let x of event . split ( ';' ) ) {
254- if ( node [ x ] instanceof TypedEvent )
255- ( < TypedEvent < void > > node [ x ] ) . on ( ( e ) => this . _bindingsSetValue ( host ?? this , value . replaceAll ( '?' , '' ) , ( < HTMLInputElement > node ) [ camelCased ] , context , repeatBindingItems ) ) ;
256- else
257- node . addEventListener ( x , ( e ) => this . _bindingsSetValue ( host ?? this , value . replaceAll ( '?' , '' ) , ( < HTMLInputElement > node ) [ camelCased ] , context , repeatBindingItems ) ) ;
235+ if ( a . name [ 0 ] === '@' ) {
236+ const event = a . name . substring ( 1 ) ;
237+ if ( node [ event ] instanceof TypedEvent )
238+ ( < TypedEvent < void > > node [ event ] ) . on ( ( e ) => this . _bindingRunEvalInt ( a . value . substring ( 2 , a . value . length - 2 ) , repeatBindingItems , < any > e , context ) ) ;
239+ else
240+ node . addEventListener ( event , ( e ) => this . _bindingRunEvalInt ( a . value . substring ( 2 , a . value . length - 2 ) , repeatBindingItems , e , context ) ) ;
241+ } else {
242+ const attributeValues = a . value . substring ( 2 , a . value . length - 2 ) . split ( '::' ) ;
243+ let nm = a . name ;
244+ if ( nm [ 0 ] == '.' )
245+ nm = nm . substring ( 1 ) ;
246+ let value = attributeValues [ 0 ] ;
247+ let event = ( node instanceof HTMLInputElement || node instanceof HTMLTextAreaElement ) ? 'input' : ( node instanceof HTMLSelectElement ? 'change' : nm + '-changed' ) ;
248+ if ( attributeValues . length > 1 && attributeValues [ 1 ] )
249+ event = attributeValues [ 1 ] ;
250+ const camelCased = nm . replace ( / - ( [ a - z ] ) / g, ( g ) => g [ 1 ] . toUpperCase ( ) ) ;
251+ let noNull = false ;
252+ if ( value [ 0 ] === '?' ) {
253+ value = value . substring ( 1 ) ;
254+ noNull = true ;
255+ }
256+ const b = ( firstRun ?: boolean , onlyWhenChanged ?: boolean ) => this . _bindingSetNodeValue ( firstRun , node , a , camelCased , value , repeatBindingItems , removeAttributes , host , context , noNull , onlyWhenChanged ) ;
257+ this . _bindings . push ( [ b , null ] ) ;
258+ b ( true , false ) ;
259+ if ( event ) {
260+ for ( let x of event . split ( ';' ) ) {
261+ if ( node [ x ] instanceof TypedEvent )
262+ ( < TypedEvent < void > > node [ x ] ) . on ( ( e ) => this . _bindingsSetValue ( host ?? this , value . replaceAll ( '?' , '' ) , ( < HTMLInputElement > node ) [ camelCased ] , context , repeatBindingItems ) ) ;
263+ else
264+ node . addEventListener ( x , ( e ) => this . _bindingsSetValue ( host ?? this , value . replaceAll ( '?' , '' ) , ( < HTMLInputElement > node ) [ camelCased ] , context , repeatBindingItems ) ) ;
265+ }
258266 }
259267 }
260268 }
0 commit comments