fixes #50 - store reference to element's own document, not top-level document
compiled