Skip to content

Commit 97d15e0

Browse files
committed
visibility binding should also work for flex childs
1 parent 812a937 commit 97d15e0

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"description": "Base Custom Webcomponent",
33
"name": "@node-projects/base-custom-webcomponent",
4-
"version": "0.27.0",
4+
"version": "0.27.1",
55
"type": "module",
66
"main": "./dist/index.js",
77
"author": "",

src/BaseCustomWebComponent.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,15 @@ export class BaseCustomWebComponentNoAttachedTemplate extends HTMLElement {
190190
b();
191191
} else if (a.name.startsWith('bcw:')) {
192192
if (a.name === 'bcw:visible') {
193-
const value = a.value.substring(2, a.value.length - 2).replaceAll('&', '&') + "?'visible':'collapse'";
194-
const b = () => this._bindingSetElementCssValue(<HTMLElement | SVGElement>node, 'visibility', value, repeatBindingItems, host, context);
195-
this._bindings.push([b, null]);
196-
b();
193+
const value = a.value.substring(2, a.value.length - 2).replaceAll('&amp;', '&');
194+
const b1 = () => this._bindingSetElementCssValue(<HTMLElement | SVGElement>node, 'visibility', value + "?'':'collapse'", repeatBindingItems, host, context);
195+
const b2 = () => this._bindingSetElementCssValue(<HTMLElement | SVGElement>node, 'content-visibility' + "?'':'hidden'", value, repeatBindingItems, host, context);
196+
this._bindings.push([b1, null]);
197+
this._bindings.push([b2, null]);
198+
b1();
199+
b2();
197200
}
198-
}else if (a.name.length === 28 && a.name === 'repeat-changed-item-callback') {
201+
} else if (a.name.length === 28 && a.name === 'repeat-changed-item-callback') {
199202
//do nothing
200203
} else if (a.name === 'if' && node instanceof HTMLTemplateElement) {
201204
const value = a.value.substring(2, a.value.length - 2).replaceAll('&amp;', '&');

0 commit comments

Comments
 (0)