@@ -130,7 +130,8 @@ export class RadioButton extends Component<HTMLInputElement> implements INotifyP
130130
131131 private changeHandler ( event : Event ) : void {
132132 this . checked = true ; this . dataBind ( ) ;
133- let value : string = this . isVue ? this . element . value : this . value ;
133+ let value : string = this . element . getAttribute ( 'value' ) ;
134+ value = this . isVue && value ? this . element . value : this . value ;
134135 this . trigger ( 'change' , < ChangeArgs > { value : value , event : event } ) ;
135136 if ( this . tagName === 'EJS-RADIOBUTTON' ) {
136137 event . stopPropagation ( ) ;
@@ -181,7 +182,10 @@ export class RadioButton extends Component<HTMLInputElement> implements INotifyP
181182 }
182183
183184 private focusOutHandler ( ) : void {
184- this . getLabel ( ) . classList . remove ( 'e-focus' ) ;
185+ let label : Element = this . getLabel ( ) ;
186+ if ( label ) {
187+ label . classList . remove ( 'e-focus' ) ;
188+ }
185189 }
186190
187191 protected getModuleName ( ) : string {
@@ -215,7 +219,11 @@ export class RadioButton extends Component<HTMLInputElement> implements INotifyP
215219 }
216220
217221 private getLabel ( ) : Element {
218- return this . element . nextElementSibling ;
222+ if ( this . element ) {
223+ return this . element . nextElementSibling ;
224+ } else {
225+ return null ;
226+ }
219227 }
220228
221229 private initialize ( ) : void {
@@ -227,10 +235,11 @@ export class RadioButton extends Component<HTMLInputElement> implements INotifyP
227235 if ( this . name ) {
228236 this . element . setAttribute ( 'name' , this . name ) ;
229237 }
230- if ( this . isVue && this . element . value && this . element . value === this . value ) {
238+ let value : string = this . element . getAttribute ( 'value' ) ;
239+ if ( this . isVue && value && value === this . value ) {
231240 this . checked = true ;
232241 }
233- if ( this . value && ( ! this . isVue || ! this . element . value ) ) {
242+ if ( this . isVue ? this . value && ! value : this . value ) {
234243 this . element . setAttribute ( 'value' , this . value ) ;
235244 }
236245 if ( this . checked ) {
@@ -393,18 +402,20 @@ export class RadioButton extends Component<HTMLInputElement> implements INotifyP
393402
394403 private setText ( text : string ) : void {
395404 let label : Element = this . getLabel ( ) ;
396- let textLabel : Element = label . getElementsByClassName ( LABEL ) [ 0 ] ;
397- if ( textLabel ) {
398- textLabel . textContent = text ;
399- } else {
400- text = ( this . enableHtmlSanitizer ) ? SanitizeHtmlHelper . sanitize ( text ) : text ;
401- textLabel = this . createElement ( 'span' , { className : LABEL , innerHTML : text } ) ;
402- label . appendChild ( textLabel ) ;
403- }
404- if ( this . labelPosition === 'Before' ) {
405- this . getLabel ( ) . classList . add ( 'e-right' ) ;
406- } else {
407- this . getLabel ( ) . classList . remove ( 'e-right' ) ;
405+ if ( label ) {
406+ let textLabel : Element = label . getElementsByClassName ( LABEL ) [ 0 ] ;
407+ if ( textLabel ) {
408+ textLabel . textContent = text ;
409+ } else {
410+ text = ( this . enableHtmlSanitizer ) ? SanitizeHtmlHelper . sanitize ( text ) : text ;
411+ textLabel = this . createElement ( 'span' , { className : LABEL , innerHTML : text } ) ;
412+ label . appendChild ( textLabel ) ;
413+ }
414+ if ( this . labelPosition === 'Before' ) {
415+ this . getLabel ( ) . classList . add ( 'e-right' ) ;
416+ } else {
417+ this . getLabel ( ) . classList . remove ( 'e-right' ) ;
418+ }
408419 }
409420 }
410421
0 commit comments