From 310fd066e91f454b990372ffa30e803cc8120975 Mon Sep 17 00:00:00 2001 From: Florian Merz Date: Thu, 11 Feb 2021 12:56:40 +0100 Subject: unslug zh-cn: move --- .../simple_document.cookie_framework/index.html | 218 --------------------- .../web/api/document/elementfrompoint/index.html | 45 ----- .../web/api/document/elementsfrompoint/index.html | 129 ------------ files/zh-cn/web/api/document/fullscreen/index.html | 108 ++++++++++ .../web/api/document/fullscreenenabled/index.html | 82 ++++++++ .../zh-cn/web/api/document/getselection/index.html | 15 -- .../web/api/document/inputencoding/index.html | 21 -- .../web/api/document/mozfullscreen/index.html | 108 ---------- .../api/document/mozfullscreenelement/index.html | 77 -------- .../api/document/mozfullscreenenabled/index.html | 82 -------- .../api/document/onafterscriptexecute/index.html | 44 +++++ .../web/api/document/pointerlockelement/index.html | 105 ---------- .../api/document/readystatechange_event/index.html | 149 ++++++++++++++ .../web/api/document/rouchmove_event/index.html | 171 ---------------- .../zh-cn/web/api/document/stylesheets/index.html | 26 --- .../web/api/document/touchmove_event/index.html | 171 ++++++++++++++++ 16 files changed, 554 insertions(+), 997 deletions(-) delete mode 100644 files/zh-cn/web/api/document/cookie/simple_document.cookie_framework/index.html delete mode 100644 files/zh-cn/web/api/document/elementfrompoint/index.html delete mode 100644 files/zh-cn/web/api/document/elementsfrompoint/index.html create mode 100644 files/zh-cn/web/api/document/fullscreen/index.html create mode 100644 files/zh-cn/web/api/document/fullscreenenabled/index.html delete mode 100644 files/zh-cn/web/api/document/getselection/index.html delete mode 100644 files/zh-cn/web/api/document/inputencoding/index.html delete mode 100644 files/zh-cn/web/api/document/mozfullscreen/index.html delete mode 100644 files/zh-cn/web/api/document/mozfullscreenelement/index.html delete mode 100644 files/zh-cn/web/api/document/mozfullscreenenabled/index.html create mode 100644 files/zh-cn/web/api/document/onafterscriptexecute/index.html delete mode 100644 files/zh-cn/web/api/document/pointerlockelement/index.html create mode 100644 files/zh-cn/web/api/document/readystatechange_event/index.html delete mode 100644 files/zh-cn/web/api/document/rouchmove_event/index.html delete mode 100644 files/zh-cn/web/api/document/stylesheets/index.html create mode 100644 files/zh-cn/web/api/document/touchmove_event/index.html (limited to 'files/zh-cn/web/api/document') diff --git a/files/zh-cn/web/api/document/cookie/simple_document.cookie_framework/index.html b/files/zh-cn/web/api/document/cookie/simple_document.cookie_framework/index.html deleted file mode 100644 index 450751cefa..0000000000 --- a/files/zh-cn/web/api/document/cookie/simple_document.cookie_framework/index.html +++ /dev/null @@ -1,218 +0,0 @@ ---- -title: 简单的cookie框架 -slug: Web/API/Document/cookie/Simple_document.cookie_framework -tags: - - Cookies - - cookie -translation_of: Web/API/Document/cookie/Simple_document.cookie_framework ---- -

一个小型框架: 一个完整的cookies读/写器对Unicode充分支持

- -

由于Cookie只是特殊格式的字符串,因此有时很难管理它们。 以下库旨在通过定义一个与一个Storage 对象部分一致的对象(docCookies)来抽象对document.cookie的访问。

- -

 以下代码也在GitHub上获取。它是基于GNU General Public License v3.0 许可 (许可链接)

