Renders the given react element using a web worker.

@param  {ReactElement}   element   - Node to update.
@return {ReactComponent}           - The rendered component instance.
963043
function render(element) {
    // Is the given element valid?
    invariant(
        ReactElement.isValidElement(element),
        'render(): You must pass a valid ReactElement.'
    );

    const id = ReactInstanceHandles.createReactRootID(); // Creating a root id & creating the screen
    const component = instantiateReactComponent(element); // Mounting the app
    const transaction = ReactUpdates.ReactReconcileTransaction.getPooled();

    ReactWWIDOperations.setRoot(new WorkerDomNodeStub('0', 'div', {}));

    // The initial render is synchronous but any updates that happen during
    // rendering, in componentWillMount or componentDidMount, will be batched
    // according to the current batching strategy.
    ReactUpdates.batchedUpdates(() => {
        transaction.perform(() => {
            component.mountComponent(id, transaction, {});
        });
        ReactUpdates.ReactReconcileTransaction.release(transaction);
    });

    return component._instance;
}
1304007
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WSection section = (WSection) component;
		XmlStringBuilder xml = renderContext.getWriter();

		boolean renderChildren = isRenderContent(section);

		xml.appendTagOpen("ui:section");
		xml.appendAttribute("id", component.getId());
		xml.appendOptionalAttribute("class", component.getHtmlClass());
		xml.appendOptionalAttribute("track", component.isTracking(), "true");
		if (SectionMode.LAZY.equals(section.getMode())) {
			xml.appendOptionalAttribute("hidden", !renderChildren, "true");
		} else {
			xml.appendOptionalAttribute("hidden", component.isHidden(), "true");
		}

		SectionMode mode = section.getMode();
		if (mode != null) {
			switch (mode) {
				case LAZY:
					xml.appendAttribute("mode", "lazy");
					break;
				case EAGER:
					xml.appendAttribute("mode", "eager");
					break;
				default:
					throw new SystemException("Unknown section mode: " + section.getMode());
			}
		}

		xml.appendClose();

		// Render margin
		MarginRendererUtil.renderMargin(section, renderContext);

		if (renderChildren) {
			// Label
			section.getDecoratedLabel().paint(renderContext);
			// Content
			section.getContent().paint(renderContext);
		}

		xml.appendEndTag("ui:section");
	}
433908
function ReactComponent(props, context, updater) {
  this.props = props;
  this.context = context;
  this.refs = emptyObject;
  // We initialize the default updater but the real one gets injected by the
  // renderer.
  this.updater = updater || ReactNoopUpdateQueue_1;
}
796279
function render(data) {
                if (!this._rendered) {
                    if (this.template) {
                        if (data) {
                            this.data = data;
                        }
                        var options = this._options,
                            parentChildren = this._parentChildren,
                            decoder = new Decoder(this.template),
                            template = decoder.render(this.data);
                        if (this.el) {
                            var parent = this.el.parentNode;
                            if (parent) {
                                parent.replaceChild(template.fragment, this.el);
                            }
                            if (this.elGroup && this.elGroup.get(this.el)) {
                                this.elGroup.delete(this.el);
                                this.el = template.fragment;
                                this.elGroup.set(template.fragment, this);
                            }
                        } else {
                            this.el = template.fragment;
                        }

                        this.root = new dom.Element(template.fragment, {
                            name: 'root',
                            data: {}
                        });

                        this.children = applyElement(template.children, options);
                        applyParent(this, parentChildren, this.data);
                        this.bindings = setBinders(this.children, true);

                        if (this.data) {
                            this.applyBinders(this.data, this);
                        }

                        setRoutes(this.children, this.context);
                        addChildren(this, this.root);
                        this.rendered.apply(this, _toConsumableArray(this._arguments));
                        this._rendered = true;
                    } else {
                        var HTMLelement = document.createElement('div');
                        this.root = new dom.Element(HTMLelement, {
                            name: 'root',
                            data: {}
                        });
                        if (this.el) {
                            var _parent = this.el.parentNode;
                            if (_parent) {
                                _parent.replaceChild(HTMLelement, this.el);
                            }
                        }
                        this.el = HTMLelement;
                        this.children = {};
                        addChildren(this, this.root);

                        this.rendered.apply(this, _toConsumableArray(this._arguments));
                        this._rendered = true;
                    }
                }
            }
1285400
function renderComponent() {
    d3.select('svg')
      .datum(svgData)
      .call(crosshairSvg)
      .on('mousemove', function() {
          var point = d3.mouse(this);
          svgData[0] = { x: point[0], y: point[1] };
          render();
      });

    var canvas = d3.select('canvas').node();
    var ctx = canvas.getContext('2d');
    ctx.clearRect(0, 0, canvas.width, canvas.height);
    crosshairCanvas.context(ctx)(canvasData);
    canvas.onmousemove = function({ offsetX, offsetY }) {
        canvasData[0] = { x: offsetX, y: offsetY };
        render();
    };
}
806540
def render(self, element):
        
        # Store the root node to provide some context to render functions
        if not self.root_node:
            self.root_node = element
        render_func = getattr(
            self, self._cls_to_func_name(element.__class__), None)
        if not render_func:
            render_func = self.render_children
        return render_func(element)
51468
function domToReact(nodes, options) {
  options = options || {};
  var result = [];
  var node;
  var isReplacePresent = typeof options.replace === 'function';
  var replacement;
  var props;
  var children;

  for (var i = 0, len = nodes.length; i < len; i++) {
    node = nodes[i];

    // replace with custom React element (if applicable)
    if (isReplacePresent) {
      replacement = options.replace(node);

      if (React.isValidElement(replacement)) {
        // specify a "key" prop if element has siblings
        // https://fb.me/react-warning-keys
        if (len > 1) {
          replacement = React.cloneElement(replacement, {
            key: replacement.key || i
          });
        }
        result.push(replacement);
        continue;
      }
    }

    if (node.type === 'text') {
      result.push(node.data);
      continue;
    }

    props = node.attribs;
    if (!shouldPassAttributesUnaltered(node)) {
      // update values
      props = attributesToProps(node.attribs);
    }

    children = null;

    // node type for <script> is "script"
    // node type for <style> is "style"
    if (node.type === 'script' || node.type === 'style') {
      // prevent text in <script> or <style> from being escaped
      // https://facebook.github.io/react/tips/dangerously-set-inner-html.html
      if (node.children[0]) {
        props.dangerouslySetInnerHTML = {
          __html: node.children[0].data
        };
      }
    } else if (node.type === 'tag') {
      // setting textarea value in children is an antipattern in React
      // https://reactjs.org/docs/forms.html#the-textarea-tag
      if (node.name === 'textarea' && node.children[0]) {
        props.defaultValue = node.children[0].data;

        // continue recursion of creating React elements (if applicable)
      } else if (node.children && node.children.length) {
        children = domToReact(node.children, options);
      }

      // skip all other cases (e.g., comment)
    } else {
      continue;
    }

    // specify a "key" prop if element has siblings
    // https://fb.me/react-warning-keys
    if (len > 1) {
      props.key = i;
    }

    result.push(React.createElement(node.name, props, children));
  }

  return result.length === 1 ? result[0] : result;
}
769937
function AnotherBasicComponent(props: { name: string }): React.Node {
    return <div>Bonjour {props.name}!</div>;
}
741784
function (element, options) {
		this.$element = $(element);
		this.options = $.extend({}, $.fn.tree.defaults, options);

		this.$element.on('click', '.tree-item', $.proxy( function(ev) { this.selectItem(ev.currentTarget); } ,this));
		this.$element.on('click', '.tree-folder-header', $.proxy( function(ev) { this.selectFolder(ev.currentTarget); }, this));

		this.render();
	}
