Document function arguments
This commit is contained in:
parent
e56a9a164d
commit
b514fa638b
1 changed files with 16 additions and 0 deletions
|
@ -136,6 +136,22 @@
|
|||
<code-block>
|
||||
return document.createElement("my-component")
|
||||
</code-block>
|
||||
|
||||
<p>
|
||||
Function arguments will be called on the new element.<br>
|
||||
This can be used to easily add custom initialisation logic to elements.
|
||||
</p>
|
||||
<p></p>
|
||||
<code-block>
|
||||
return html.p("Hello", console.log, ", world!")
|
||||
</code-block>
|
||||
<code-block>
|
||||
const element = document.createElement("p")
|
||||
element.innerText = "Hello"
|
||||
console.log(element)
|
||||
element.innerText += ", world!"
|
||||
return element
|
||||
</code-block>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
|
Loading…
Reference in a new issue