{"action":"created","issue":{"url":"https://api.github.com/repos/aaronc/freactive/issues/45","labels_url":"https://api.github.com/repos/aaronc/freactive/issues/45/labels{/name}","comments_url":"https://api.github.com/repos/aaronc/freactive/issues/45/comments","events_url":"https://api.github.com/repos/aaronc/freactive/issues/45/events","html_url":"https://github.com/aaronc/freactive/issues/45","id":84656084,"number":45,"title":"appendChild won't work with Polymer 1.0 \"shady DOM\"","user":{"login":"sparkofreason","id":2601019,"avatar_url":"https://avatars.githubusercontent.com/u/2601019?v=3","gravatar_id":"","url":"https://api.github.com/users/sparkofreason","html_url":"https://github.com/sparkofreason","followers_url":"https://api.github.com/users/sparkofreason/followers","following_url":"https://api.github.com/users/sparkofreason/following{/other_user}","gists_url":"https://api.github.com/users/sparkofreason/gists{/gist_id}","starred_url":"https://api.github.com/users/sparkofreason/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sparkofreason/subscriptions","organizations_url":"https://api.github.com/users/sparkofreason/orgs","repos_url":"https://api.github.com/users/sparkofreason/repos","events_url":"https://api.github.com/users/sparkofreason/events{/privacy}","received_events_url":"https://api.github.com/users/sparkofreason/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":27,"created_at":"2015-06-03T16:41:03Z","updated_at":"2015-06-11T18:50:05Z","closed_at":null,"body":"See [this discussion](https://groups.google.com/forum/#!topic/polymer-dev/xlN8C-MQhig).\r\n\r\nBottom line: for performance reasons, Polymer 1.0 gives the option of not polyfilling the full shadow DOM spec by overwriting DOM API's like `appendChild`. For at least some Polymer elements, we need to execute slightly different code to ensure that things render correctly, allowing the element to be notified when its content has changed. I played with this a bit in my local copy of freactive, and was able to make it work by adding a `register-append-child` function in `freactive.dom`:\r\n\r\n```clojure\r\n(def ^:private append-child-fns\r\n  (atom {:default (fn [parent node] (.appendChild parent node))}))\r\n\r\n(defn register-append-child\r\n  [tag append-child-fn]\r\n  (swap! append-child-fns assoc (.toUpperCase (name tag)) append-child-fn))\r\n\r\n(defn- do-append-or-insert-child [parent node before]\r\n  (if before\r\n    (.insertBefore parent node before)\r\n    (if-let [append-child-fn (@append-child-fns (.-tagName parent))]\r\n      (append-child-fn parent node)\r\n      ((@append-child-fns :default) parent node))))\r\n```\r\n And then calling it like this:\r\n```clojure\r\n(dom/register-append-child :paper-button \r\n                           (fn [parent node] \r\n                             (.appendChild (js/Polymer.dom parent) node)))\r\n```\r\nThe design maybe needs some more thought. Seems onerous to have to register for every element, maybe makes more sense to provide a predicate function. Probably could streamline performance a bit as well. I assume `insertBefore` has the same issue, but haven't tested."},"comment":{"url":"https://api.github.com/repos/aaronc/freactive/issues/comments/111237497","html_url":"https://github.com/aaronc/freactive/issues/45#issuecomment-111237497","issue_url":"https://api.github.com/repos/aaronc/freactive/issues/45","id":111237497,"user":{"login":"aaronc","id":48918,"avatar_url":"https://avatars.githubusercontent.com/u/48918?v=3","gravatar_id":"","url":"https://api.github.com/users/aaronc","html_url":"https://github.com/aaronc","followers_url":"https://api.github.com/users/aaronc/followers","following_url":"https://api.github.com/users/aaronc/following{/other_user}","gists_url":"https://api.github.com/users/aaronc/gists{/gist_id}","starred_url":"https://api.github.com/users/aaronc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaronc/subscriptions","organizations_url":"https://api.github.com/users/aaronc/orgs","repos_url":"https://api.github.com/users/aaronc/repos","events_url":"https://api.github.com/users/aaronc/events{/privacy}","received_events_url":"https://api.github.com/users/aaronc/received_events","type":"User","site_admin":false},"created_at":"2015-06-11T18:50:05Z","updated_at":"2015-06-11T18:50:05Z","body":"With this approach all child elements would use the same `as-velem` unless some plugin handler changed that..."}}