1016359
function compileComponent(ComponentClass) {
    var proto = ComponentClass.prototype;

    // pre define components class
    /* istanbul ignore else  */
    if (!proto.hasOwnProperty('_cmptReady')) {
        proto.components = ComponentClass.components || proto.components || {};
        var components = proto.components;

        for (var key in components) { // eslint-disable-line
            var componentClass = components[key];

            if (typeof componentClass === 'object' && !(componentClass instanceof ComponentLoader)) {
                components[key] = defineComponent(componentClass);
            }
            else if (componentClass === 'self') {
                components[key] = ComponentClass;
            }
        }

        proto._cmptReady = 1;
    }


    // pre compile template
    /* istanbul ignore else  */
    if (!proto.hasOwnProperty('aNode')) {
        var aNode = parseTemplate(ComponentClass.template || proto.template, {
            trimWhitespace: proto.trimWhitespace || ComponentClass.trimWhitespace,
            delimiters: proto.delimiters || ComponentClass.delimiters
        });

        var firstChild = aNode.children[0];
        if (firstChild && firstChild.textExpr) {
            firstChild = null;
        }

        // #[begin] error
        if (aNode.children.length !== 1 || !firstChild) {
            warn('Component template must have a root element.');
        }
        // #[end]

        proto.aNode = firstChild = firstChild || {
            directives: {},
            props: [],
            events: [],
            children: []
        };

        if (firstChild.tagName === 'template') {
            firstChild.tagName = null;
        }

        if (proto.autoFillStyleAndId !== false && ComponentClass.autoFillStyleAndId !== false) {
            var componentPropExtra = {
                'class': {name: 'class', expr: parseText('{{class | _xclass}}')},
                'style': {name: 'style', expr: parseText('{{style | _xstyle}}')},
                'id': {name: 'id', expr: parseText('{{id}}')}
            };

            var len = firstChild.props.length;
            while (len--) {
                var prop = firstChild.props[len];
                var extra = componentPropExtra[prop.name];

                if (extra) {
                    firstChild.props.splice(len, 1);
                    componentPropExtra[prop.name] = prop;

                    if (prop.name !== 'id') {
                        prop.expr.segs.push(extra.expr.segs[0]);
                        prop.expr.value = null;
                    }
                }
            }

            firstChild.props.push(
                componentPropExtra['class'], // eslint-disable-line dot-notation
                componentPropExtra.style,
                componentPropExtra.id
            );
        }
    }
}
889823
function(React, elementConstructor, name) {
    return React.createClass({
        displayName: name,

        componentWillMount: function() {
            this.needsPlaceholding = this.props.placeholder && !isPlaceholderSupported;
        },

        componentWillReceiveProps: function(props) {
            this.needsPlaceholding = props.placeholder && !isPlaceholderSupported;
        },

        // this component supports valueLink or value/onChange.
        // borrowed from LinkedValueMixin.js
        getValue: function() {
            if (this.props.valueLink) {
                return this.props.valueLink.value;
            }

            return this.props.value;
        },

        getOnChange: function() {
            if (this.props.valueLink) {
                return this._handleLinkedValueChange;
            }

            return this.props.onChange;
        },

        _handleLinkedValueChange: function(e) {
            this.props.valueLink.requestChange(e.target.value);
        },

        // keep track of focus
        onFocus: function(e) {
            this.hasFocus = true;
            this.setSelectionIfNeeded(e.target);

            if (this.props.onFocus) {
                return this.props.onFocus(e);
            }
        },
        onBlur: function(e) {
            this.hasFocus = false;

            if (this.props.onBlur) {
                return this.props.onBlur(e);
            }
        },

        setSelectionIfNeeded: function(node) {
            if (   this.needsPlaceholding
                && 'setSelectionRange' in node
                && this.hasFocus
                && this.isPlaceholding
                && (node.selectionStart !== 0 || node.selectionEnd !== 0)) {
                node.setSelectionRange(0, 0);
            } // if placeholder is visible, ensure cursor is at start of input
        },

        onChange: function(e) {
            var onChange = this.getOnChange();
            var value;
            var index;

            if (this.isPlaceholding) {
                // remove placeholder when text is added
                value = e.target.value;
                index = value.indexOf(this.props.placeholder);

                if (index !== -1) {
                    e.target.value = value.slice(0, index);
                }
            }

            if (onChange) {
                return onChange(e);
            }
        },

        onSelect: function(e) {
            if (this.isPlaceholding) {
                this.setSelectionIfNeeded(e.target);

                return false;
            } else if (this.props.onSelect) {
                return this.props.onSelect(e);
            }
        },

        componentDidUpdate: function() {
            this.setSelectionIfNeeded(this.getDOMNode());
        },

        render: function() {
            var props = {};
            var value;
            var key;

            for (key in this.props) {
                if (this.props.hasOwnProperty(key)) {
                    props[key] = this.props[key];
                }
            }

            if (this.needsPlaceholding) {
                // override valueLink and event handlers
                props.onFocus = this.onFocus;
                props.onBlur = this.onBlur;
                props.onChange = this.onChange;
                props.onSelect = this.onSelect;
                props.valueLink = undefined;

                value = this.getValue();

                if (!value) {
                    this.isPlaceholding = true;
                    value = this.props.placeholder;
                    props.className += ' placeholder';
                } else {
                    this.isPlaceholding = false;
                }

                props.value = value;
            }

            if (!('createElement' in React)) { /* start -- to be removed in 2.0.0 */
                return this.transferPropsTo(elementConstructor());
            } else { /* -- end */
                return React.createElement(elementConstructor, props, this.props.children);
            }
        }
    });
}
1212716
function generateHtml(node) {
    if (isReactElement(node)) {
        return _react2.default.renderToString(node);
    } else if (isReactFragment(node)) {
        var htmlStr = '';

        node.map(function (child) {
            htmlStr += generateHtml(child);
        });

        return htmlStr;
    } else if (isReactText(node)) {
        return String(node);
    } else if (isReactEmpty(node)) {
        return '';
    }

    try {
        return JSON.stringify(node);
    } catch (err) {
        console.error('stringify error:', err.message);
        return node;
    }
}
927469
function elementCreate(name, overriddenRenderer) {
    var native;
    var rendererToUse = overriddenRenderer || renderer;
    if (isProceduralRenderer(rendererToUse)) {
        native = rendererToUse.createElement(name, _currentNamespace);
    }
    else {
        if (_currentNamespace === null) {
            native = rendererToUse.createElement(name);
        }
        else {
            native = rendererToUse.createElementNS(_currentNamespace, name);
        }
    }
    return native;
}
1256529
function(element, options) {
        var that = this;
        that.name = NAME;
        that.$ = $(element);

        options = that.options = $.extend({}, $ComponentName$.DEFAULTS, this.$.data(), options);

        // Initialize here
    }
