src/ui/components/component.js
function createElement(tagName, properties) {
    const node = document.createElement(tagName);
    node.parentComponent = this;
    const ignore = ['parentNode', 'name', 'classList', 'noCreate'];

    Object.keys(properties).forEach((propName) => {
      if (ignore.indexOf(propName) === -1) node[propName] = properties[propName];
    });
    if (properties.classList) properties.classList.forEach(className => node.classList.add(className));
    if (properties.parentNode) properties.parentNode.appendChild(node);
    if (properties.name) this.nodes[properties.name] = node;

    if (!properties.noCreate) {
      if (typeof CustomElements !== 'undefined') CustomElements.upgradeAll(node);
      if (node._onAfterCreate) node._onAfterCreate();
    }
    return node;
  }
function createElement(tagName, properties) {
    const node = document.createElement(tagName);
    node.parentComponent = this;
    const ignore = ['parentNode', 'name', 'classList', 'noCreate'];

    Object.keys(properties).forEach((propName) => {
      if (ignore.indexOf(propName) === -1) node[propName] = properties[propName];
    });
    if (properties.classList) properties.classList.forEach(className => node.classList.add(className));
    if (properties.parentNode) properties.parentNode.appendChild(node);
    if (properties.name) this.nodes[properties.name] = node;

    if (!properties.noCreate) {
      if (typeof CustomElements !== 'undefined') CustomElements.upgradeAll(node);
      if (node._onAfterCreate) node._onAfterCreate();
    }
    return node;
  }
function createElement ( tagName , properties ) { const node = document . createElement ( tagName ) ; node . parentComponent = this ; const ignore = [ 'parentNode' , 'name' , 'classList' , 'noCreate' ] ; Object . keys ( properties ) . forEach ( ( propName ) => { if ( ignore . indexOf ( propName ) === - 1 ) node [ propName ] = properties [ propName ] ; } ) ; if ( properties . classList ) properties . classList . forEach ( className => node . classList . add ( className ) ) ; if ( properties . parentNode ) properties . parentNode . appendChild ( node ) ; if ( properties . name ) this . nodes [ properties . name ] = node ; if ( ! properties . noCreate ) { if ( typeof CustomElements !== 'undefined' ) CustomElements . upgradeAll ( node ) ; if ( node . _onAfterCreate ) node . _onAfterCreate ( ) ; } return node ; }
Shorthand for `document.createElement` followed by a bunch of standard setup.

```
var avatar = this.createElement({
name: "myavatar",
size: "large",
users: [client.user],
parentNode: this.nodes.avatarContainer
});
console.log(avatar === this.nodes.myavatar); // returns true
```

TODO: Most `document.createElement` calls in this UI Framework should be updated to use this.

Note that because all properties are initialized by this call, there is no need for asynchronous initialization,
so unless suppressed with the `noCreate` parameter, all initialization is completed synchronously.

@method createElement
@param {String} tagName           The type of HTMLElement to create (includes Layer.UI.Component instances)
@param {Object} properties        The properties to initialize the HTMLElement with
@param {HTMLElement} [properties.parentNode]  The node to setup as the `parentNode` of our new UI Component
@param {String} [properties.name]   Set `this.nodes[name] = newUIElement`
@param {String[]} [properties.classList]  Array of CSS Class names to add to the new UI Component
@param {Boolean} [properties.noCreate=false]    Do not call `_onAfterCreate()`; allow the lifecycle to flow asyncrhonously instead of rush it through synchronously.
Shorthand for document . createElement followed by a bunch of standard setup .