Skip to content
This repository has been archived by the owner on Apr 4, 2022. It is now read-only.

BaseElement.setAttribute should track super.setAttribute succes/failure #153

Open
devingfx opened this issue Oct 6, 2021 · 0 comments
Open

Comments

@devingfx
Copy link

devingfx commented Oct 6, 2021

Hello

This is a (very) small issue though, but reading this lines in file :

setAttribute(name: string, value: string) {
this.attributeChangedCallback(name, this.getAttribute(name), value)
super.setAttribute(name, value)
}

... I assume wrong arguments can be given (like wrong attributeName) for the native impl. to throw an error.
In this case, the attributeChangedCallback will be called even the actual attribute set is not terminated...

Easy solution: invert the 2 lines, so the callback would not be fired if an error occured.
Less easy solution: Encapsulate the super call in a try/catch and call the callback only in case of success, and manage the error case...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant