mirror of
https://github.com/jaandrle/deka-dom-el
synced 2024-11-22 16:55:23 +01:00
Update customElement.js
This commit is contained in:
parent
89f9880277
commit
6f5e13e66a
@ -43,6 +43,10 @@ function observedAttribute(instance, name){
|
||||
export function observedAttributes(instance){
|
||||
const { observedAttributes= [] }= instance.constructor;
|
||||
return observedAttributes
|
||||
.map(name=> [ name.replace(/-./g, x=> x[1].toUpperCase()), name ])
|
||||
.reduce((out, [ key, name ])=> ( Reflect.set(out, key, observedAttribute(instance, name)), out ), {});
|
||||
.reduce(function(out, name){
|
||||
Reflect.set(out, kebabToCamel(name), observedAttribute(instance, name));
|
||||
return out;
|
||||
}, {});
|
||||
;
|
||||
}
|
||||
function kebabToCamel(name){ return name.replace(/-./g, x=> x[1].toUpperCase()); }
|
||||
|
Loading…
Reference in New Issue
Block a user