- From: Joe Pea via GitHub <sysbot+gh@w3.org>
- Date: Sat, 25 Jul 2020 00:55:45 +0000
- To: public-houdini-archive@w3.org
Ok, what I found _does_ work, is the following, which is not as intuitive:
```js
let Y
document.body.attributeStyleMap.set('transform',
new CSSTransformValue([
new CSSTranslate(
CSS.px(10),
Y = CSS.px(100),
CSS.px(10)
)
])
)
// ...later...
Y.value += 100
element.attributeStyleMap.set('transform', T) // set it to the same CSSTransformValue value
```
This is great: we don't need to create `new` instances! :partying_face: However, it would be more intuitive and simply if all we had to do was `Y.value += 100`.
Is there a particular reason `Y.value += 100` is designed not to update anything?
Now suppose I have 100 elements, and I want to update styling for all of them using shared CSS OM. This is intuitive:
```js
Y.value += 100
```
while this is less intuitive and more work:
```js
Y.value += 100
for (const el of elements) {
el.attributeStyleMap.set('transform', T)
}
```
It costs extra operations, and seems like we're not taking advantage of re-usable objects as much as intuition would imply.
--
GitHub Notification of comment by trusktr
Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/995#issuecomment-663786562 using your GitHub account
Received on Saturday, 25 July 2020 00:55:47 UTC