@@ -8,7 +8,7 @@ import * as strings from 'vs/base/common/strings';
88import { IActionRunner , IAction , SubmenuAction , Separator , IActionViewItemProvider } from 'vs/base/common/actions' ;
99import { ActionBar , ActionsOrientation } from 'vs/base/browser/ui/actionbar/actionbar' ;
1010import { ResolvedKeybinding , KeyCode } from 'vs/base/common/keyCodes' ;
11- import { addClass , EventType , EventHelper , EventLike , removeTabIndexAndUpdateFocus , isAncestor , hasClass , addDisposableListener , removeClass , append , $ , addClasses , removeClasses , clearNode , createStyleSheet , isInShadowDOM , getActiveElement , Dimension , IDomNodePagePosition } from 'vs/base/browser/dom' ;
11+ import { EventType , EventHelper , EventLike , removeTabIndexAndUpdateFocus , isAncestor , addDisposableListener , append , $ , clearNode , createStyleSheet , isInShadowDOM , getActiveElement , Dimension , IDomNodePagePosition } from 'vs/base/browser/dom' ;
1212import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent' ;
1313import { RunOnceScheduler } from 'vs/base/common/async' ;
1414import { DisposableStore } from 'vs/base/common/lifecycle' ;
@@ -73,10 +73,10 @@ export class Menu extends ActionBar {
7373 protected styleSheet : HTMLStyleElement | undefined ;
7474
7575 constructor ( container : HTMLElement , actions : ReadonlyArray < IAction > , options : IMenuOptions = { } ) {
76- addClass ( container , 'monaco-menu-container' ) ;
76+ container . classList . add ( 'monaco-menu-container' ) ;
7777 container . setAttribute ( 'role' , 'presentation' ) ;
7878 const menuElement = document . createElement ( 'div' ) ;
79- addClass ( menuElement , 'monaco-menu' ) ;
79+ menuElement . classList . add ( 'monaco-menu' ) ;
8080 menuElement . setAttribute ( 'role' , 'presentation' ) ;
8181
8282 super ( menuElement , {
@@ -171,7 +171,7 @@ export class Menu extends ActionBar {
171171 target = target . parentElement ;
172172 }
173173
174- if ( hasClass ( target , 'action-item' ) ) {
174+ if ( target . classList . contains ( 'action-item' ) ) {
175175 const lastFocusedItem = this . focusedItem ;
176176 this . setFocusedItem ( target ) ;
177177
@@ -597,37 +597,37 @@ class BaseMenuActionViewItem extends BaseActionViewItem {
597597
598598 updateClass ( ) : void {
599599 if ( this . cssClass && this . item ) {
600- removeClasses ( this . item , this . cssClass ) ;
600+ this . item . classList . remove ( ... this . cssClass . split ( ' ' ) ) ;
601601 }
602602 if ( this . options . icon && this . label ) {
603603 this . cssClass = this . getAction ( ) . class || '' ;
604- addClass ( this . label , 'icon' ) ;
604+ this . label . classList . add ( 'icon' ) ;
605605 if ( this . cssClass ) {
606- addClasses ( this . label , this . cssClass ) ;
606+ this . label . classList . add ( ... this . cssClass . split ( ' ' ) ) ;
607607 }
608608 this . updateEnabled ( ) ;
609609 } else if ( this . label ) {
610- removeClass ( this . label , 'icon' ) ;
610+ this . label . classList . remove ( 'icon' ) ;
611611 }
612612 }
613613
614614 updateEnabled ( ) : void {
615615 if ( this . getAction ( ) . enabled ) {
616616 if ( this . element ) {
617- removeClass ( this . element , 'disabled' ) ;
617+ this . element . classList . remove ( 'disabled' ) ;
618618 }
619619
620620 if ( this . item ) {
621- removeClass ( this . item , 'disabled' ) ;
621+ this . item . classList . remove ( 'disabled' ) ;
622622 this . item . tabIndex = 0 ;
623623 }
624624 } else {
625625 if ( this . element ) {
626- addClass ( this . element , 'disabled' ) ;
626+ this . element . classList . add ( 'disabled' ) ;
627627 }
628628
629629 if ( this . item ) {
630- addClass ( this . item , 'disabled' ) ;
630+ this . item . classList . add ( 'disabled' ) ;
631631 removeTabIndexAndUpdateFocus ( this . item ) ;
632632 }
633633 }
@@ -639,11 +639,11 @@ class BaseMenuActionViewItem extends BaseActionViewItem {
639639 }
640640
641641 if ( this . getAction ( ) . checked ) {
642- addClass ( this . item , 'checked' ) ;
642+ this . item . classList . add ( 'checked' ) ;
643643 this . item . setAttribute ( 'role' , 'menuitemcheckbox' ) ;
644644 this . item . setAttribute ( 'aria-checked' , 'true' ) ;
645645 } else {
646- removeClass ( this . item , 'checked' ) ;
646+ this . item . classList . remove ( 'checked' ) ;
647647 this . item . setAttribute ( 'role' , 'menuitem' ) ;
648648 this . item . setAttribute ( 'aria-checked' , 'false' ) ;
649649 }
@@ -658,7 +658,7 @@ class BaseMenuActionViewItem extends BaseActionViewItem {
658658 return ;
659659 }
660660
661- const isSelected = this . element && hasClass ( this . element , 'focused' ) ;
661+ const isSelected = this . element && this . element . classList . contains ( 'focused' ) ;
662662 const fgColor = isSelected && this . menuStyle . selectionForegroundColor ? this . menuStyle . selectionForegroundColor : this . menuStyle . foregroundColor ;
663663 const bgColor = isSelected && this . menuStyle . selectionBackgroundColor ? this . menuStyle . selectionBackgroundColor : undefined ;
664664 const border = isSelected && this . menuStyle . selectionBorderColor ? `thin solid ${ this . menuStyle . selectionBorderColor } ` : '' ;
@@ -726,7 +726,7 @@ class SubmenuMenuActionViewItem extends BaseMenuActionViewItem {
726726 }
727727
728728 if ( this . item ) {
729- addClass ( this . item , 'monaco-submenu-item' ) ;
729+ this . item . classList . add ( 'monaco-submenu-item' ) ;
730730 this . item . setAttribute ( 'aria-haspopup' , 'true' ) ;
731731 this . updateAriaExpanded ( 'false' ) ;
732732 this . submenuIndicator = append ( this . item , $ ( 'span.submenu-indicator' + menuSubmenuIcon . cssSelector ) ) ;
@@ -841,7 +841,7 @@ class SubmenuMenuActionViewItem extends BaseMenuActionViewItem {
841841 if ( ! this . parentData . submenu ) {
842842 this . updateAriaExpanded ( 'true' ) ;
843843 this . submenuContainer = append ( this . element , $ ( 'div.monaco-submenu' ) ) ;
844- addClasses ( this . submenuContainer , 'menubar-menu-items-holder' , 'context-view' ) ;
844+ this . submenuContainer . classList . add ( 'menubar-menu-items-holder' , 'context-view' ) ;
845845
846846 // Set the top value of the menu container before construction
847847 // This allows the menu constructor to calculate the proper max height
@@ -919,7 +919,7 @@ class SubmenuMenuActionViewItem extends BaseMenuActionViewItem {
919919 return ;
920920 }
921921
922- const isSelected = this . element && hasClass ( this . element , 'focused' ) ;
922+ const isSelected = this . element && this . element . classList . contains ( 'focused' ) ;
923923 const fgColor = isSelected && this . menuStyle . selectionForegroundColor ? this . menuStyle . selectionForegroundColor : this . menuStyle . foregroundColor ;
924924
925925 if ( this . submenuIndicator ) {
0 commit comments