jridgewell / babel-plugin-transform-incremental-dom

Turn JSX into IncrementalDOM
MIT License
145 stars 12 forks source link

Hoist Static Attrs #26

Closed jridgewell closed 8 years ago

jridgewell commented 8 years ago

Following the best practices of iDOM, we should hoist our statics array as high as we can.

Implemented as an option for now, until I'm confident we've found the edge cases.

jamiebuilds commented 8 years ago

Should cases like:

function test(props) {
  props.key = 1;
  _statics31[3] = props.key;
  return elementVoid("div", props.key, _statics31);
}

Be resetting the value afterwards to avoid memory leaks?

function test(props) {
  props.key = 1;
  _statics31[3] = props.key;
  var _result = elementVoid("div", props.key, _statics31);
  _statics31[3] = null;
  return _result;
}
jridgewell commented 8 years ago

We could, but these should be simple strings (or numbers, but really just strings).

jamiebuilds commented 8 years ago

What about event handlers?

jridgewell commented 8 years ago

The _statics31[3] = key is only for the key attribute, objects (and functions) won't work properly with the keyMap inside iDOM.

jamiebuilds commented 8 years ago

Ooh I see.

jridgewell commented 8 years ago

Good to go?

jamiebuilds commented 8 years ago

Yeah, looks good.