例えば
チャットUIを作っていて、
textInputという入力カーソル用のレイヤーの中にinput要素を突っ込みたい時はこのように書きます
//input要素を作る(この時点ではまだレイヤーには反映されない。)
inputElement = document.createElement("input")
...
inputElement.placeholder = "Type a comment"
inputElement.value = ""
inputElement.focus()
inputElement.onkeyup = (e) ->
# Draw the message
if e.keyCode is 13
//この中にEnterキーを押した時の挙動を書く
...
//textInputLayerというレイヤーにinput要素を貼り付ける
textInputLayer._element.appendChild(inputElement)
今回モデルにしたプロジェクトはこちら(公式サイトのギャラリーページにあります)
chat bubbles