   doc.createTextNode(text)
 
 
+# Some browsers support `innerText` while others use `textContent`
+textAttr = do ->
+  element = doc.createElement('div')
+  if 'textContent' of element then 'textContent' else 'innerText'
+
+
 directAttributes =
   'className': 'className'
   'id': 'id'
   'html': 'innerHTML'
-  'text': 'textContent'
+  'text': textAttr
   'value': 'value'
 
 

doc = @document


isElement = (el) ->
  el?.nodeType and el.nodeType is doc.ELEMENT_NODE


isText = (el) ->
  el?.nodeType and el.nodeType is doc.TEXT_NODE


merge = (left, right) ->

        el.setAttribute(attr, value)
      else
        if attr is 'html' and typeof value isnt 'string'
          el.removeChild(el.lastChild) while el.lastChild
          if isElement(value)
            el.appendChild(value)
          else if value instanceof Array
            exports.appendChildren(el, value)
        else if attr is 'text' and isText(el)
          el.nodeValue = value
        else
          el[directAttr] = value
  null


class SafeString extends exports.Element
