You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does resizeObserver allow you to observe an element in another (same-origin) document? IntersectionObserver does, and there's some amount of code complexity associated with it. Should resizeObserver be arbitrarily different, and, if so, why?
The text was updated successfully, but these errors were encountered:
<script type="text/javascript">
function test0() {
let ro = new ResizeObserver(entries => {
for (let entry of entries) {
if (entry.target.parentNode) {
entry.target.parentNode.removeChild(entry.target);
}
}
});
let frame1 = parent.document.querySelector('#frame1');
let frame2 = parent.document.querySelector('#frame2');
ro.observe(frame1);
ro.observe(frame2);
}
test0();
</script>
<script>
var ro = new ResizeObserver( entries => {
for (let entry of entries) {
console.log("Observe targets from other document.");
}
});
let target1 = parent.frames[0].document.querySelector('#target1');
ro.observe(target1);
</script>
The depth of target: Calculate the depth of target in frame tree not just current frame.
<div style="width:100px;height:100px;">t1
<div id="target" style="width:100px;height:100px;">t2
<iframe id="iframe" src="./frame1.html" onload="depth()"></iframe>
</div>
</div>
<script>
function depth() {
let target = document.querySelector('#target');
let target1 = document.querySelector('#iframe').contentDocument.querySelector('#target1');
var ro = new ResizeObserver( entries => {
for (let entry of entries) {
if (entry.target == target) {
target1.style.width = "200px";
console.log("There should no error event. target1 is deeper than target.");
}
}
});
ro.observe(target);
ro.observe(target1);
}
</script>
https://drafts.csswg.org/resize-observer-1/#dom-resizeobserver-observe
Does resizeObserver allow you to observe an element in another (same-origin) document? IntersectionObserver does, and there's some amount of code complexity associated with it. Should resizeObserver be arbitrarily different, and, if so, why?
The text was updated successfully, but these errors were encountered: