Skip to content

Commit 580444b

Browse files
committed
fix attribute changed
1 parent 98ac662 commit 580444b

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@node-projects/svghmi.webcomponent",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"description": "a svghmi webcomponent.",
55
"type": "module",
66
"main": "./dist/index.js",

src/SvgHmi.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,18 @@ export class SvgHmi extends BaseCustomWebComponentConstructorAppend {
4242
this._restoreCachedInititalValues();
4343

4444
this._mutationObserver = new MutationObserver(mutations => {
45-
this._parseAttributesToProperties();
45+
for (let m of mutations) {
46+
if (m.type == 'attributes') {
47+
if (m.attributeName == 'src')
48+
this.src = this.getAttribute('src');
49+
else {
50+
const prp = this._svgHmiProperties.get(m.attributeName);
51+
if (prp != null) {
52+
this['__' + prp.name] = this.getAttribute(m.attributeName);
53+
}
54+
}
55+
}
56+
}
4657
this._evaluateSvgBindings();
4758
});
4859
}

0 commit comments

Comments
 (0)