- -
- -
/*\
-|*|
-|*|  :: cookies.js ::
-|*|
-|*|  A complete cookies reader/writer framework with full unicode support.
-|*|
-|*|  Revision #1 - September 4, 2014
-|*|
-|*|  https://developer.mozilla.org/en-US/docs/Web/API/document.cookie
-|*|  https://developer.mozilla.org/User:fusionchess
-|*|  https://github.com/madmurphy/cookies.js
-|*|
-|*|  This framework is released under the GNU Public License, version 3 or later.
-|*|  http://www.gnu.org/licenses/gpl-3.0-standalone.html
-|*|
-|*|  Syntaxes:
-|*|
-|*|  * docCookies.setItem(name, value[, end[, path[, domain[, secure]]]])
-|*|  * docCookies.getItem(name)
-|*|  * docCookies.removeItem(name[, path[, domain]])
-|*|  * docCookies.hasItem(name)
-|*|  * docCookies.keys()
-|*|
-\*/
-
-var docCookies = {
-  getItem: function (sKey) {
-    if (!sKey) { return null; }
-    return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1")) || null;
-  },
-  setItem: function (sKey, sValue, vEnd, sPath, sDomain, bSecure) {
-    if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) { return false; }
-    var sExpires = "";
-    if (vEnd) {
-      switch (vEnd.constructor) {
-        case Number:
-          sExpires = vEnd === Infinity ? "; expires=Fri, 31 Dec 9999 23:59:59 GMT" : "; max-age=" + vEnd;
-          break;
-        case String:
-          sExpires = "; expires=" + vEnd;
-          break;
-        case Date:
-          sExpires = "; expires=" + vEnd.toUTCString();
-          break;
-      }
-    }
-    document.cookie = encodeURIComponent(sKey) + "=" + encodeURIComponent(sValue) + sExpires + (sDomain ? "; domain=" + sDomain : "") + (sPath ? "; path=" + sPath : "") + (bSecure ? "; secure" : "");
-    return true;
-  },
-  removeItem: function (sKey, sPath, sDomain) {
-    if (!this.hasItem(sKey)) { return false; }
-    document.cookie = encodeURIComponent(sKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT" + (sDomain ? "; domain=" + sDomain : "") + (sPath ? "; path=" + sPath : "");
-    return true;
-  },
-  hasItem: function (sKey) {
-    if (!sKey) { return false; }
-    return (new RegExp("(?:^|;\\s*)" + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=")).test(document.cookie);
-  },
-  keys: function () {
-    var aKeys = document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, "").split(/\s*(?:\=[^;]*)?;\s*/);
-    for (var nLen = aKeys.length, nIdx = 0; nIdx < nLen; nIdx++) { aKeys[nIdx] = decodeURIComponent(aKeys[nIdx]); }
-    return aKeys;
-  }
-};
- -
Note: 对于never-expire-cookies  我们使用一个随意的遥远日期Fri, 31 Dec 9999 23:59:59 GMT. 处于任何原因,你担心这样一个日期,使用 惯例世界末日Tue, 19 Jan 2038 03:14:07 GMT - 这是自1970年1月1日00:00:00 UTC以来使用 有符号的32位二进制整数表示的最大秒数。(i.e., 01111111111111111111111111111111 which is new Date(0x7fffffff * 1e3)).
- -

cookie的写入

- -
语法
- -
docCookies.setItem(name, value[, end[, path[, domain[, secure]]]])
- -
Description
- -

新增/重写一个 cookie.

- -
参数
- -
-
name
-
新增/重写一个 cookie的 名字  (字符传).
-
value
-
cookie的 (字符串).
-
end 可选
-
max-age(最大有效时间)单位秒 (e.g. 31536e3 表示一年, Infinity  表示永不过期的cookie), 或者以GMTString 格式或者Date object 的expires date(过期时间); 如果没有,指定的cookie将在会话结束时到期 (number – finite or Infinitystring, Date object or null). -
-

Note: 尽管 officially defined in rfc6265, max-age 在 Internet Explorer, Edg和一些移动端浏览器上不兼容. 因此,将数字传递给end参数可能无法按预期工作. 可能的解决方案可能是将相对时间转换为绝对时间。例如,以下代码:

- -
docCookies.setItem("mycookie", "Hello world!", 150);
- -

可以使用绝对日期重写,如下例所示:

- -
 maxAgeToGMT (nMaxAge) {
-  return nMaxAge === Infinity ? "Fri, 31 Dec 9999 23:59:59 GMT" : (new Date(nMaxAge * 1e3 + Date.now())).toUTCString();
-}
-
-docCookies.setItem("mycookie", "Hello world!", maxAgeToGMT(150));
- -

在上面的代码中,函数 maxAgeToGMT() 用于从相对时间(即,从“age”)创建GMTString.

-
-
-
path 可选
-
可访问此cookie的路径. 例如,“/”,“/ mydir”;如果未指定,则默认为当前文档位置的当前路径(string or null). The path must be absolute (see RFC 2965). For more information on how to use relative paths in this argument, see this paragraph.
-
domain 可选
-
可访问此cookie的域名. 例如,“example.com”“.example.com”(包括所有子域)或“subdomain.example.com”; 如果未指定,则默认为当前文档位置的主机端口(string or null).
-
secure 可选
-
cookie将仅通过https安全协议传输 (boolean or null).
-
- -

获取一个cookie

- -
语法
- -
docCookies.getItem(name)
- -
描述
- -

读一个cookie。如果cookie不存在,则返回null值。Parameters

- -
参数
- -
-
name
-
读取cookie的名字 (string).
-
- -

移除一个cookie

- -
语法
- -
docCookies.removeItem(name[, path[, domain]])
- -
描述
- -

删除一个cookie.

- -
参数
- -
-
name
-
待移除cookie的名字 (string).
-
path 可选
-
例如,"/","/ mydir";如果未指定,则默认为当前文档位置的当前路径 (string or null). The path must be absolute (see RFC 2965). For more information on how to use relative paths in this argument, see this paragraph.
-
domain 可选
-
例如, "example.com",  或者 "subdomain.example.com"; 如果未指定,则默认为当前文档位置的主机端口(字符串或null),但不包括子域。 (string or null), 但不包括子域名。与早期的规范相反,域名中的前置的点被忽略。如果指定了域,则始终包含子域。 -
Note: 要删除跨子域的cookie,您需要想setItem()样removeItem()中指定domain属性。
-
-
- -

检查一个cookie(是否存在)

- -
语法
- -
docCookies.hasItem(name)
- -
描述
- -

检查当前位置是否存在cookie。

- -
参数
- -
-
name
-
待检查cookie的名字 (string).
-
- -

获取所有cookie列表

- -
Syntax
- -
docCookies.keys()
- -
Description
- -

返回此位置的所有可读cookie的数组。

- -

Example usage:

- -
docCookies.setItem("test0", "Hello world!");
-docCookies.setItem("test1", "Unicode test: \u00E0\u00E8\u00EC\u00F2\u00F9", Infinity);
-docCookies.setItem("test2", "Hello world!", new Date(2020, 5, 12));
-docCookies.setItem("test3", "Hello world!", new Date(2027, 2, 3), "/blog");
-docCookies.setItem("test4", "Hello world!", "Wed, 19 Feb 2127 01:04:55 GMT");
-docCookies.setItem("test5", "Hello world!", "Fri, 20 Aug 88354 14:07:15 GMT", "/home");
-docCookies.setItem("test6", "Hello world!", 150);
-docCookies.setItem("test7", "Hello world!", 245, "/content");
-docCookies.setItem("test8", "Hello world!", null, null, "example.com");
-docCookies.setItem("test9", "Hello world!", null, null, null, true);
-docCookies.setItem("test1;=", "Safe character test;=", Infinity);
-
-alert(docCookies.keys().join("\n"));
-alert(docCookies.getItem("test1"));
-alert(docCookies.getItem("test5"));
-docCookies.removeItem("test1");
-docCookies.removeItem("test5", "/home");
-alert(docCookies.getItem("test1"));
-alert(docCookies.getItem("test5"));
-alert(docCookies.getItem("unexistingCookie"));
-alert(docCookies.getItem());
-alert(docCookies.getItem("test1;="));
-
diff --git a/files/zh-cn/web/api/document/elementfrompoint/index.html b/files/zh-cn/web/api/document/elementfrompoint/index.html deleted file mode 100644 index 6fb591e1da..0000000000 --- a/files/zh-cn/web/api/document/elementfrompoint/index.html +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: Document.elementFromPoint() -slug: Web/API/Document/elementFromPoint -translation_of: Web/API/DocumentOrShadowRoot/elementFromPoint -translation_of_original: Web/API/Document/elementFromPoint ---- -
- {{APIRef()}} {{Fx_minversion_header(3)}}
-

概述

-

返回当前文档上处于指定坐标位置最顶层的元素, 坐标是相对于包含该文档的浏览器窗口的左上角为原点来计算的, 通常 x 和 y 坐标都应为正数.

-

语法

-
var element = document.elementFromPoint(x, y);
- -

示例

-
<!DOCTYPE html>
-<html lang="en">
-<head>
-<title>elementFromPoint example</title>
-
-<script>
-function changeColor(newColor) {
-  elem = document.elementFromPoint(2, 2);
-  elem.style.color = newColor;
-}
-</script>
-</head>
-
-<body>
-<p id="para1">Some text here</p>
-<button onclick="changeColor('blue');">blue</button>
-<button onclick="changeColor('red');">red</button>
-</body>
-</html>
-
-

附注

-

If the element at the specified point belongs to another document (for example, an iframe's subdocument), the element in the DOM of the document the method is called on (in the iframe case, the iframe itself) is returned. If the element at the given point is anonymous or XBL generated content, such as a textbox's scroll bars, then the first non-anonymous ancestor element (for example, the textbox) is returned.

-

If the specified point is outside the visible bounds of the document or either coordinate is negative, the result is null.

-

{{Note("Callers from XUL documents should wait until the onload event has fired before calling this method.")}}

-

规范

- diff --git a/files/zh-cn/web/api/document/elementsfrompoint/index.html b/files/zh-cn/web/api/document/elementsfrompoint/index.html deleted file mode 100644 index 9a7ee01503..0000000000 --- a/files/zh-cn/web/api/document/elementsfrompoint/index.html +++ /dev/null @@ -1,129 +0,0 @@ ---- -title: Document.elementsFromPoint() -slug: Web/API/Document/elementsFromPoint -translation_of: Web/API/DocumentOrShadowRoot/elementsFromPoint -translation_of_original: Web/API/Document/elementsFromPoint ---- -
{{APIRef("DOM")}}{{SeeCompatTable}}
- -

elementsFromPoint() 方法可以获取到当前视口内指定坐标处,由里到外排列的所有元素。

- -

语法

- -
var elements = document.elementsFromPoint(x, y);
- -

返回值

- -

一个包含多个元素的数组

- -

参数

- -
-
x
-
当前视口内某一点的横坐标
-
y
-
当前视口内某一点的纵坐标
-
- -

示例

- -

HTML

- -
<div>
-  <p>Some text</p>
-</div>
-<p>Elements at point 30, 20:</p>
-<div id="output"></div>
-
- -

JavaScript

- -
var output = document.getElementById("output");
-if (document.elementsFromPoint) {
-  var elements = document.elementsFromPoint(30, 20);
-  for(var i = 0; i < elements.length; i++) {
-    output.textContent += elements[i].localName;
-    if (i < elements.length - 1) {
-      output.textContent += " < ";
-    }
-  }
-} else {
-  output.innerHTML = "<span style=\"color: red;\">" +
-     "您的浏览器不支持 <code>document.elementsFromPoint()</code>" +
-     "</span>";
-}
- -

{{EmbedLiveSample('Example', '420', '120')}}

- -

规范

- - - - - - - - - - - - - - -
SpecificationStatusComment
{{SpecName('CSSOM View', '#dom-document-elementsfrompoint', 'elementsFromPoint')}}{{Spec2('CSSOM View')}}Initial definition.
- -

浏览器兼容性

- -

{{CompatibilityTable}}

- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support {{CompatChrome(43.0)}}{{CompatGeckoDesktop("46.0")}}[1]10.0 {{property_prefix("ms")}}{{CompatUnknown}}{{CompatSafari(11)}}
-
- -
- - - - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidAndroid WebviewFirefox Mobile (Gecko)IE MobileOpera MobileSafari MobileChrome for Android
Basic support{{CompatNo}}{{CompatChrome(43.0)}}{{CompatGeckoMobile("46.0")}}[1]{{CompatUnknown}}{{CompatUnknown}}{{CompatSafari(11)}}{{CompatChrome(43.0)}}
-
- -

 

diff --git a/files/zh-cn/web/api/document/fullscreen/index.html b/files/zh-cn/web/api/document/fullscreen/index.html new file mode 100644 index 0000000000..eb15adcede --- /dev/null +++ b/files/zh-cn/web/api/document/fullscreen/index.html @@ -0,0 +1,108 @@ +--- +title: document.mozFullScreen +slug: Web/API/Document/mozFullScreen +translation_of: Web/API/Document/fullscreen +--- +

 

+ +

{{APIRef("Fullscreen API")}}{{Deprecated_Header}}

+ +

过时的{{domxref("Document")}}接口的 fullscreen 只读属性报告文档当前是否以全屏模式显示内容。

+ +

虽然这个属性是只读的,但如果修改它,它不会抛出(即使在严格模式下);setter是一个非操作,它将被忽略。

+ +
+

注意: 由于不推荐使用此属性,您可以通过检查{{DOMxRef("document.fullscreenelement")}}是否为null来确定文档上是否启用全屏模式。

+
+ +

 

+ +

概述

+ +

返回一个布尔值,表明当前文档是否处于全屏模式.

+ +

语法

+ +
var isFullScreen = document.mozFullScreen || document.webkitIsFullScreen;
+
+ +

例子

+ +
function isDocumentInFullScreenMode() {
+  // 过去由F11触发的那种浏览器全屏模式和HTML5中内容的全屏模式是不一样的
+  return (document.fullscreenElement && document.fullscreenElement !== null) ||
+      (!document.mozFullScreen && !document.webkitIsFullScreen);
+}
+
+ +

备注

+ +

查看使用全屏模式来了解更多相关内容.

+ +

浏览器兼容性

+ +

{{ CompatibilityTable() }}

+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{ CompatUnknown() }}{{ CompatGeckoDesktop("9.0") }}{{ CompatUnknown() }}{{ CompatUnknown() }}{{ CompatUnknown() }}
+
+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{ CompatUnknown() }}{{ CompatGeckoMobile("9.0") }}{{ CompatUnknown() }}{{ CompatUnknown() }}{{ CompatUnknown() }}
+
+ +

