SOURCE CODE: Uize.Templates.Adoptable (view docs)

<%@
  input ({
    name:'string',
    widgetClass:'string',
    html:'object|function|string'
  });
  required (
    'Uize.Json'
  );
%><%
  /* Module Meta Data
    type: Template
    importance: 1
    codeCompleteness: 100
    docCompleteness: 100
  */
%><%
  var
    _input = input,
    _state = Uize.copy ({built:false},_input),
    _html = _state.html,
    _idPrefix = 'page_' + _state.name
  ;
  delete _state.name;
  if (_html == 'shell') {
    delete _state.html;
%><div id="<%= _idPrefix%>-shell"></div><%
  } else {
    if (_html && Uize.isFunction (_html.process))
      _html = _html.process
    ;
    if (Uize.isFunction (_html)) {
      delete _state.html;
      _state.built = true;
%><%=
      _html (Uize.copy (_state,{idPrefix:_idPrefix}))
%><%
    }
  }
%>
<script type="text/javascript">
$<%= _idPrefix %> = <%= Uize.Json.to (_state) %>;
</script>