зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1399605 - [intersection-observer] Check if target is actually being observed when unobserving. r=mrbkap
--HG-- extra : rebase_source : d3c8c012dba2941b230cdfbf332ab3c77b7a26ef
This commit is contained in:
Родитель
2e41783ce1
Коммит
2b102d3c56
|
@ -161,6 +161,10 @@ DOMIntersectionObserver::Observe(Element& aTarget)
|
|||
void
|
||||
DOMIntersectionObserver::Unobserve(Element& aTarget)
|
||||
{
|
||||
if (!mObservationTargets.Contains(&aTarget)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mObservationTargets.Length() == 1) {
|
||||
Disconnect();
|
||||
return;
|
||||
|
|
|
@ -623,6 +623,7 @@ skip-if = toolkit == 'android'
|
|||
[test_bug1375050.html]
|
||||
[test_bug1381710.html]
|
||||
[test_bug1384658.html]
|
||||
[test_bug1399605.html]
|
||||
skip-if = toolkit == 'android'
|
||||
[test_caretPositionFromPoint.html]
|
||||
[test_change_policy.html]
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 1399605</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1399605">Mozilla Bug 1399605</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
<div id="target"></div>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
let observer = new IntersectionObserver(function() {
|
||||
ok(true, "we are still observing");
|
||||
SimpleTest.finish();
|
||||
});
|
||||
observer.observe(document.getElementById('target'));
|
||||
observer.unobserve(document.getElementById('content'));
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
<div id="log">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче