WebReflection / hyperHTML

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

wire(obj)`<li></li>` !== wire(obj)`<li></li>` #350

Closed BlueWater86 closed 5 years ago

BlueWater86 commented 5 years ago

Hi Andrea, one of the examples given regarding wires producing the same node is no longer working as expected. I would have taken a look at the cause but our current sprint doesn't give me any free time.

https://codepen.io/bluewater86/pen/zbJagB

const info = {some: 'data'},
      a = hyperHTML.wire(info)`<li></li>`,
      b = hyperHTML.wire(info)`<li></li>`
console.assert(a === b, 'same reference means exactly the same node');
WebReflection commented 5 years ago

It's explained in here: https://medium.com/@WebReflection/a-tiny-disastrous-ecmascript-change-fadc05c83e69

this would work

const li = info => hyperHTML.wire(info)`<li></li>`;
const info = {some: 'data'},
      a = li(info),
      b = li(info);
console.assert(a === b, 'same reference means exactly the same node');
BlueWater86 commented 5 years ago

Thanks for the info; crazy how the treatment of the standard changed like that. The 'same reference means exactly same node' example is still in your documentation which was confusing. image