facebook/react — pull request #1249 by mereskin (2014-03-12 17:08:59+00:00)
Title: Add naive custom element support

JSX will render `` as `custom-element()`. Rendering it as `CustomElement()` sounds like a better idea, because it is syntactically correct. If we operate on an assumption, that custom elements names map to React displayNames with this convention, we can build React-driven web component:

```
/** @jsx React.DOM */
var MyComponent = React.createClass({
render: function(){
return (

Hello {this.props.name}

);
}
});

var MyComponentPrototype = Object.create(HTMLElement.prototype);

MyComponentPrototype.attachedCallback = function(){
var props = {};
Array.prototype.forEach.call(this.attributes, function(attr){
props[attr.name] = attr.value;
});
React.renderComponent(MyComponent(props), this);
};

document.registerElement('my-component', { prototype: MyComponentPrototype });
```