规范

+ +

不属于任何公开的规范

+ +

相关链接

+ + + +

{{ languages( {"en": "en/DOM/document.mozFullScreen" } ) }}

diff --git a/files/zh-cn/web/api/document/fullscreenenabled/index.html b/files/zh-cn/web/api/document/fullscreenenabled/index.html new file mode 100644 index 0000000000..248797541a --- /dev/null +++ b/files/zh-cn/web/api/document/fullscreenenabled/index.html @@ -0,0 +1,82 @@ +--- +title: document.mozFullScreenEnabled +slug: Web/API/Document/mozFullScreenEnabled +translation_of: Web/API/Document/fullscreenEnabled +--- +

{{ ApiRef() }}

+

概述

+

返回一个布尔值,表明浏览器是否支持全屏模式. 全屏模式只在那些不包含窗口化的插件的页面中可用.对于一个{{ HTMLElement("iframe") }}元素中的页面,则它必需拥有{{ HTMLAttrXRef("mozallowfullscreen", "iframe") }}属性.

+

语法

+
var isFullScreenAvailable = document.mozFullScreenEnabled;
+
+

如果当前文档可以进入全屏模式,则isFullScreenAvailabletrue

+

例子

+
function requestFullScreen() {
+  if (document.mozFullScreenEnabled) {
+    videoElement.requestFullScreen();
+  } else {
+    console.log('你的浏览器不支持全屏模式!');
+  }
+}
+
+

