Fix node linkage

Ensure that the `prev`, `next`, and `parent` attributes are consistently defined for all node types (not just Elements). Also: share code between the `_addDomElement` and `onopentag` methods.