What happens when someone calls setAttribute()?
-
-
Replying to @slightlylate @dmitryshimkin and
if it's a standard HTML attribute like hidden or style, it does exactly what it would do for any other HTML element. But it doesn't trigger some lifecycle callback. If you want to pass new data, you have to set properties on the instance instead. (Not necessarily getters and
1 reply 0 retweets 0 likes -
Replying to @Rich_Harris @slightlylate and
setters, because it'd be nice if updates were batched naturally. But similar idea)
1 reply 0 retweets 0 likes -
Replying to @Rich_Harris @dmitryshimkin and
Hidden/style etc absolutely go through a system like attributeChanged inside setAttribute impl in C++ side of DOM
1 reply 0 retweets 1 like -
-
Replying to @Rich_Harris @dmitryshimkin and
So if you want "what other built-ins do", this is what they do!
2 replies 0 retweets 1 like -
Replying to @slightlylate @dmitryshimkin and
I think you're missing the point here — there is real confusion caused by the dual interface of attributes and properties. The C++ implementation is utterly irrelevant to me as a component author and consumer
1 reply 0 retweets 3 likes -
Replying to @Rich_Harris @dmitryshimkin and
I grok the point. That DOM has both is clearly not great! MSFT's DOM was correct (and Netscape/IBM were *super* wrong). But if you want property-only components, or want to only handle attributes up-front, can do that today. What's missing?
1 reply 0 retweets 1 like -
Replying to @slightlylate @Rich_Harris and
I mean, if you're saying "we want syntactic support for a version of HTML that relies on properties", that's doable but a big lift. Size of effort is perhaps part of why JSX crowd continues with fork instead of proposing new parsing mode?
1 reply 0 retweets 1 like -
Replying to @slightlylate @dmitryshimkin and
> What's missing? Predictability. Consistency between components. The React model is so successful in part because of its obviousness — there's only one way to get data into a component > if you're saying ... I'm not. I think HTML is fine
1 reply 0 retweets 3 likes
...but it's HTML that *creates* this split. WC only give you high fidelity access to both sides. If you want property-only components, go nuts! It's all there.
-
-
Replying to @slightlylate @dmitryshimkin and
"go nuts, it's all there" is *the whole problem*. When an API is well-designed, there's usually only one way to do something
2 replies 0 retweets 5 likes -
Replying to @Rich_Harris @dmitryshimkin and
Then don't use attributes in your elements! Ignore them! Throw or ignore in post-construction attr changes! Preach the no-semicolon-but-for-components message! WC open up the guts of HTML and DOM. What you do with that power *is up to you*.
1 reply 0 retweets 4 likes - 6 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
& Web Standards TL; Blink API OWNER
Named PWAs w/
DMs open. Tweets my own; press@google.com for official comms.