UNPKG

taggedjs

Version:

tagged template reactive html

36 lines 1.51 kB
// taggedjs-no-compile import { BasicTypes } from '../../tag/ValueTypes.enum.js'; import { paintContent } from '../../render/paint.function.js'; import { processNameOnlyAttrValue } from '../../render/attributes/processAttribute.function.js'; import { isNoDisplayValue } from '../../render/attributes/isNoDisplayValue.function.js'; export function updateNameOnlyAttrValue(values, attrValue, lastValue, element, ownerSupport, howToSet, context) { // check to remove previous attribute(s) if (lastValue) { if (isNoDisplayValue(attrValue)) { element.removeAttribute(lastValue); return; } if (typeof (lastValue) === BasicTypes.object) { const isObStill = typeof (attrValue) === BasicTypes.object; if (isObStill) { for (const name in lastValue) { // if((attrValue as any)[name]) { if (name in attrValue) { continue; } paintContent.push([removeAttribute, [element, name]]); } } else { for (const name in lastValue) { paintContent.push([removeAttribute, [element, name]]); } } } } processNameOnlyAttrValue(values, attrValue, element, ownerSupport, howToSet, context); } function removeAttribute(element, name) { element.removeAttribute(name); } //# sourceMappingURL=updateAttribute.function.js.map