备注

+

进入页面使用全屏模式查看详情和示例.

+

浏览器兼容性

+

{{ CompatibilityTable() }}

+
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{ CompatUnknown() }}{{ CompatGeckoDesktop("10.0") }}{{ CompatUnknown() }}{{ CompatUnknown() }}{{ CompatUnknown() }}
+
+
+ + + + + + + + + + + + + + + + + + + +
FeatureAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{ CompatUnknown() }}{{ CompatGeckoMobile("10.0") }}{{ CompatUnknown() }}{{ CompatUnknown() }}{{ CompatUnknown() }}
+
+

规范

+

该方法在规范草案 http://dvcs.w3.org/hg/fullscrezh-cn/raw-file/tip/Overview.html#dom-document-fullscreenenabled 中被提出.

+

相关链接

+ +

{{ languages( { "en": "en/DOM/document.mozFullScreenEnabled" } ) }}

diff --git a/files/zh-cn/web/api/document/getselection/index.html b/files/zh-cn/web/api/document/getselection/index.html deleted file mode 100644 index 73b3a4ce6b..0000000000 --- a/files/zh-cn/web/api/document/getselection/index.html +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: document.getSelection -slug: Web/API/Document/getSelection -translation_of: Web/API/DocumentOrShadowRoot/getSelection -translation_of_original: Web/API/Document/getSelection ---- -
-
-

