From 921d2a8182de81b58d12d0cb7c844c69e2bfdd6a Mon Sep 17 00:00:00 2001 From: Stefan Zager Date: Fri, 7 Sep 2018 12:07:04 -0700 Subject: [PATCH 1/2] Fix edge case for reporting transitions If the first threshold value is non-zero, then no notification should happen if isIntersecting changes but thresholdIndex does not. --- index.bs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/index.bs b/index.bs index 2b9d8b93..50aa7e68 100644 --- a/index.bs +++ b/index.bs @@ -620,7 +620,10 @@ To run the update intersection observations steps for a zero area); otherwise, let |isIntersecting| be false. 8. If |targetArea| is non-zero, let |intersectionRatio| be |intersectionArea| divided by |targetArea|.
Otherwise, let |intersectionRatio| be 1 if |isIntersecting| is true, or 0 if |isIntersecting| is false. - 9. Let |thresholdIndex| be the index of the first entry in |observer|.{{thresholds}} whose value is greater than |intersectionRatio|, or the length of |observer|.{{thresholds}} if |intersectionRatio| is greater than or equal to the last entry in |observer|.{{thresholds}}. + 9. Let |thresholdIndex| be: + * 0 if |intersectionRatio| is less than or equal to the first value in |observer|.{{thresholds}}, or + * the length of |observer|.{{thresholds}} if |intersectionRatio| is greater than or equal to the last value in |observer|.{{thresholds}}, otherwise + * the index of the first value in |observer|.{{thresholds}} whose value is greater than |intersectionRatio|. 10. Let |intersectionObserverRegistration| be the {{IntersectionObserverRegistration}} record in |target|'s internal {{[[RegisteredIntersectionObservers]]}} slot whose {{IntersectionObserverRegistration/observer}} property is equal to |observer|. @@ -628,8 +631,9 @@ To run the update intersection observations steps for a {{IntersectionObserverRegistration/previousThresholdIndex}} property. 12. Let |previousIsIntersecting| be the |intersectionObserverRegistration|'s {{IntersectionObserverRegistration/previousIsIntersecting}} property. - 13. If |thresholdIndex| does not equal |previousThresholdIndex| or if - |isIntersecting| does not equal |previousIsIntersecting|, + 13. If: + * |thresholdIndex| does not equal |previousThresholdIndex| or + * |isIntersecting| does not equal |previousIsIntersecting| and the first value in |observer|.{{thresholds}} is 0. queue an IntersectionObserverEntry, passing in |observer|, |time|, |rootBounds|, |boundingClientRect|, |intersectionRect|, |isIntersecting|, and |target|. From 36ccfe55c2cc486b225b13c30d4e2bf0aa5ad610 Mon Sep 17 00:00:00 2001 From: Stefan Zager Date: Fri, 7 Sep 2018 12:17:20 -0700 Subject: [PATCH 2/2] punctuation --- index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.bs b/index.bs index 50aa7e68..1d5e289c 100644 --- a/index.bs +++ b/index.bs @@ -633,7 +633,7 @@ To run the update intersection observations steps for a {{IntersectionObserverRegistration/previousIsIntersecting}} property. 13. If: * |thresholdIndex| does not equal |previousThresholdIndex| or - * |isIntersecting| does not equal |previousIsIntersecting| and the first value in |observer|.{{thresholds}} is 0. + * |isIntersecting| does not equal |previousIsIntersecting| and the first value in |observer|.{{thresholds}} is 0 queue an IntersectionObserverEntry, passing in |observer|, |time|, |rootBounds|, |boundingClientRect|, |intersectionRect|, |isIntersecting|, and |target|.