From c6081acada1eeccbf93345cffa7e56e8471d64b2 Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Mon, 30 Jun 2025 11:06:00 +0400 Subject: [PATCH] Add __clearAttributes to ComponentView --- .../core/src/dom_components/view/ComponentView.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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