{{APIRef("DOM")}}

- -

该方法的功能等价于 {{domxref("Window.getSelection()")}} 方法;其返回一个 {{domxref("Selection")}} 对象,表示文档中当前被选择的文本。

-
-
- -

 

diff --git a/files/zh-cn/web/api/document/inputencoding/index.html b/files/zh-cn/web/api/document/inputencoding/index.html deleted file mode 100644 index 00701e8acf..0000000000 --- a/files/zh-cn/web/api/document/inputencoding/index.html +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: document.inputEncoding -slug: Web/API/Document/inputEncoding -translation_of: Web/API/Document/characterSet -translation_of_original: Web/API/Document/inputEncoding ---- -

{{ ApiRef() }} {{ deprecated_header() }}

-

概述

-

返回一个字符串,代表当前文档渲染时所使用的编码.(比如utf-8).

-
- 警告: 不要再使用该属性.该属性在DOM 4 规范(草案)中已经被废弃. Gecko 在未来的版本中将会删除它.
-

语法

-
encoding = document.inputEncoding;
-
-

inputEncoding 是个只读属性.

-

规范

- -

{{ languages( {"en": "en/DOM/document.inputEncoding" } ) }}

diff --git a/files/zh-cn/web/api/document/mozfullscreen/index.html b/files/zh-cn/web/api/document/mozfullscreen/index.html deleted file mode 100644 index eb15adcede..0000000000 --- a/files/zh-cn/web/api/document/mozfullscreen/index.html +++ /dev/null @@ -1,108 +0,0 @@ ---- -title: document.mozFullScreen -slug: Web/API/Document/mozFullScreen -translation_of: Web/API/Document/fullscreen ---- -

 

- -

{{APIRef("Fullscreen API")}}{{Deprecated_Header}}

- -

过时的{{domxref("Document")}}接口的 fullscreen 只读属性报告文档当前是否以全屏模式显示内容。

- -

虽然这个属性是只读的,但如果修改它,它不会抛出(即使在严格模式下);setter是一个非操作,它将被忽略。

- -
-

注意: 由于不推荐使用此属性,您可以通过检查{{DOMxRef("document.fullscreenelement")}}是否为null来确定文档上是否启用全屏模式。

-
- -

 

- -

概述

- -

返回一个布尔值,表明当前文档是否处于全屏模式.

- -

语法

- -
var isFullScreen = document.mozFullScreen || document.webkitIsFullScreen;
-
- -

例子

- -
function isDocumentInFullScreenMode() {
-  // 过去由F11触发的那种浏览器全屏模式和HTML5中内容的全屏模式是不一样的
-  return (document.fullscreenElement && document.fullscreenElement !== null) ||
-      (!document.mozFullScreen && !document.webkitIsFullScreen);
-}
-
- -

备注

- -

查看使用全屏模式来了解更多相关内容.

- -

浏览器兼容性

- -

{{ CompatibilityTable() }}

- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{ CompatUnknown() }}{{ CompatGeckoDesktop("9.0") }}{{ CompatUnknown() }}{{ CompatUnknown() }}{{ CompatUnknown() }}
-
- -
- - - - - - - - - - - - - - - - - - - -
FeatureAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{ CompatUnknown() }}{{ CompatGeckoMobile("9.0") }}{{ CompatUnknown() }}{{ CompatUnknown() }}{{ CompatUnknown() }}
-
- -

规范

- -

不属于任何公开的规范

- -

相关链接

- - - -

{{ languages( {"en": "en/DOM/document.mozFullScreen" } ) }}

diff --git a/files/zh-cn/web/api/document/mozfullscreenelement/index.html b/files/zh-cn/web/api/document/mozfullscreenelement/index.html deleted file mode 100644 index d87cd89683..0000000000 --- a/files/zh-cn/web/api/document/mozfullscreenelement/index.html +++ /dev/null @@ -1,77 +0,0 @@ ---- -title: document.mozFullScreenElement -slug: Web/API/Document/mozFullScreenElement -translation_of: Web/API/DocumentOrShadowRoot/fullscreenElement ---- -

{{ ApiRef() }}

