Skip to content

Commit 139323e

Browse files
authored
refactor: use setProperty API directly instead of helper (#11491)
## Description Since `setProperty('--_custom-property', null)` removes the custom property from the style, there is no need to use `removeProperty`, so the `__updateStyleProperty` helper can be dropped. Part of #11348 ## Type of change - [x] Refactor
1 parent fd3c2a9 commit 139323e

1 file changed

Lines changed: 6 additions & 15 deletions

File tree

packages/master-detail-layout/src/vaadin-master-detail-layout.js

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ class MasterDetailLayout extends ElementMixin(ThemableMixin(PolylitMixin(LitElem
272272

273273
/** @private */
274274
__masterSizeChanged(size, oldSize) {
275-
this.__updateStyleProperty('master-size', size, oldSize);
275+
this.style.setProperty('--_master-size', size);
276276

277277
if (oldSize != null) {
278278
this.recalculateLayout();
@@ -281,7 +281,7 @@ class MasterDetailLayout extends ElementMixin(ThemableMixin(PolylitMixin(LitElem
281281

282282
/** @private */
283283
__detailSizeChanged(size, oldSize) {
284-
this.__updateStyleProperty('detail-size', size, oldSize);
284+
this.style.setProperty('--_detail-size', size);
285285

286286
if (oldSize != null) {
287287
this.recalculateLayout();
@@ -296,22 +296,13 @@ class MasterDetailLayout extends ElementMixin(ThemableMixin(PolylitMixin(LitElem
296296
}
297297

298298
/** @private */
299-
__overlaySizeChanged(size, oldSize) {
300-
this.__updateStyleProperty('overlay-size', size, oldSize);
299+
__overlaySizeChanged(size) {
300+
this.style.setProperty('--_overlay-size', size);
301301
}
302302

303303
/** @private */
304-
__detailCachedSizeChanged(size, oldSize) {
305-
this.__updateStyleProperty('detail-cached-size', size, oldSize);
306-
}
307-
308-
/** @private */
309-
__updateStyleProperty(prop, size, oldSize) {
310-
if (size) {
311-
this.style.setProperty(`--_${prop}`, size);
312-
} else if (oldSize) {
313-
this.style.removeProperty(`--_${prop}`);
314-
}
304+
__detailCachedSizeChanged(size) {
305+
this.style.setProperty('--_detail-cached-size', size);
315306
}
316307

317308
/** @private */

0 commit comments

Comments
 (0)