867943
function Element (tagName, props, children) {
  if (!(this instanceof Element)) {
    if (!_.isArray(children) && children != null) {
      children = _.slice(arguments, 2).filter(_.truthy)
    }
    return new Element(tagName, props, children)
  }

  if (_.isArray(props)) {
    children = props
    props = {}
  }

  this.tagName = tagName
  this.props = props || {}
  this.children = children || []
  this.key = props
    ? props.key
    : void 666

  var count = 0

  _.each(this.children, function (child, i) {
    if (child instanceof Element) {
      count += child.count
    } else {
      children[i] = '' + child
    }
    count++
  })

  this.count = count
}
478883
function (component, props) {
    var Component = React.createFactory(component);
    return ReactDomServer.renderToString(Component(props));
  }
1339343
function renderNode(rootNode) {
    let createdPromises = [];

    var document = getDocument(rootNode);

    recurseTree(rootNode, (foundNode) => {
        if (foundNode.tagName) {
            let nodeType = foundNode.tagName.toLowerCase();
            let customElement = registeredElements[nodeType];
            if (customElement) {
                // TODO: Should probably clone node, not change prototype, for performance
                Object.setPrototypeOf(foundNode, customElement);
                if (customElement.createdCallback) {
                    createdPromises.push(new Promise((resolve) => {
                        resolve(customElement.createdCallback.call(foundNode, document));
                    }));
                }
            }
        }
    });

    return Promise.all(createdPromises).then(() => rootNode);
}