-

概述

-

返回当前文档中正在以全屏模式显示的{{ domxref("Element") }}节点,如果没有使用全屏模式,则返回null.

-

语法

-
var element = document.mozFullScreenElement;
-
-

示例

-
function isVideoInFullsreen() {
-  if (document.mozFullScreenElement && document.mozFullScreenElement.nodeName == 'VIDEO') {
-    console.log('您的视频正在以全屏模式显示');
-  }
-}
-

辅助

-

查看使用"全屏模式"页面了解详情.

-

浏览器兼容性

-

{{ CompatibilityTable() }}

-
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{ CompatUnknown() }}{{ CompatGeckoDesktop("9.0") }}{{ CompatUnknown() }}{{ CompatUnknown() }}{{ CompatUnknown() }}
-
-
- - - - - - - - - - - - - - - - - - - -
FeatureAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{ CompatUnknown() }}{{ CompatGeckoMobile("9.0") }}{{ CompatUnknown() }}{{ CompatUnknown() }}{{ CompatUnknown() }}
-
-

规范

-

该方法提案已经进入相关规范草案 http://dvcs.w3.org/hg/fullscrezh-CN/raw-file/tip/Overview.html#dom-document-fullscreenelement

-

相关链接

- diff --git a/files/zh-cn/web/api/document/mozfullscreenenabled/index.html b/files/zh-cn/web/api/document/mozfullscreenenabled/index.html deleted file mode 100644 index 248797541a..0000000000 --- a/files/zh-cn/web/api/document/mozfullscreenenabled/index.html +++ /dev/null @@ -1,82 +0,0 @@ ---- -title: document.mozFullScreenEnabled -slug: Web/API/Document/mozFullScreenEnabled -translation_of: Web/API/Document/fullscreenEnabled ---- -

{{ ApiRef() }}

-

概述

-

返回一个布尔值,表明浏览器是否支持全屏模式. 全屏模式只在那些不包含窗口化的插件的页面中可用.对于一个{{ HTMLElement("iframe") }}元素中的页面,则它必需拥有{{ HTMLAttrXRef("mozallowfullscreen", "iframe") }}属性.

-

语法

-
var isFullScreenAvailable = document.mozFullScreenEnabled;
-
-

如果当前文档可以进入全屏模式,则isFullScreenAvailabletrue

-

例子

-
function requestFullScreen() {
-  if (document.mozFullScreenEnabled) {
-    videoElement.requestFullScreen();
-  } else {
-    console.log('你的浏览器不支持全屏模式!');
-  }
-}
-
-

备注

-

进入页面使用全屏模式查看详情和示例.

-

浏览器兼容性

-

{{ CompatibilityTable() }}

-
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{ CompatUnknown() }}{{ CompatGeckoDesktop("10.0") }}{{ CompatUnknown() }}{{ CompatUnknown() }}{{ CompatUnknown() }}
-
-
- - - - - - - - - - - - - - - - - - - -
FeatureAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{ CompatUnknown() }}{{ CompatGeckoMobile("10.0") }}{{ CompatUnknown() }}{{ CompatUnknown() }}{{ CompatUnknown() }}
-
-

规范

-

该方法在规范草案 http://dvcs.w3.org/hg/fullscrezh-cn/raw-file/tip/Overview.html#dom-document-fullscreenenabled 中被提出.

-

相关链接

- -

{{ languages( { "en": "en/DOM/document.mozFullScreenEnabled" } ) }}

diff --git a/files/zh-cn/web/api/document/onafterscriptexecute/index.html b/files/zh-cn/web/api/document/onafterscriptexecute/index.html new file mode 100644 index 0000000000..f1e976522e --- /dev/null +++ b/files/zh-cn/web/api/document/onafterscriptexecute/index.html @@ -0,0 +1,44 @@ +--- +title: element.onafterscriptexecute +slug: Web/API/Element/onafterscriptexecute +tags: + - DOM + - onafterscriptexecute +translation_of: Web/API/Document/onafterscriptexecute +--- +
{{ApiRef}}{{gecko_minversion_header("2")}}
+ +

概述

+ +

当HTML文档中的{{HTMLElement("script")}}标签内的代码执行完毕时触发该事件,如果这个script标签是用appendChild()等方法动态添加上去的,则不会触发该事件.

+ +

语法

+ +
document.onafterscriptexecute = funcRef;
+
+ +

afterscriptexecute事件触发时,funcRef函数就会被调用. 传入参数eventtarget属性指向触发该事件的那个script元素.

+ +

例子

+ +
function finished(e) {
+  logMessage("Finished script with ID: " + e.target.id);
+}
+
+document.addEventListener("afterscriptexecute", finished, true);
+
+ +

查看在线演示

+ +

规范

+ + + +

相关链接

+ + diff --git a/files/zh-cn/web/api/document/pointerlockelement/index.html b/files/zh-cn/web/api/document/pointerlockelement/index.html deleted file mode 100644 index eb6ed9cf98..0000000000 --- a/files/zh-cn/web/api/document/pointerlockelement/index.html +++ /dev/null @@ -1,105 +0,0 @@ ---- -title: Document.pointerLockElement -slug: Web/API/Document/pointerLockElement -translation_of: Web/API/DocumentOrShadowRoot/pointerLockElement ---- -
{{APIRef("DOM")}}
- -

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

