File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -253,8 +253,12 @@ const styles: CSSResultGroup = [
253253 /* Electron v31+ (VS Code 1.95+) on Chromium 125 supports :state():
254254 https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Selectors/:state#browser_compatibility
255255 Update to Chromium to 126.0.6445.0: https://github.com/electron/electron/releases/tag/v31.0.0-beta.1
256- https://github.com/microsoft/vscode/blob/1.95.0/package.json#L155 */
257- : host ( : state ( has-decoration ) ) . decoration {
256+ https://github.com/microsoft/vscode/blob/1.95.0/package.json#L155
257+ Back-compat: older Chromium builds only understand the :--state form, so we
258+ mirror the state under --has-decoration as well. */
259+ : host ( : --has-decoration ) . decoration ,
260+ : host ( : state ( has-decoration ) ) . decoration ,
261+ : host ( : state ( --has-decoration ) ) . decoration {
258262 display : inline-flex;
259263 }
260264
Original file line number Diff line number Diff line change @@ -253,21 +253,24 @@ export class VscodeTreeItem extends VscElement {
253253 }
254254
255255 private _setCustomState ( stateName : string , present : boolean ) {
256- const identifiers = stateName . startsWith ( '--' )
257- ? [ stateName ]
258- : [ stateName , `--${ stateName } ` ] ;
259-
260- identifiers . forEach ( ( identifier ) => {
261- try {
262- if ( present ) {
263- this . _internals . states . add ( identifier ) ;
264- } else {
265- this . _internals . states . delete ( identifier ) ;
266- }
267- } catch {
268- // Older runtimes that only support :--state throw; ignore silently.
256+ if ( ! this . _internals ?. states ) {
257+ return ;
258+ }
259+
260+ try {
261+ if ( present ) {
262+ this . _internals . states . add ( stateName ) ;
263+ } else {
264+ this . _internals . states . delete ( stateName ) ;
269265 }
270- } ) ;
266+ } catch {
267+ // https://developer.mozilla.org/en-US/docs/Web/API/CustomStateSet#compatibility_with_dashed-ident_syntax
268+ if ( present ) {
269+ this . _internals . states . add ( `--${ stateName } ` ) ;
270+ } else {
271+ this . _internals . states . delete ( `--${ stateName } ` ) ;
272+ }
273+ }
271274 }
272275
273276 private _getActiveElement ( ) : Element | null {
You can’t perform that action at this time.
0 commit comments