fixing null reference when passing undefined to virtual dom tree
This commit is contained in:
parent
960e9f2536
commit
a7a9447cd6
8 changed files with 23 additions and 7 deletions
|
|
@ -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<String text | VirtualElement virtualElement | Children children></code></pre>
|
||||
<ul>
|
||||
<li><p><strong>String selector</strong></p>
|
||||
|
|
@ -216,7 +216,7 @@ where:
|
|||
<p><code>{ style: {border: "1px solid red"} }</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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue