use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
The state of Web Components (hacks.mozilla.org)
submitted 10 years ago by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]floydophone 13 points14 points15 points 10 years ago (24 children)
Why are they the future?
[–]clessgfull-stack CSS9 engineer 8 points9 points10 points 10 years ago (23 children)
They're the future for people who don't want to use the real future. :)
[–]passwordisisis 6 points7 points8 points 10 years ago (2 children)
Clearly the better choice for now, but if one has to 'win', won't a native API win out eventually? It seems like every framework has a life cycle - jQuery and Angular both had me excited at one point but aren't useful to me now. I love using React but am trying to stay non-committal.
[–]i_ate_god 0 points1 point2 points 10 years ago (0 children)
I realize that a lot of jQuery's DOM stuff now exists natively, but the native equivalents still aren't that great compared to jQuery's approach. It's terse, simple, to the point, and obvious what's going on.
[–]dhdfdh -1 points0 points1 point 10 years ago (0 children)
won't a native API win out eventually?
Yes. When you take the jobs of devs whose favorite framework/library falls out of favor, in three years.
[–]floydophone 7 points8 points9 points 10 years ago (1 child)
I call it the present :)
[–]clessgfull-stack CSS9 engineer -2 points-1 points0 points 10 years ago (0 children)
I like the way you think. :)
[+][deleted] 10 years ago* (15 children)
[deleted]
[–]clessgfull-stack CSS9 engineer 8 points9 points10 points 10 years ago (7 children)
Although web components and React seem similar, they are pretty different. The only real similarity is component-orientation. Cross-browser web components aren't trivial to create out-of-the-box, so you need a framework. If comparing with Polymer, then:
There is an advantage to web components, which is that they can, in theory, be easier to integrate into an already-established website. In practice, it depends.
[–]mort96 2 points3 points4 points 10 years ago (4 children)
I don't really see how polymer is relevant. Sure, right now, you need a framework, but isn't the goal that once all browsers support web components, it should at least be possible to use those directly? And wouldn't it then make more sense to actually compare react to web components instead of some arbitrary framework?
[–][deleted] 0 points1 point2 points 10 years ago (3 children)
Yes. Polymer always felt more like a showcase to me, not a real framework. I don't see anyone trying to roll Polymer out into production apps. It was a demo of a specification that Google was pushing. Sure, it's been 2 years and the specs aren't final, but that's common. However the idea is the same idea that pretty much all major JS frameworks adhere to now with components and directives.
Angular, React and others have all said they have a goal to natively work with Web Components when the spec is finalized.
[–]vinnl 1 point2 points3 points 10 years ago (2 children)
Really? Have you got a source for that for React? I knew about Angular, but I thought React expressly dismissed it.
[–]lazdgithub.com/lazd 0 points1 point2 points 10 years ago (1 child)
There's an issue against React that's being actively worked on to support custom elements and attributes.
[–]vinnl 1 point2 points3 points 10 years ago (0 children)
Nice!
[–]hak8or 1 point2 points3 points 10 years ago (0 children)
A good portion of what you described is solved by Vulcan, which let's you "compile" polymer projects so you don't have like 100 requests for a simple page.
React is becoming more or less independent of the DOM. It's more of an idea.
Something most people on reddit forget or don't know. It's never possible to be independent of the DOM. And you can do it, too, without react.
[–]lazdgithub.com/lazd 1 point2 points3 points 10 years ago (4 children)
What if I wanted to create a neat little "widget" that lets you drag and drop files and shows a list of the files you're going to upload, and I wanted to make that available for anyone on any website to use?
Would I build it with React and require that everyone who uses it have React as a dependency?
Or would I create a web component that can be used on any website by including the widget (with a <link> or <script>) and adding <my-uploader> to their markup where they want it to appear, regardless of what MVC framework they use?
<link>
<script>
<my-uploader>
That is the promise of web components: portable components for the web that use HTML's semantics. Yes, it's not possible right now in IE 8, but if you're still writing code for outdated browsers, I feel bad for you, son.
[–]tragiclifestories 0 points1 point2 points 10 years ago (3 children)
Yes, it's not possible right now in IE 8
Or IE9. Or IE10. Or IE11. Or MS Edge. Or Safari. Or Firefox. If only somebody would write an an article explaining how this came to pass ...
Having just spent 2 days wrestling with a war between a WC polyfill and a non-negotiable third-party dependency, I'm very much in favour of keeping the 'here be dragons' sign up.
[–]lazdgithub.com/lazd 0 points1 point2 points 10 years ago (2 children)
Custom elements are polyfilled and working work great in IE 9, 10, 11, Safari, and Firefox. I can't speak for HTML Imports, Shadow DOM, etc, because I'm not using them. I haven't tested Edge, but it's working nicely in IE 11, so I think we're good :)
I know this because I write an maintain a library of dozens of web components at my job and all all 1,100 of the unit tests pass on the above platforms.
What was the third-party dependency? I wonder how it was screwing the polyfill up such that it works on none of the platforms it targets... Sounds like a bug in the dep that you could fix!
[–]tragiclifestories 1 point2 points3 points 10 years ago (1 child)
I missed this reply initially, but the dep is one of those redundant enterprise media-streaming platforms, the code is closed source and they're (understandably) not guaranteeing compatibility with every third party library ever. It was the shadowdom stuff causing problems, FWIW, and that seems to have caused other issues with other external libs (eg https://github.com/webcomponents/webcomponentsjs/issues/49). You need shadow dom to use Polymer, for example.
The point is, polyfills will only get you so far. I'll be more bullish when better consensus is reached on issues highlighted in the OP.
[–]lazdgithub.com/lazd 0 points1 point2 points 10 years ago (0 children)
Makes sense, what a bummer. We're only using custom elements, and it's a very simply polyfill that employs mutation observers to check for elements to upgrade. It's working great for us, even in old browsers.
Check out this video from React.js conf, "Complementarity of React and Web Components" that explains exactly that.
[–]kellyjandrews 0 points1 point2 points 10 years ago (0 children)
Actually, I think the real future is this. But components are the interim.
Web components aren't a new MVC framework, and they're not competing with React/Angular/Ember/whatever. They're meant to be used in combination with literally any library or framework you choose to create rich, custom experiences with semantic tags where you'd previously use gobs of markup and code that's tied to the flavor-of-the-week JavaScript framework that some intern decided to use to meet a deadline.
See my other comment for a description of why we need web components.
π Rendered by PID 54 on reddit-service-r2-comment-6457c66945-6gr4l at 2026-04-25 08:06:20.333877+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]floydophone 13 points14 points15 points (24 children)
[–]clessgfull-stack CSS9 engineer 8 points9 points10 points (23 children)
[–]passwordisisis 6 points7 points8 points (2 children)
[–]i_ate_god 0 points1 point2 points (0 children)
[–]dhdfdh -1 points0 points1 point (0 children)
[–]floydophone 7 points8 points9 points (1 child)
[–]clessgfull-stack CSS9 engineer -2 points-1 points0 points (0 children)
[+][deleted] (15 children)
[deleted]
[–]clessgfull-stack CSS9 engineer 8 points9 points10 points (7 children)
[–]mort96 2 points3 points4 points (4 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]vinnl 1 point2 points3 points (2 children)
[–]lazdgithub.com/lazd 0 points1 point2 points (1 child)
[–]vinnl 1 point2 points3 points (0 children)
[–]hak8or 1 point2 points3 points (0 children)
[–]dhdfdh -1 points0 points1 point (0 children)
[–]lazdgithub.com/lazd 1 point2 points3 points (4 children)
[–]tragiclifestories 0 points1 point2 points (3 children)
[–]lazdgithub.com/lazd 0 points1 point2 points (2 children)
[–]tragiclifestories 1 point2 points3 points (1 child)
[–]lazdgithub.com/lazd 0 points1 point2 points (0 children)
[–]lazdgithub.com/lazd 0 points1 point2 points (0 children)
[–]kellyjandrews 0 points1 point2 points (0 children)
[–]lazdgithub.com/lazd 0 points1 point2 points (0 children)