 	write: NotSupported
 	writeln: NotSupported
 
-exports.createDocument = () ->
+exports.createDocument = ->
 	new HTMLDocument()
 
 exports.registerGlobals = (g) ->

			when Node.DOCUMENT_FRAGMENT_NODE
				NotSupported() # TODO

Node::__defineGetter__ 'nodeName', () -> @_private.nodeName
Node::__defineSetter__ 'nodeName', (v) -> @_private.nodeName = v?.toUpperCase()
Node::__defineGetter__ 'previousSibling', () -> @parentNode?.childNodes[@_private.childIndex-1]
Node::__defineSetter__ 'nextSibling', () -> @parentNode?.childNodes[@_private.childIndex+1]
Node::__defineGetter__ 'parentNode', () -> @_private.parentNode
Node::__defineSetter__ 'parentNode', (v) ->
	if v isnt null
		throw Error "Must use one of appendChild, insertBefore, etc. to give a Node a new parent."
	@_private.parentNode?.removeChild @
	@_private.parentNode = null
	@_private.childIndex = -1
Node::__defineGetter__ 'firstChild', () -> @childNodes[0]
Node::__defineGetter__ 'lastChild', () -> @childNodes[-1]

class Entity extends Node
	constructor: (a...) ->

			matcher: matcher.init(global, @)
		}
	# over-ride the child manipulators, you can't touch .head or .body
	hasChildNodes: -> true
	insertBefore: NotSupported
	appendChild: NotSupported
	removeChild: NotSupported
