tildeio/htmlbars — pull request #152 by rwjblue (2014-11-22 02:51:41+00:00)
Title: Allow disalbing component generation.

Usage via `compile` or `compileSpec`:

```javascript
import { compileSpec } from 'htmlbars-compiler/compile';

var t = "Howdy {{name}}";
var spec = compileSpec(t, { disalbeComponentGeneration: true });
```

**Above template with component generation enabled:**

```javascript
(function() {
var child0 = (function() {
function build(dom) {
var el0 = dom.createDocumentFragment();
var el1 = dom.createTextNode("Howdy ");
dom.appendChild(el0, el1);
var el1 = dom.createTextNode("");
dom.appendChild(el0, el1);
return el0;
}
var cachedFragment;
return function template(context, env, contextualElement) {
var dom = env.dom, hooks = env.hooks, get = env.get;
dom.detectNamespace(contextualElement);
if (cachedFragment === undefined) {
cachedFragment = build(dom);
}
var fragment = dom.cloneNode(cachedFragment, true);
dom.repairClonedNode(fragment,[1]);
var morph0 = dom.createMorphAt(fragment,0,1,contextualElement);
hooks.content(morph0, "name", context, [], {}, {type:"id",morph:morph0}, env);
return fragment;
};
}())
function build(dom) {
var el0 = dom.createDocumentFragment();
var el1 = dom.createTextNode("");
dom.appendChild(el0, el1);
var el1 = dom.createTextNode("");
dom.appendChild(el0, el1);
return el0;
}
var cachedFragment;
return function template(context, env, contextualElement) {
var dom = env.dom, hooks = env.hooks, get = env.get;
dom.detectNamespace(contextualElement);
if (cachedFragment === undefined) {
cachedFragment = build(dom);
}
var fragment = dom.cloneNode(cachedFragment, true);
dom.repairClonedNode(fragment,[0,1]);
var morph0 = dom.createUnsafeMorphAt(fragment,0,1,contextualElement);
hooks.component(morph0, "x-foo", context, {}, {type:"id",paramTypes:[],hashTypes:{},render:child0,morph:morph0}, env);
return fragment;
};
}())
```

**Above template with component generation disabled:**

```javascript
(function() {
function build(dom) {
var el0 = dom.createElement("x-foo");
var el1 = dom.createTextNode("Howdy ");
dom.appendChild(el0, el1);
return el0;
}
var cachedFragment;
return function template(context, env, contextualElement) {
var dom = env.dom, hooks = env.hooks, get = env.get;
dom.detectNamespace(contextualElement);
if (cachedFragment === undefined) {
cachedFragment = build(dom);
}
var fragment = dom.cloneNode(cachedFragment, true);
var morph0 = dom.createMorphAt(fragment,0,-1);
hooks.content(morph0, "name", context, [], {}, {type:"id",morph:morph0}, env);
return fragment;
};
}())
```