File tree Expand file tree Collapse file tree
src/vs/base/browser/ui/checkbox Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ export class Checkbox extends Widget {
4545
4646 this . domNode = document . createElement ( 'div' ) ;
4747 this . domNode . title = this . _opts . title ;
48- this . domNode . className = this . _className ( ) ;
48+ this . domNode . className = 'custom-checkbox ' + this . _opts . actionClassName + ' ' + ( this . _checked ? 'checked' : 'unchecked' ) ;
4949 this . domNode . tabIndex = 0 ;
5050 this . domNode . setAttribute ( 'role' , 'checkbox' ) ;
5151 this . domNode . setAttribute ( 'aria-checked' , String ( this . _checked ) ) ;
@@ -88,12 +88,13 @@ export class Checkbox extends Widget {
8888 public set checked ( newIsChecked : boolean ) {
8989 this . _checked = newIsChecked ;
9090 this . domNode . setAttribute ( 'aria-checked' , String ( this . _checked ) ) ;
91- this . domNode . className = this . _className ( ) ;
92- this . applyStyles ( ) ;
93- }
91+ if ( this . _checked ) {
92+ this . domNode . classList . add ( 'checked' ) ;
93+ } else {
94+ this . domNode . classList . remove ( 'checked' ) ;
95+ }
9496
95- private _className ( ) : string {
96- return 'custom-checkbox ' + this . _opts . actionClassName + ' ' + ( this . _checked ? 'checked' : 'unchecked' ) ;
97+ this . applyStyles ( ) ;
9798 }
9899
99100 public width ( ) : number {
You can’t perform that action at this time.
0 commit comments