A TagRef can be only resolved when the corresponding node was added to the browser DOM. While this is the most common use case, we could alternatively take an implicit context in TagRef.dom and Attribute.get. For this to work, dom has to use querySelector("#" + id) instead of document.getElementById(id).