Skip to content

[0.7] Attribute spreading and defaults #3331

Closed Answered by gbj
ozpv asked this question in Q&A
Discussion options

You must be logged in to vote

This works for CSR, however, this does not work when using SSR. My theory is the WASM recognizes there are duplicate attributes and replaces or merges them for us before rendering.

When you set an attribute using CSR, it calls .setAttribute() on the DOM element. If you set the same attribute twice, this means that it first sets it to X, then to Y. (This is just how the DOM APIs work, so where you say "the WASM" what you mean is "the browser.")

When you set an attribute using SSR, it simply adds it to the list of attributes. This means width and height end up appearing twice, as you said. And then, as you note, you end up with the first instance of that attribute, not the last instance.

T…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by ozpv
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants