--- title: Document.pointerLockElement slug: Web/API/Document/pointerLockElement translation_of: Web/API/DocumentOrShadowRoot/pointerLockElement original_slug: Web/API/DocumentOrShadowRoot/pointerLockElement ---
{{APIRef("DOM")}}

pointerLockElement 特性规定了如在鼠标事件中当目标被锁定时的元素集和。如果指针处于锁定等待中、指针没有被锁定,或者目标在另外一个文档中这几种情况,返回的值null。

语法

var element = document.pointerLockElement;

返回值

An {{domxref("Element")}} or null.

特性

Specification Status Comment
{{SpecName('Pointer Lock','l#extensions-to-the-document-interface','Document')}} {{Spec2('Pointer Lock')}} Extend the Document interface

浏览器兼容

{{ CompatibilityTable() }}

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{ CompatVersionUnknown() }} {{property_prefix("webkit")}} {{CompatVersionUnknown}} {{ CompatVersionUnknown() }} {{property_prefix("moz")}} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}
Unprefixed support {{ CompatVersionUnknown() }} {{CompatUnknown}} {{CompatGeckoDesktop(50)}}      
Feature Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{ CompatUnknown() }} {{CompatVersionUnknown}} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}

相关链接