- From: Joe Pea via GitHub <sysbot+gh@w3.org>
- Date: Sun, 02 Aug 2020 06:01:57 +0000
- To: public-houdini-archive@w3.org
This is what I observe:
```js
el.style.setProperty('display', 'none') // triggers attributeChangedCallback
el.attributeStyleMap.set('display', new CSSKeywordValue('block')) // does not trigger attributeChangedCallback
```
Is the `style` attribute officially supposed to change in the latter case? (I do see the style attribute change in Chrome element inspector)
Here's a full working code snippet to paste in console:
```js
class MyEl extends HTMLElement {
static observedAttributes = ['style']
attributeChangedCallback(attr, oldVal, newVal) { console.log(attr, oldVal, newVal) }
}
customElements.define('my-el', MyEl)
const el = document.createElement('my-el')
document.body.append(el)
console.log('--------------------')
el.style.setProperty('display', 'none')
console.log('--------------------')
el.attributeStyleMap.set('display', new CSSKeywordValue('block')) // no log
console.log('--------------------')
el.style.setProperty('display', 'none')
console.log('--------------------')
```
Output:
```
--------------------
style null display: none;
--------------------
--------------------
style display: block; display: none;
--------------------
```
--
GitHub Notification of comment by trusktr
Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/996#issuecomment-667632960 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Sunday, 2 August 2020 06:01:59 UTC