- -

语法

- -
var element = document.pointerLockElement;
-
- -

返回值

- -

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

- -

特性

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

浏览器兼容

- -

{{ CompatibilityTable() }}

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FeatureChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{ CompatVersionUnknown() }} {{property_prefix("webkit")}}{{CompatVersionUnknown}}{{ CompatVersionUnknown() }} {{property_prefix("moz")}}{{ CompatUnknown() }}{{ CompatUnknown() }}{{ CompatUnknown() }}
Unprefixed support{{ CompatVersionUnknown() }}{{CompatUnknown}}{{CompatGeckoDesktop(50)}}   
-
- -
- - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidEdgeFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{ CompatUnknown() }}{{CompatVersionUnknown}}{{ CompatUnknown() }}{{ CompatUnknown() }}{{ CompatUnknown() }}{{ CompatUnknown() }}
-
- -

相关链接

- - diff --git a/files/zh-cn/web/api/document/readystatechange_event/index.html b/files/zh-cn/web/api/document/readystatechange_event/index.html new file mode 100644 index 0000000000..a4f95498ad --- /dev/null +++ b/files/zh-cn/web/api/document/readystatechange_event/index.html @@ -0,0 +1,149 @@ +--- +title: 'Document: readystatechange 事件' +slug: Web/Events/readystatechange事件 +tags: + - Reference + - XMLHttpRequest + - interactive + - 事件 +translation_of: Web/API/Document/readystatechange_event +--- +
{{APIRef}}
+ +

当文档的 {{domxref("Document.readyState", "readyState")}} 属性发生改变时,会触发 readystatechange 事件。

+ + + + + + + + + + + + + + + + + + + + +
是否冒泡
是否可取消
接口{{domxref("Event")}}
Event handler 属性onreadystatechange
+ +

示例

+ +

实时演示

+ +

HTML

+ +
<div class="controls">
+  <button id="reload" type="button">Reload</button>
+</div>
+
+<div class="event-log">
+  <label>Event log:</label>
+  <textarea readonly class="event-log-contents" rows="8" cols="30"></textarea>
+</div>
+ + + +

JS

+ +
const log = document.querySelector('.event-log-contents');
+const reload = document.querySelector('#reload');
+
+reload.addEventListener('click', () => {
+  log.textContent ='';
+  window.setTimeout(() => {
+      window.location.reload(true);
+  }, 200);
+});
+
+window.addEventListener('load', (event) => {
+    log.textContent = log.textContent + 'load\n';
+});
+
+document.addEventListener('readystatechange', (event) => {
+    log.textContent = log.textContent + `readystate: ${document.readyState}\n`;
+});
+
+document.addEventListener('DOMContentLoaded', (event) => {
+    log.textContent = log.textContent + `DOMContentLoaded\n`;
+});
+
+
+ +

结果

+ +

+ +

规范

+ + + + + + + + + + + + + + + + +
规范状态备注
{{SpecName("HTML WHATWG", "indices.html#event-readystatechange", "readystatechange")}}{{Spec2("HTML WHATWG")}}
+ +

浏览器兼容性

+ + + +

{{Compat("api.Document.readystatechange_event")}}

+ +

IE 浏览器是一直支持 readystatechange 事件的,可作为 DOMContentLoaded 事件的替代方法(参见Browser compatibility的注释 [2])。

+ +

参见

+ + diff --git a/files/zh-cn/web/api/document/rouchmove_event/index.html b/files/zh-cn/web/api/document/rouchmove_event/index.html deleted file mode 100644 index 1321a0c4d2..0000000000 --- a/files/zh-cn/web/api/document/rouchmove_event/index.html +++ /dev/null @@ -1,171 +0,0 @@ ---- -title: touchmove -slug: Web/API/Document/rouchmove_event -translation_of: Web/API/Document/touchmove_event ---- -
{{APIRef}}
- -

当触点在触控平面上移动时触发touchmove事件。

- -

常规信息

- -
-
规范
-
Touch Events
-
接口
-
{{domxref("TouchEvent")}}
-
是否冒泡
-
Yes
-
能否取消默认行为
-
Yes
-
目标
-
Document, Element
-
默认行为
-
-
- -

属性

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyTypeDescription
target {{readonlyInline}}EventTargetThe event target (the topmost target in the DOM tree).
type {{readonlyInline}}DOMStringThe type of event.
bubbles {{readonlyInline}}BooleanWhether the event normally bubbles or not.
cancelable {{readonlyInline}}BooleanWhether the event is cancellable or not.
view {{readonlyInline}}WindowProxydocument.defaultView (window of the document)
detail {{readonlyInline}}long (float)0.
touches {{readonlyInline}}TouchListA list of Touches for every point of contact currently touching the surface.
targetTouches {{readonlyInline}}TouchListA list of Touches for every point of contact that is touching the surface and started on the element that is the target of the current event.
changedTouches {{readonlyInline}}TouchListA list of Touches for every point of contact which contributed to the event.
- For the touchstart event this must be a list of the touch points that just became active with the current event. For the touchmove event this must be a list of the touch points that have moved since the last event. For the touchend and touchcancel events this must be a list of the touch points that have just been removed from the surface.
ctrlKey {{readonlyInline}}booleantrue if the control key was down when the event was fired. false otherwise.
shiftKey {{readonlyInline}}booleantrue if the shift key was down when the event was fired. false otherwise.
altKey {{readonlyInline}}booleantrue if the alt key was down when the event was fired. false otherwise.
metaKey {{readonlyInline}}booleantrue if the meta key was down when the event was fired. false otherwise.
- -

