Closed thepassle closed 2 years ago
@kevinpschaaf @justinfagnani I guess browsers lowercase the attribute, I'm not sure if that's done before setAttribute is called or before attributeChangedCallback is called. What do you think would be the best behavior for the polyfill to follow?
setAttribute is called from userland, so it may receive mixed case attribute names. attributeChangedCallback is called by the browser and probably only received lower case names. Looks like the patch for setAttribute needs to lowercase the attribute before calling attributeChangedCallback.
Looks like the patch for setAttribute needs to lowercase the attribute before calling attributeChangedCallback.
That does indeed seem to lead to the expected behavior: https://stackblitz.com/edit/js-mnczsr?file=polyfill.js
Description
Using
lit-element@2.4.0
and@open-wc/scoped-elements@1.3.4
we're noticing some unexpected behavior when setting boolean attributes. The following code:Behavior without loading the polyfill: Sets a
foobar
attribute on<scope-me>
and it also sets thefooBar
property totrue
Behavior with loading the polyfill: Sets a
foobar
attribute on<scope-me>
, but thefooBar
property isundefined
Example
Stackblitz repro
Version
0.0.3
Browsers affected