pakastin / frzr

Turboboosted 2 KB view library for browser & node.js
https://frzr.js.org
ISC License
265 stars 21 forks source link

el(tagName) should return view instead of HTMLElement? #33

Closed pakastin closed 8 years ago

pakastin commented 8 years ago

I have though about changing el(tagName) to return view instead of HTMLElement. Then you could do:

js
class Hello {
  constructor () {
    this.el = el('h1')
  }
  update (data) {
    this.el.setStyle('color', data.color);
    this.el.setClass('bold', data.bold);
  }
}

or even:

function Hello () {
  var view = el('h1');

  view.update = data => {
    view.setStyle('color', data.color);
    view.setClass('bold', data.bold);
  }

  return view;
}

This would actually be preferred style. It's not class anymore, but you should uppercase it because of JSX:

<Hello></Hello>
pakastin commented 8 years ago

Thoughts?

pakastin commented 8 years ago

I'm also studying custom HTML elements, and how you could benefit from them..

pakastin commented 8 years ago

..closing for now