estaminet
Version:
A set of WebComponents building on top of Statemint family of Polkadot parachains
20 lines (19 loc) • 524 B
JavaScript
export function getAttributeAsNumber(el, attributeName) {
const attribute = el.getAttribute(attributeName);
if (attribute) {
return Number.parseInt(attribute);
}
return null;
}
export function setAttribute(el, attributeName, attributeValue) {
if (attributeValue) {
el.setAttribute(attributeName, attributeValue.toString());
}
else {
el.removeAttribute(attributeName);
}
return null;
}
export function clearShadowRoot(shadowRoot) {
shadowRoot.innerHTML = '';
}