4 ms·
And such extension is a major PITA to do. The API is atrocious, like most of the DOM API is.
by jfkebwjsbx 6y ago
And such extension is a major PITA to do. The API is atrocious, like most of the DOM API is.
- spankalee 6y agoWhat's your suggestion for a better API? You can't just say "React" though, you have to show how it actually integrates with the DOM that we have. "Throw away the DOM we have" isn't a realistic option either.
- dmitriid 6y agoReact integrates with the DOM we have. How dow you suppose it works? How is React different from any of the libs and frameworks you are supposed to use for WebComponents? [1] As for the API. How about a declarative API lime the one Polymer uses? [2] [1] https://twitter.com/dmitriid/status/987771666846699520?s=20 https://twitter.com/dmitriid/status/987771666846699520?s=20 [2] https://twitter.com/dmitriid/status/865518972380237825?s=20 https://twitter.com/dmitriid/status/865518972380237825?s=20
- no_wizard 6y agoHow is it atrocious exactly? I mean it’s decidedly not React to be clear, but I’m not sure what makes it atrocious
- dmitriid 6y agoIt's overly verbose and error prone. Try adding an observable attribute. Then add another one. Then do something simple like change the name of the first one. And that's just two attributes.
- sime2009 6y agoThe Web Component APIs don't aim to be easy to use by application developers. That is simply not a goal of the spec. They're low level APIs which expose behavour and hooks on which libraries and frameworks can be built. As an application developer you are supposed to use those friendly libraries.
- dmitriid 6y agoAaand that's the problem with the API. The question was, how is API atrocious. Once an answer is received, it's immediately diverted to "the API is not for devs, you have to use libraries". This doesn't make the API any less atrocious. And it would be nice if the platform didn't rely on libraries to make it usable.
- sime2009 6y agoSure, from a dev perspective the API may be bad. But I'm saying that that isn't the right perspective to use when judging it. "Nice" APIs or higher level APIs are desirable of course, but they tend to be much bigger in size and scope, much more opinionated and brittle than a smaller low level API. A portable API which browser makers can accurately implement and support for the long term, is a smarter goal even if it does expect devs to build a "nice" layer on top of it first.
- dmitriid 6y agoIn case of WebComponents it could have a small sane layer on top that wouldn't be too large. See WebComponents vs Polymer: [1] As it stands now, it's nigh unusable by developers. Almost no frameworks even use it as their foundation. And those that do compile to them go out of their way to never ever use it anywhere except in base classes, maybe: [2] As a result, today, 9 years (!!!) after they were first proposed, the very person who proposed them relegates them to "webcomponents will be used incidentally not totally" [3] [1] https://twitter.com/dmitriid/status/865518972380237825?s=20 https://twitter.com/dmitriid/status/865518972380237825?s=20 [2] Stencil compilation: https://twitter.com/dmitriid/status/1283445578853158917 https://twitter.com/dmitriid/status/1283445578853158917 [3] https://twitter.com/slightlylate/status/1283053719563563008 https://twitter.com/slightlylate/status/1283053719563563008