示例

- -

这些事件的代码示例在这个页面 Touch events 中均有体现。

- -

浏览器兼容性

- -

{{CompatibilityTable}}

- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic support{{CompatChrome("22.0")}}{{CompatGeckoDesktop("18.0")}}{{CompatNo}}{{CompatNo}}{{CompatNo}}
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - -
FeatureAndroidAndroid WebviewChrome for AndroidFirefox Mobile (Gecko)Firefox OSIE MobileOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatGeckoMobile("6.0")}}{{CompatVersionUnknown}}11{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

相关事件

- - diff --git a/files/zh-cn/web/api/document/stylesheets/index.html b/files/zh-cn/web/api/document/stylesheets/index.html deleted file mode 100644 index de44c8537b..0000000000 --- a/files/zh-cn/web/api/document/stylesheets/index.html +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: Document.styleSheets -slug: Web/API/Document/styleSheets -translation_of: Web/API/DocumentOrShadowRoot/styleSheets -translation_of_original: Web/API/Document/styleSheets ---- -
{{APIRef}}
- -

Document.styleSheets 只读属性,返回一个由 {{domxref("StyleSheet ")}} 对象组成的 {{domxref("StyleSheetList")}},每个 {{domxref("StyleSheet ")}} 对象都是一个文档中链接或嵌入的样式表。

- -

语法

- -
let styleSheetList = document.styleSheets;
-
- -

返回的对象是一个 {{domxref("StyleSheetList")}}。

- -

它是一个 {{domxref("StyleSheet")}} 对象的有序集合。styleSheetList.item(index) 或 styleSheetList{{ mediawiki.External('index') }} 根据它的索引(索引基于0)返回一个单独的样式表对象。

- -
 
- -

规范

- - diff --git a/files/zh-cn/web/api/document/touchmove_event/index.html b/files/zh-cn/web/api/document/touchmove_event/index.html new file mode 100644 index 0000000000..1321a0c4d2 --- /dev/null +++ b/files/zh-cn/web/api/document/touchmove_event/index.html @@ -0,0 +1,171 @@ +--- +title: touchmove +slug: Web/API/Document/rouchmove_event +translation_of: Web/API/Document/touchmove_event +--- +
{{APIRef}}
+ +

当触点在触控平面上移动时触发touchmove事件。

+ +

常规信息

+ +
+
规范
+
Touch Events
+
接口
+
{{domxref("TouchEvent")}}
+
是否冒泡
+
Yes
+
能否取消默认行为
+
Yes
+
目标
+
Document, Element
+
默认行为
+
+
+ +

属性

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PropertyTypeDescription
target {{readonlyInline}}EventTargetThe event target (the topmost target in the DOM tree).
type {{readonlyInline}}DOMStringThe type of event.
bubbles {{readonlyInline}}BooleanWhether the event normally bubbles or not.
cancelable {{readonlyInline}}BooleanWhether the event is cancellable or not.
view {{readonlyInline}}WindowProxydocument.defaultView (window of the document)
detail {{readonlyInline}}long (float)0.
touches {{readonlyInline}}TouchListA list of Touches for every point of contact currently touching the surface.
targetTouches {{readonlyInline}}TouchListA list of Touches for every point of contact that is touching the surface and started on the element that is the target of the current event.
changedTouches {{readonlyInline}}TouchListA list of Touches for every point of contact which contributed to the event.
+ For the touchstart event this must be a list of the touch points that just became active with the current event. For the touchmove event this must be a list of the touch points that have moved since the last event. For the touchend and touchcancel events this must be a list of the touch points that have just been removed from the surface.
ctrlKey {{readonlyInline}}booleantrue if the control key was down when the event was fired. false otherwise.
shiftKey {{readonlyInline}}booleantrue if the shift key was down when the event was fired. false otherwise.
altKey {{readonlyInline}}booleantrue if the alt key was down when the event was fired. false otherwise.
metaKey {{readonlyInline}}booleantrue if the meta key was down when the event was fired. false otherwise.
+ +

示例

+ +

这些事件的代码示例在这个页面 Touch events 中均有体现。

+ +

浏览器兼容性

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic support{{CompatChrome("22.0")}}{{CompatGeckoDesktop("18.0")}}{{CompatNo}}{{CompatNo}}{{CompatNo}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidAndroid WebviewChrome for AndroidFirefox Mobile (Gecko)Firefox OSIE MobileOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatGeckoMobile("6.0")}}{{CompatVersionUnknown}}11{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +

相关事件

+ + -- cgit v1.2.3-54-g00ecf