I have read several articles on the basic underlying structure of custom elements (implemented outside of polymer).
Questions:
1. In one of those articles, I understand it to say that in the "ready" (i.e.createdCallback) function, the
"document" object points to the calling document's DOM and the "document._currentScript.ownerDocument"
points to the shadowRoot (i.e. DOM) of the custom element.
Now in the polymer-element environment the "ready" callback is different.
The "document._currentScript.ownerDocument" does not point to the shadowRoot; it is null.
Instead you provide an array of all nodes with "id"s under document.$; and also gives
access to the polymer-element's attributes (as I understand this(?)).
Yet the custom element object at "document.getElementsByTagName('<polymer-custom-element-name>')[0].shadowRoot"
points to the shadowRoot's element for the custom-element
Why not map "document.getElementsByTagName('polymer-custom-element')[0].shadowRoot"
to the document._currentScript.ownerDocument?
2. To what does the "document" object point in the ready callback function
3. To what does the "this" object point in the ready callback function?
I think I understand the idea of keeping the custom element encapsulated. But the callback routines are single threaded, at least as
I understand. So providing access to the shadowRoot in one of its callback routines should not be a problem. At that time the
underlying structure is stable. (Am I wrong in this understanding)? Why do I want this. Because, then the custom element
is just like the main document. I do not have to write different code (e.g. document.$) when I am working in a custom document
callback environment.