WebReflection / hyperHTML

A Fast & Light Virtual DOM Alternative
ISC License
3.06k stars 112 forks source link

Incorrect sample from documentation #341

Closed ikabirov closed 5 years ago

ikabirov commented 5 years ago

Sample from https://viperhtml.js.org/hyperhtml/documentation/#essentials-3 doesn't work correctly, cause it different template literals

playground: https://codepen.io/ikabirov/pen/MLGNPV

WebReflection commented 5 years ago

That changed after this ECMAScript change, the example now should be:

const info = {some: 'data'};

const view = info => hyperHTML.wire(info)`
                      <li></li>`;

const sameLI = view(info);

// what if we use same template later on?
console.assert(
  sameLI === view(info),
  'same reference means exactly the same node'
);

However, this is not the right repository 👋