fixing null reference when passing undefined to virtual dom tree

This commit is contained in:
Leo Horie 2014-03-20 15:36:52 -04:00
parent 960e9f2536
commit a7a9447cd6
8 changed files with 23 additions and 7 deletions

View file

@ -182,7 +182,7 @@ m("a[href='/dashboard']", {config: m.route}, "Dashboard&q
where:
VirtualElement :: Object { String tag, Attributes attributes, Children children }
Attributes :: Object<any | void config(DOMElement element, Boolean isNew)>
Attributes :: Object<any | void config(DOMElement element, Boolean isInitialized)>
Children :: String text | Array&lt;String text | VirtualElement virtualElement | Children children&gt;</code></pre>
<ul>
<li><p><strong>String selector</strong></p>
@ -216,7 +216,7 @@ where:
<p><code>{ style: {border: &quot;1px solid red&quot;} }</code></p>
</li>
<li><h4 id="the-config-attribute">The <code>config</code> attribute</h4>
<p><strong>void config(DOMElement element, Boolean isNew)</strong> (optional)</p>
<p><strong>void config(DOMElement element, Boolean isInitialized)</strong> (optional)</p>
<p>You can define a non-HTML-standard attribute called <code>config</code>. This special parameter allows you to call methods on the DOM element after it gets created.</p>
<p>This is useful, for example, if you declare a <code>canvas</code> element and want to use the Javascript API to draw:</p>
<pre><code class="lang-javascript">function draw(element, isInitialized) {