--- title: IntersectionObserver.root slug: Web/API/IntersectionObserver/root translation_of: Web/API/IntersectionObserver/root ---

root 属性用来获取当前 intersectionObserver 实例的根元素。

语法

intersectionObserver.root;

规范

Specification Status Comment
{{SpecName('IntersectionObserver', '#dom-intersectionobserver-root', 'IntersectionObserver')}} {{Spec2('IntersectionObserver')}} Initial definition

浏览器兼容性

{{CompatibilityTable}}
Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{CompatChrome(51.0)}} {{CompatNo}}[1] {{CompatNo}}[2] {{CompatNo}} {{CompatUnknown}} {{CompatUnknown}}
Feature Android Android Webview Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support {{CompatNo}} {{CompatChrome(51.0)}} {{CompatNo}}[2] {{CompatNo}} {{CompatNo}} {{CompatUnknown}} {{CompatUnknown}} {{CompatChrome(51.0)}}

[1]  实现于 Windows Insider Preview Build 14986

[2] 实现于 {{geckoRelease("53.0")}},但默认处于关闭状态,需要打开dom.IntersectionObserver.enabled。