 
   name:
     get: ->
-      @inputElement.name
+      @inputElement?.name
 
   value:
     get: ->
-      @inputElement.value
+      @inputElement?.value
     set: (@defaultValue) ->
       @editorController?.loadHTML(@defaultValue)
 

  toolbarElement:
    get: ->
      if @hasAttribute("toolbar")
        document.getElementById(@getAttribute("toolbar"))
      else
        toolbarId = "trix-toolbar-#{@trixId}"
        @setAttribute("toolbar", toolbarId)
        element = makeElement("trix-toolbar", id: toolbarId)

  inputElement:
    get: ->
      if @hasAttribute("input")
        @ownerDocument?.getElementById(@getAttribute("input"))
      else if @parentElement
        inputId = "trix-input-#{@trixId}"
        @setAttribute("input", inputId)
        element = makeElement("input", type: "hidden", id: inputId)
