{"action":"created","issue":{"url":"https://api.github.com/repos/guardian/scribe/issues/329","labels_url":"https://api.github.com/repos/guardian/scribe/issues/329/labels{/name}","comments_url":"https://api.github.com/repos/guardian/scribe/issues/329/comments","events_url":"https://api.github.com/repos/guardian/scribe/issues/329/events","html_url":"https://github.com/guardian/scribe/issues/329","id":55962555,"number":329,"title":"Fails to retain focus due to invalid range comparisons when in ShadowDOM","user":{"login":"bigdave","id":45986,"avatar_url":"https://avatars.githubusercontent.com/u/45986?v=3","gravatar_id":"","url":"https://api.github.com/users/bigdave","html_url":"https://github.com/bigdave","followers_url":"https://api.github.com/users/bigdave/followers","following_url":"https://api.github.com/users/bigdave/following{/other_user}","gists_url":"https://api.github.com/users/bigdave/gists{/gist_id}","starred_url":"https://api.github.com/users/bigdave/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bigdave/subscriptions","organizations_url":"https://api.github.com/users/bigdave/orgs","repos_url":"https://api.github.com/users/bigdave/repos","events_url":"https://api.github.com/users/bigdave/events{/privacy}","received_events_url":"https://api.github.com/users/bigdave/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-01-29T21:51:44Z","updated_at":"2015-02-02T18:30:46Z","closed_at":null,"body":"While trying to get Scribe to work within a Polymer-based application, we ran into a problem. The proof-of-concept polymer element for Scribe keeps the editor in the light DOM, which is fine for that example, but when using the editor within a Polymer component's Shadow DOM, the editor fails to keep focus, and throws exceptions.  It appears that it is attempting to compare ranges, assuming that the editor is present in `window.document`, when in fact is resides in the Shadow DOM document of the Polymer element.\r\n\r\nThis results in the error `Uncaught WrongDocumentError: Failed to execute 'compareBoundaryPoints' on 'Range': The source range is in a different document than this range. selection.js:52`.\r\n\r\nI have setup a [proof of concept](http://bigdave.github.io/scribe-editor-element/) for this error, which must be viewed in a browser which actually has a Web Components Shadow DOM implementation such as Chrome, Opera, or Vivaldi. The behavior will not appear in FireFox (unless you're using a fancy nightly with the toggle turned on)."},"comment":{"url":"https://api.github.com/repos/guardian/scribe/issues/comments/72510352","html_url":"https://github.com/guardian/scribe/issues/329#issuecomment-72510352","issue_url":"https://api.github.com/repos/guardian/scribe/issues/329","id":72510352,"user":{"login":"miztroh","id":2515209,"avatar_url":"https://avatars.githubusercontent.com/u/2515209?v=3","gravatar_id":"","url":"https://api.github.com/users/miztroh","html_url":"https://github.com/miztroh","followers_url":"https://api.github.com/users/miztroh/followers","following_url":"https://api.github.com/users/miztroh/following{/other_user}","gists_url":"https://api.github.com/users/miztroh/gists{/gist_id}","starred_url":"https://api.github.com/users/miztroh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miztroh/subscriptions","organizations_url":"https://api.github.com/users/miztroh/orgs","repos_url":"https://api.github.com/users/miztroh/repos","events_url":"https://api.github.com/users/miztroh/events{/privacy}","received_events_url":"https://api.github.com/users/miztroh/received_events","type":"User","site_admin":false},"created_at":"2015-02-02T18:30:46Z","updated_at":"2015-02-02T18:30:46Z","body":"window.getSelection() should (once the Chrome fix is released) return a valid selection even from Shadow DOM contexts."}}