Closed radix closed 10 years ago
Unfortunately neither chrome nor firefox are giving a traceback for this error, so it's really hard to track down.
Sorry I never got back to you on this issue. So, the question is, whose responsibility is this incompatibility? Should Dommy work around it, or should this be filed as a bug against Polymer? Do you have any opinions on that?
Good question. I don't think polymer will fix that as it's a deliberate trade-off for performance reason (I believe). On the other hand dommy
can't reasonably implement a work around specific to polymer.
I guess your best option is not to use dommy to select document.body
and relies on good old DOM:
(dommy/append! js/document.body "foo")
Hmm, not sure why you're getting that issue as (sel1 :body)
should just be expanding to js/document.body
: https://github.com/Prismatic/dommy/blob/master/src/dommy/macros.clj#L70
Ah sorry, I re-read your initial comment.. the issue is in append!
, not sel1
: https://github.com/Prismatic/dommy/blob/master/src/dommy/core.cljs#L74
The parent node in append! gets "coerced" to a node with template/->node-like
. I wonder if it would be better if it was assumed that the parent is a valid dom node, instead of being looser. I'm not sure if anyone is taking advantage of it anyways..
I believe this might help understanding the issue.
One theory could be that dommy
somehow installs its own properties to a polymer wrapped
element then later on access the non-wrapped
version.
FYI I got this issue and fixed it by using (.querySelector js/document "body")
to select the body.
I don't think there is any other option when using polymer's polyfill as using document.body
is not supported.
Dommy no longer coerces nodes (see https://github.com/Prismatic/dommy/pull/85), and @jeluard's fix (using the native querySelector for body) seems reasonable for use with polymer.
I have no idea whose fault this is, but I want to file the ticket so it's at least known. Whenever I have polymer enabled in Chrome, (dommy/append! (sel1 :body) "foo") fails, with the following error:
"Don't know how to make node from: #<[object HTMLBodyElement]>"
If I use (sel1 :#mybod) (or some other way to get the body), it works.
Maybe Polymer somehow changes the semantics of "document.body"?
To be specific, I'm only including Polymer's platform/platform.js in order to get this behavior.