function fieldToDom(field) {
    if (field.name && field.EDITABLE) {
      var container = goog.dom.createDom('field', null, field.getValue());
      container.setAttribute('name', field.name);
      element.appendChild(container);
    }
  }
Encode a block subtree as XML.
@param {!Blockly.Block} block The root block to encode.
@return {!Element} Tree of XML elements.