feat(templating): only assign standard DOM props

This commit is contained in:
Ayo 2023-12-09 02:05:32 +01:00
parent 6844ffe9f2
commit 669fee1d49
3 changed files with 4 additions and 4 deletions

View file

@ -8,9 +8,9 @@ export class Counter extends WebComponent {
return html` return html`
<button <button
class="hey" class="hey"
ID="btn" id="btn"
onClick=${() => ++this.props.count} onClick=${() => ++this.props.count}
style="background-color: black; color: white;" style="background-color: green; color: white;"
about="Elephant" about="Elephant"
> >
<span>${this.props.count}</span> <span>${this.props.count}</span>

View file

@ -1,6 +1,6 @@
{ {
"name": "web-component-base", "name": "web-component-base",
"version": "2.0.0-beta.16", "version": "2.0.0-beta.17",
"description": "A zero-dependency, ~600 Bytes (minified & gzipped), JS base class for creating reactive custom elements easily", "description": "A zero-dependency, ~600 Bytes (minified & gzipped), JS base class for creating reactive custom elements easily",
"type": "module", "type": "module",
"exports": { "exports": {

View file

@ -20,7 +20,7 @@ export function createElement(tree) {
case 'class': domProp = 'className'; break; case 'class': domProp = 'className'; break;
case 'for': domProp = 'htmlFor'; break; case 'for': domProp = 'htmlFor'; break;
} }
el[domProp] = tree.props[prop] if (domProp in el) el[domProp] = tree.props[prop]
} }
}) })
} }