 				new MutationEvent()
 			else
 				new Event()
-	# createNodeIterator: NotSupported
-	# createProcessingInstruction: NotSupported
-	# createRange: NotSupported
 	createTextNode: (text) ->
 		new Text(text)
-	# createTreeWalker: NotSupported
-	# elementFromPoint: NotSupported
-	# evaluate: NotSupported
-	# execCommand: NotSupported
-	# getCSSCanvasContext: NotSupported
 	getElementById: (id) ->
 		@_private.idMap[id]
-	# getOverrideStyle: NotSupported
-	# getSelection: NotSupported
-	# queryCommandEnabled: NotSupported
-	# queryCommandIndeterm: NotSupported
-	# queryCommandState: NotSupported
-	# queryCommandSupported: NotSupported
-	# queryCommandValue: NotSupported
 
 class HTMLDocument extends Document
 	constructor: () ->

	constructor: (a...) ->
		a[2] ?= Node.ELEMENT_NODE
		super a...
		@__defineGetter__ 'tagName', () => @nodeName
		@__defineGetter__ 'innerHTML', () =>
			h = []
			for c in @childNodes
				h.push c.toString()
			return h.join('')
		@__defineSetter__ 'innerHTML', (v) =>
			fragment = htmlparse(v, @ownerDocument)
			for c in @childNodes
				c._private.parentNode = null
				c._private.childIndex = -1
			@childNodes.length = 0
			@appendChild fragment
		@__defineGetter__ 'innerText', () =>
			t = []
			for c in @childNodes
				if c.nodeType in [Node.TEXT_NODE, Node.CDATA_SECTION_NODE]
					t.push c.toString(false, false)
				else if c.nodeType isnt Node.COMMENT_NODE
					t.push c.innerText
			return t.join('')
	getElementsByClassName: (name) ->
		ret = []
		for c in @childNodes

			ret[r++] = indent + "</#{name}>" + newline
		ret.join('')

Element::__defineGetter__ 'tagName', () -> @nodeName
Element::__defineGetter__ 'innerHTML', () ->
	h = []
	for c in @childNodes
		h.push c.toString()
	return h.join('')
Element::__defineSetter__ 'innerHTML', (v) ->
	fragment = htmlparse(v, @ownerDocument)
	for c in @childNodes
		c._private.parentNode = null
		c._private.childIndex = -1
	@childNodes.length = 0
	@appendChild fragment
Element::__defineGetter__ 'innerText', () ->
	t = []
	for c in @childNodes
		if c.nodeType in [Node.TEXT_NODE, Node.CDATA_SECTION_NODE]
			t.push c.toString(false, false)
		else if c.nodeType isnt Node.COMMENT_NODE
			t.push c.innerText
	return t.join('')

class Attr extends Node
	constructor: (name, value) ->
		super name, value, Node.ATTRIBUTE_NODE, null
