diff --git a/packages/core/src/dom_components/view/ComponentView.ts b/packages/core/src/dom_components/view/ComponentView.ts index f21ca4d99..6658467f1 100644 --- a/packages/core/src/dom_components/view/ComponentView.ts +++ b/packages/core/src/dom_components/view/ComponentView.ts @@ -360,9 +360,7 @@ TComp> { ...(textable && { contenteditable: 'false' }), }; - // Remove all current attributes - each(el.attributes, (attr) => attrs.push(attr.nodeName)); - attrs.forEach((attr) => $el.removeAttr(attr)); + this.__clearAttributes(); this.updateStyle(); this.updateHighlight(); const attr = { @@ -376,6 +374,13 @@ TComp> { $el.attr(attr); } + __clearAttributes() { + const { el, $el } = this; + const attrs: string[] = []; + each(el.attributes, (attr) => attrs.push(attr.nodeName)); + attrs.forEach((attr) => $el.removeAttr(attr)); + } + /** * Update component content * @private