x-tag / core

The Heart of X-Tag
http://x-tag.github.io/
Other
1.25k stars 151 forks source link

Using setAttribute is unstable #187

Closed ghost closed 6 years ago

ghost commented 6 years ago

Playing around with the ::attr extension I found that the setAttribute() method was unusable or at least unstable.

I wasn't sure if this was a documented bug for custom elements or xtags...so I thought I'd put it here. If anyone can let me know if this has already been documented or if others have noticed buggy behavior it would be really appreciated.

~Regards Steve

ghost commented 6 years ago

This is an instability issue that is easily resolved by using the xtag's attribute setter to define values of attributes, so it is simple to avoid.

ghost commented 6 years ago

Okay I think I found the source of the error. I believe that the reg exp I used had a g flag set which made it remember the incorrect match.

ghost commented 6 years ago

Or at least I think that is it...In any case the behavior I was trying to get has evened out and it appears to be stable with the fix to the way the regexp was being used.