@@ -100,6 +100,7 @@ export class JigsawTrustedHtml implements OnInit, OnDestroy {
100100
101101 private _contextMagicNumber : number = - 1 ;
102102 private _trustedHtmlContext : any ;
103+ private _initialized : boolean = false ;
103104
104105 @Input ( )
105106 public get trustedHtmlContext ( ) : any {
@@ -132,12 +133,12 @@ export class JigsawTrustedHtml implements OnInit, OnDestroy {
132133 private _modifiedHtml :string ;
133134
134135 private _updateHtml ( ) :void {
135- if ( ! this . _trustedHtml ) {
136+ if ( ! this . _trustedHtml || ! this . _initialized ) {
136137 return ;
137138 }
138139 const modifiedHtml = ! this . _trustedHtmlContext ? this . _trustedHtml : this . _trustedHtml
139- . replace ( / o n ( \w + ) \s * = ( [ ' " ] ) \s * ( [ _ $ a - z ] [ _ $ a - z 0 - 9 ] * ) \s * \( ( .* ?) \) / ig,
140- ( found , event , quot , func , args ) => {
140+ . replace ( / ( o n | \( ) ( \w + ) \) ? \s * = ( [ ' " ] ) \s * ( [ _ $ a - z ] [ _ $ a - z 0 - 9 ] * ) \s * \( ( .* ?) \) / ig,
141+ ( found , prefix , event , quot , func , args ) => {
141142 JigsawTrustedHtml . _declareCallback ( this . _trustedHtmlContext , func , this . _trustedHtmlContext [ func ] ) ;
142143 const modified = `on${ event } =${ quot } _jigsawInternalCallbackWrapper("${ func } ",${ this . _contextMagicNumber } ` ;
143144 args = CommonUtils . isDefined ( args ) ? args . trim ( ) : '' ;
@@ -162,6 +163,7 @@ export class JigsawTrustedHtml implements OnInit, OnDestroy {
162163 }
163164
164165 ngOnInit ( ) {
166+ this . _initialized = true ;
165167 this . _updateHtml ( ) ;
166168 }
167169
0 commit comments