nude-element
Advanced tools
Comparing version 0.0.3 to 0.0.4
{ | ||
"name": "nude-element", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Composable web component helpers", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -96,3 +96,13 @@ import { | ||
initializeFor (element) { | ||
if (element.props[this.name] === undefined && !this.defaultProp) { | ||
// Handle any properties already set before initialization | ||
let name = this.name; | ||
if (Object.hasOwn(element, name)) { | ||
// A local data property will shadow the accessor that is defined on the prototype | ||
// See https://github.com/nudeui/element/issues/14 | ||
let value = element[name]; | ||
delete element[name]; // Deleting the data property will uncover the accessor | ||
element[name] = value; // Invoking the accessor means the value doesn't skip parsing | ||
} | ||
else if (element.props[name] === undefined && !this.defaultProp) { | ||
// Is not set and its default is not another prop | ||
@@ -99,0 +109,0 @@ this.changed(element, {source: "default", element}); |
@@ -5,2 +5,2 @@ # Nude Slots | ||
- Allows combining manual and named slot assignment | ||
- Allows slotting via CSS selector (Use `data-assign` on the slot) | ||
- Allows slotting via CSS selector (Use `data-assign` on the slot element) |
49271
1147