News for hackers. Stuff that matters.
Re:The broken promise of Web Components by dmitriid on Wednesday March 15, 2017 @03:38PM (#13879092)
This example shows how cumbersome the DOM APIs and their limitations are. Also, React is not _just_ DOM diff-ing. It also provides a host of other benefits... some of which are both shown here and covered immediately in the next set of examples with Polymer's kinda-templating-language.

You cannot buy into Web Components without buying into at least Polymer to supply you with data binding.

If you don't like React's size, there are slimmer options: Inferno, Preact etc.

Re:The broken promise of Web Components by BinaryIdiot on Wednesday March 15, 2017 @04:04PM (#13879294)
> You cannot buy into Web Components without buying into at least Polymer to supply you with data binding.

Why? You can use Polymer and not its data binding. In fact you can use its polyfills and deal with mostly the standard based APIs. X-Tags and many others also use Polymer's polyfills.

DOM APIs are awkward as hell. But you can create Web Components and handle the data binding yourself. It's actually pretty easy to roll your own data binding. Now whether you should is another matter.

Re:The broken promise of Web Components by floatboth on Wednesday March 15, 2017 @04:49PM (#13879643)
They're not even "its polyfills", the polyfills are a completely standalone project that Polymer depends on.
Re:The broken promise of Web Components by e111077 on Wednesday March 15, 2017 @06:32PM (#13880498)
If you look at the commits / maintainers to the Polymer repos and the WebComponents polyfills, you'll see that it's the same people.
Re:The broken promise of Web Components by Touche on Wednesday March 15, 2017 @04:31PM (#13879496)
Depending on your use-case you can use a variety of options for data-binding including 1) No data-binding at all (small components), or 2) An HTML-inspired data-binding solution like what Polymer provides or 3) A virtual-dom library like Preact or gasp even React
Re:The broken promise of Web Components by e111077 on Wednesday March 15, 2017 @06:37PM (#13880529)
You don't have to use the DOM API for everything as in your example. JSX is very much virtualized template tags which are HTML standard.

> This gets progressively worse as your components grow in complexity. Imagine adding a span around the text in p?

In this case you simply type in the span inside the template tag similar to what you have in the React JSX and then just importNode the contents into your webcomponent.

Re:The broken promise of Web Components by dmitriid on Thursday March 16, 2017 @02:24AM (#13882963)
> JSX is very much virtualized template tags which are HTML standard

Nope, it's not. It's a thin XML-like DSL which translated into Javascript calls: http://bit.ly/2nC6fdu

Re:The broken promise of Web Components by spankalee on Wednesday March 15, 2017 @08:01PM (#13881111)
> You cannot buy into Web Components without buying into at least Polymer to supply you with data binding.

This is completely and utterly false. What are you basing your assertion on?