{"action":"created","issue":{"url":"https://api.github.com/repos/ampproject/amphtml/issues/3525","repository_url":"https://api.github.com/repos/ampproject/amphtml","labels_url":"https://api.github.com/repos/ampproject/amphtml/issues/3525/labels{/name}","comments_url":"https://api.github.com/repos/ampproject/amphtml/issues/3525/comments","events_url":"https://api.github.com/repos/ampproject/amphtml/issues/3525/events","html_url":"https://github.com/ampproject/amphtml/pull/3525","id":159535999,"number":3525,"title":"[WIP] [DO NOT SUBMIT] Shadow root scoping","user":{"login":"dvoytenko","id":726049,"avatar_url":"https://avatars.githubusercontent.com/u/726049?v=3","gravatar_id":"","url":"https://api.github.com/users/dvoytenko","html_url":"https://github.com/dvoytenko","followers_url":"https://api.github.com/users/dvoytenko/followers","following_url":"https://api.github.com/users/dvoytenko/following{/other_user}","gists_url":"https://api.github.com/users/dvoytenko/gists{/gist_id}","starred_url":"https://api.github.com/users/dvoytenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dvoytenko/subscriptions","organizations_url":"https://api.github.com/users/dvoytenko/orgs","repos_url":"https://api.github.com/users/dvoytenko/repos","events_url":"https://api.github.com/users/dvoytenko/events{/privacy}","received_events_url":"https://api.github.com/users/dvoytenko/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-06-10T00:16:16Z","updated_at":"2016-06-13T17:41:13Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ampproject/amphtml/pulls/3525","html_url":"https://github.com/ampproject/amphtml/pull/3525","diff_url":"https://github.com/ampproject/amphtml/pull/3525.diff","patch_url":"https://github.com/ampproject/amphtml/pull/3525.patch"},"body":"This is about 50% working hackery. Important points:\r\n\r\n1. Scope: window or ampdoc. Any AMP service falls into one of these two scopes and has to be thus split in our codebase. Examples: vsync is window-scoped, while viewport is ampdoc scoped.\r\n2. We may want to impose harsher window/document globals restrictions.\r\n3. Bunch of work needed to re-install AMP in a new shadow root. E.g. all extensions need to keep their CSS and apply it again in the shadow root, etc. For now, I only reapply main `amp.css` to demonstrate what needs to be done.\r\n4. Similarly, lots of stubbing complications since we can no longer rely on `</head>` == all extensions are now. We had this problem before and so this might be a good time to try to solve it.\r\n5. The hardest part so far: URL resolution. Since the URLs are likely to be sub-path'd, we need to resolve `src`, `href`, etc against the document's URL, not shell's. For instance, AMP doc URL is `/doc1.amp.html` and shell URL is `/shell/doc1.amp.html` have different dir base. There's a way, of course, to ensure that the general URL structure remains the same between the two and thus this becomes a non-issue, e.g. `/doc1.amp.html` -> `/doc1.shell.html`.\r\n"},"comment":{"url":"https://api.github.com/repos/ampproject/amphtml/issues/comments/225654460","html_url":"https://github.com/ampproject/amphtml/pull/3525#issuecomment-225654460","issue_url":"https://api.github.com/repos/ampproject/amphtml/issues/3525","id":225654460,"user":{"login":"dvoytenko","id":726049,"avatar_url":"https://avatars.githubusercontent.com/u/726049?v=3","gravatar_id":"","url":"https://api.github.com/users/dvoytenko","html_url":"https://github.com/dvoytenko","followers_url":"https://api.github.com/users/dvoytenko/followers","following_url":"https://api.github.com/users/dvoytenko/following{/other_user}","gists_url":"https://api.github.com/users/dvoytenko/gists{/gist_id}","starred_url":"https://api.github.com/users/dvoytenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dvoytenko/subscriptions","organizations_url":"https://api.github.com/users/dvoytenko/orgs","repos_url":"https://api.github.com/users/dvoytenko/repos","events_url":"https://api.github.com/users/dvoytenko/events{/privacy}","received_events_url":"https://api.github.com/users/dvoytenko/received_events","type":"User","site_admin":false},"created_at":"2016-06-13T17:41:13Z","updated_at":"2016-06-13T17:41:13Z","body":"@tdrl Correct, this is specifically for PWA explorations."}}
{"actor":{"display_login":"dvoytenko"}}