{"action":"created","issue":{"url":"https://api.github.com/repos/WICG/IntersectionObserver/issues/135","repository_url":"https://api.github.com/repos/WICG/IntersectionObserver","labels_url":"https://api.github.com/repos/WICG/IntersectionObserver/issues/135/labels{/name}","comments_url":"https://api.github.com/repos/WICG/IntersectionObserver/issues/135/comments","events_url":"https://api.github.com/repos/WICG/IntersectionObserver/issues/135/events","html_url":"https://github.com/WICG/IntersectionObserver/pull/135","id":158764695,"number":135,"title":"Add a polyfill for IntersectionObserver","user":{"login":"philipwalton","id":326742,"avatar_url":"https://avatars.githubusercontent.com/u/326742?v=3","gravatar_id":"","url":"https://api.github.com/users/philipwalton","html_url":"https://github.com/philipwalton","followers_url":"https://api.github.com/users/philipwalton/followers","following_url":"https://api.github.com/users/philipwalton/following{/other_user}","gists_url":"https://api.github.com/users/philipwalton/gists{/gist_id}","starred_url":"https://api.github.com/users/philipwalton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philipwalton/subscriptions","organizations_url":"https://api.github.com/users/philipwalton/orgs","repos_url":"https://api.github.com/users/philipwalton/repos","events_url":"https://api.github.com/users/philipwalton/events{/privacy}","received_events_url":"https://api.github.com/users/philipwalton/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2016-06-06T20:15:52Z","updated_at":"2016-06-08T15:22:29Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/WICG/IntersectionObserver/pulls/135","html_url":"https://github.com/WICG/IntersectionObserver/pull/135","diff_url":"https://github.com/WICG/IntersectionObserver/pull/135.diff","patch_url":"https://github.com/WICG/IntersectionObserver/pull/135.patch"},"body":"This script builds on top of the original work done in #121 with the following changes:\r\n\r\n- Adds support for the `rootMargin` property\r\n- Adds logic to account for parent elements with non-visible overflow\r\n- Adds support for elements on a delayed intersection (e.g. CSS transitions)\r\n- Adds detection of elements on the boundary\r\n- Adds detection of zero-sized elements within root's bounds\r\n- Updates to support targets and roots being added/removed from the DOM\r\n- Removes newer ES6 constructs (like Map) for broader support\r\n\r\nWith these changes, this polyfill test suite passes in native implementations (Chrome 52+), the latest version of all major browsers, and IE back to version 8 (I didn't test 6-7, but they may work as well).\r\n\r\nTODO:\r\n\r\nThis version uses polling on a 100ms timeout to get the greatest legacy support. I plan to add new logic to use a combination of `scroll`, `resize`, and MutationObserver listeners + temporary polling to detect CSS transitions soon, but I wanted to start the pull request with my initial set of changes so we could discuss.\r\n\r\n/cc @surma @ojanvafai @triblondon "},"comment":{"url":"https://api.github.com/repos/WICG/IntersectionObserver/issues/comments/224624317","html_url":"https://github.com/WICG/IntersectionObserver/pull/135#issuecomment-224624317","issue_url":"https://api.github.com/repos/WICG/IntersectionObserver/issues/135","id":224624317,"user":{"login":"philipwalton","id":326742,"avatar_url":"https://avatars.githubusercontent.com/u/326742?v=3","gravatar_id":"","url":"https://api.github.com/users/philipwalton","html_url":"https://github.com/philipwalton","followers_url":"https://api.github.com/users/philipwalton/followers","following_url":"https://api.github.com/users/philipwalton/following{/other_user}","gists_url":"https://api.github.com/users/philipwalton/gists{/gist_id}","starred_url":"https://api.github.com/users/philipwalton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philipwalton/subscriptions","organizations_url":"https://api.github.com/users/philipwalton/orgs","repos_url":"https://api.github.com/users/philipwalton/repos","events_url":"https://api.github.com/users/philipwalton/events{/privacy}","received_events_url":"https://api.github.com/users/philipwalton/received_events","type":"User","site_admin":false},"created_at":"2016-06-08T15:22:28Z","updated_at":"2016-06-08T15:22:28Z","body":"> @philipwalton Could an argument be made that for browsers that lack MutationObserver, an implementation that uses scroll events only is 'good enough'.\r\n\r\nThe only problem with that is the scroll event doesn't bubble, so in IE8, if a dev built a site with multiple scrollable containers (or even a single scrollable container that wasn't `<body>`, then a single scroll listener on `document` won't get those events. In newer browsers you can workaround this by adding the scroll handler to the capture phase.\r\n\r\nIn terms of \"good enough\", I do agree that developers should have options. It'd be great if there were a few good versions out there, some that strove for correctness, and some that intentionally didn't support certain features in favor of performance.\r\n\r\nMy opinion is that the version in the spec repo should strive for correctness, as the primary point of the polyfill is to give developers a chance to play around with the API and offer feedback.\r\n\r\nWould the polyfill service be open to maintaining a less correct but more performant version that we could recommend for developers who understand that tradeoffs?"}}
{"actor":{"display_login":"philipwalton"}}