From 8824afb494e5398bc0efcf5f7eb78782096fc90c Mon Sep 17 00:00:00 2001 From: A1lo Date: Fri, 18 Mar 2022 21:53:46 +0800 Subject: Replace marco `anch` with `` tag for `zh-CN` (#4668) * replace anch with tag `` * auto replace anch with scripts * fix: resolve some incorrect anchors * replace anch with markdown link in markdown files * sync with english version for `Properties` * fix: resolve some incorrect anchors * using `Specifications` marco to replace `` * fix: resolve some incorrect anchors * remove the `noteCard` and add a `h2` head * fix: resolve some incorrect anchors * remove the duplicated content * fix: resolve some incorrect anchors * fix: resolve some incorrect anchors * revert the content change and replace anch * revert the content change and replace anch * revert the content chang * fix: correct the `href` * revert content changes and replace the anch * fix: resolve some incorrect anchors * fix: resolve some incorrect anchors * fix: resolve some incorrect anchors --- files/zh-cn/web/api/attr/index.html | 2 +- files/zh-cn/web/api/beforeunloadevent/index.html | 2 +- files/zh-cn/web/api/btoa/index.html | 2 +- .../canvas_api/tutorial/drawing_shapes/index.html | 4 ++-- files/zh-cn/web/api/clipboard/index.html | 2 +- files/zh-cn/web/api/clipboard/read/index.html | 2 +- files/zh-cn/web/api/clipboard/write/index.html | 2 +- files/zh-cn/web/api/clipboard/writetext/index.html | 4 +--- files/zh-cn/web/api/console/index.html | 2 +- .../zh-cn/web/api/credentialscontainer/index.html | 2 +- files/zh-cn/web/api/cssrule/index.html | 4 ++-- files/zh-cn/web/api/cssstylesheet/index.html | 2 +- .../api/datatransferitem/getasstring/index.html | 2 +- .../web/api/document/createelement/index.html | 2 +- .../zh-cn/web/api/document/createevent/index.html | 2 +- .../web/api/document/createnodeiterator/index.html | 4 ++-- .../zh-cn/web/api/document/execcommand/index.html | 2 +- .../web/api/document/keypress_event/index.html | 5 ++--- .../web/api/document/queryselector/index.html | 2 +- .../web/api/document/queryselectorall/index.html | 6 +---- files/zh-cn/web/api/document/title/index.html | 2 +- files/zh-cn/web/api/domexception/index.html | 2 +- .../zh-cn/web/api/element/getattribute/index.html | 2 +- .../zh-cn/web/api/element/setattribute/index.html | 4 ++-- files/zh-cn/web/api/event/eventphase/index.html | 2 +- .../api/eventtarget/addeventlistener/index.html | 6 ++--- files/zh-cn/web/api/fetch_api/using_fetch/index.md | 4 ++-- files/zh-cn/web/api/file/index.html | 2 +- .../using_files_from_web_applications/index.html | 2 +- .../api/file_and_directory_entries_api/index.html | 2 +- files/zh-cn/web/api/file_handle_api/index.html | 2 +- .../web/api/filesystemdirectoryentry/index.html | 2 +- .../web/api/filesystemdirectoryreader/index.html | 2 +- files/zh-cn/web/api/filesystementry/index.html | 2 +- files/zh-cn/web/api/filesystemfileentry/index.html | 2 +- .../zh-cn/web/api/fullscreen_api/guide/index.html | 2 +- files/zh-cn/web/api/fullscreen_api/index.html | 2 +- files/zh-cn/web/api/gamepad/index.html | 4 ++-- files/zh-cn/web/api/gamepad_api/index.html | 2 +- files/zh-cn/web/api/headers/index.html | 4 ++-- .../web/api/html_drag_and_drop_api/index.html | 2 +- files/zh-cn/web/api/htmliframeelement/index.html | 2 +- .../zh-cn/web/api/htmlmediaelement/play/index.html | 2 +- files/zh-cn/web/api/idbcursor/direction/index.html | 2 +- .../index.html | 4 ++-- .../api/indexeddb_api/using_indexeddb/index.html | 4 ++-- .../timing_element_visibility/index.html | 12 +++++----- files/zh-cn/web/api/keyboardevent/index.html | 2 +- .../api/keyboardevent/key/key_values/index.html | 4 ++-- .../api/mediadevices/getdisplaymedia/index.html | 2 +- .../mutationobserver/mutationobserver/index.html | 2 +- .../navigator/registerprotocolhandler/index.html | 2 +- files/zh-cn/web/api/node/firstchild/index.html | 16 ++++++------- files/zh-cn/web/api/node/nodetype/index.html | 2 +- .../using_the_notifications_api/index.html | 6 ++--- files/zh-cn/web/api/oscillatornode/index.html | 2 +- .../api/payment_request_api/concepts/index.html | 2 +- .../zh-cn/web/api/performance_timeline/index.html | 2 +- files/zh-cn/web/api/resource_timing_api/index.html | 12 ++++------ .../using_the_resource_timing_api/index.html | 2 +- files/zh-cn/web/api/response/redirected/index.html | 4 ++-- .../zh-cn/web/api/rtcsessiondescription/index.html | 2 +- .../using_screen_capture/index.html | 4 ++-- .../using_server-sent_events/index.html | 2 +- .../using_service_workers/index.html | 6 ++--- files/zh-cn/web/api/settimeout/index.html | 4 ++-- files/zh-cn/web/api/web_audio_api/index.html | 2 +- .../web_workers_api/using_web_workers/index.html | 2 +- files/zh-cn/web/api/webgl_api/data/index.html | 2 +- files/zh-cn/web/api/webgl_api/index.html | 2 +- .../webgl_model_view_projection/index.html | 4 ++-- .../signaling_and_video_calling/index.html | 26 +++++++++++----------- .../index.html | 6 ++--- files/zh-cn/web/api/webvtt_api/index.html | 2 +- files/zh-cn/web/api/webxr_device_api/index.html | 4 ++-- .../web/api/window/devicepixelratio/index.html | 2 +- .../web/api/xmlhttprequest/responsetype/index.html | 2 +- 77 files changed, 128 insertions(+), 139 deletions(-) (limited to 'files/zh-cn/web/api') diff --git a/files/zh-cn/web/api/attr/index.html b/files/zh-cn/web/api/attr/index.html index ad4f79e0f3..31028bbfe0 100644 --- a/files/zh-cn/web/api/attr/index.html +++ b/files/zh-cn/web/api/attr/index.html @@ -13,7 +13,7 @@ translation_of: Web/API/Attr

{{InheritanceDiagram}}

-
警告:从Gecko 7.0开始{{geckoRelease("7.0")}},控制台会输出这些方法和属性将会被移除的警告信息。你应该对代码进行相应的修正。点击{{anch("Deprecated properties and methods")}}查看完整的列表。
+
警告:从Gecko 7.0开始{{geckoRelease("7.0")}},控制台会输出这些方法和属性将会被移除的警告信息。你应该对代码进行相应的修正。点击废弃的属性和方法查看完整的列表。
DOM4[REC]中,为了规范化Attr的实现,它不再继承自{{domxref("Node")}}。在目前DOM4.1[WD]中又有变动,因此不建议使用Attr对象上有关{{domxref("Node")}}的属性和方法。
diff --git a/files/zh-cn/web/api/beforeunloadevent/index.html b/files/zh-cn/web/api/beforeunloadevent/index.html index 6063ef1282..f85b0e60a4 100644 --- a/files/zh-cn/web/api/beforeunloadevent/index.html +++ b/files/zh-cn/web/api/beforeunloadevent/index.html @@ -11,7 +11,7 @@ translation_of: Web/API/BeforeUnloadEvent

beforeunload 事件触发于 window、document 和它们的资源即将卸载时。 

-

当事件属性 returnValue 被赋值为非空字符串时,会弹出一个对话框,让用户确认是否离开页面(示例如下)。否则,事件被静默处理。一些浏览器实现仅在框架或内置框架接收到用户手势或交互时才显示对话框。在 {{anch("浏览器兼容性")}} 中查看更多信息。

+

当事件属性 returnValue 被赋值为非空字符串时,会弹出一个对话框,让用户确认是否离开页面(示例如下)。否则,事件被静默处理。一些浏览器实现仅在框架或内置框架接收到用户手势或交互时才显示对话框。在 浏览器兼容性 中查看更多信息。

diff --git a/files/zh-cn/web/api/btoa/index.html b/files/zh-cn/web/api/btoa/index.html index 1ff44702a1..1c02996285 100644 --- a/files/zh-cn/web/api/btoa/index.html +++ b/files/zh-cn/web/api/btoa/index.html @@ -18,7 +18,7 @@ original_slug: Web/API/WindowOrWorkerGlobalScope/btoa

WindowOrWorkerGlobalScope.btoa() 从 {{jsxref("String")}} 对象中创建一个 base-64 编码的 ASCII 字符串,其中字符串中的每个字符都被视为一个二进制数据字节。

-

Note: 由于这个函数将每个字符视为二进制数据的字节,而不管实际组成字符的字节数是多少,所以如果任何字符的{{Glossary("code point", "码位")}}超出 0x00 ~ 0xFF 这个范围,则会引发 InvalidCharacterError 异常。请参阅 {{anch("Unicode_字符串")}} ,该示例演示如何编码含有码位超出 0x00 ~ 0xFF 范围的字符的字符串。

+

Note: 由于这个函数将每个字符视为二进制数据的字节,而不管实际组成字符的字节数是多少,所以如果任何字符的{{Glossary("code point", "码位")}}超出 0x00 ~ 0xFF 这个范围,则会引发 InvalidCharacterError 异常。请参阅 Unicode_字符串 ,该示例演示如何编码含有码位超出 0x00 ~ 0xFF 范围的字符的字符串。

语法

diff --git a/files/zh-cn/web/api/canvas_api/tutorial/drawing_shapes/index.html b/files/zh-cn/web/api/canvas_api/tutorial/drawing_shapes/index.html index 8eee553d23..d656a1ad23 100644 --- a/files/zh-cn/web/api/canvas_api/tutorial/drawing_shapes/index.html +++ b/files/zh-cn/web/api/canvas_api/tutorial/drawing_shapes/index.html @@ -188,7 +188,7 @@ translation_of: Web/API/Canvas_API/Tutorial/Drawing_shapes

如果你想看到连续的线,你可以移除调用的moveTo()。

-

注意:需要学习更多关于arc()函数的内容,请看下面的{{anch("圆弧")}}

+

注意:需要学习更多关于arc()函数的内容,请看下面的圆弧

线

@@ -400,7 +400,7 @@ translation_of: Web/API/Canvas_API/Tutorial/Drawing_shapes

矩形

-

直接在画布上绘制矩形的三个额外方法,正如我们开始所见的{{anch("绘制矩形")}},同样,也有rect()方法,将一个矩形路径增加到当前路径上。

+

直接在画布上绘制矩形的三个额外方法,正如我们开始所见的绘制矩形,同样,也有rect()方法,将一个矩形路径增加到当前路径上。

rect(x, y, width, height)
diff --git a/files/zh-cn/web/api/clipboard/index.html b/files/zh-cn/web/api/clipboard/index.html index 834376f01e..05e3313323 100644 --- a/files/zh-cn/web/api/clipboard/index.html +++ b/files/zh-cn/web/api/clipboard/index.html @@ -23,7 +23,7 @@ translation_of: Web/API/Clipboard

如果用户没有适时使用 Permissions API 授予相应权限和"clipboard-read" 或 "clipboard-write" 权限,调用 Clipboard 对象的方法不会成功。

-

注意:实际上,现在浏览器对于访问剪贴板权限的索取各有不同,在章节 {{anch("剪贴板可用性")}} 查看更多细节。

+

注意:实际上,现在浏览器对于访问剪贴板权限的索取各有不同,在章节 剪贴板可用性 查看更多细节。

所有剪贴板 API 方法都是异步的;它们返回一个 {{jsxref("Promise")}} 对象,在剪贴板访问完成后被执行。如果剪贴板访问被拒绝,promise 也会被拒绝。

diff --git a/files/zh-cn/web/api/clipboard/read/index.html b/files/zh-cn/web/api/clipboard/read/index.html index 7b0ffa7bda..4fa5d071e2 100644 --- a/files/zh-cn/web/api/clipboard/read/index.html +++ b/files/zh-cn/web/api/clipboard/read/index.html @@ -16,7 +16,7 @@ translation_of: Web/API/Clipboard/read

To read from the clipboard, you must first have the "clipboard-read" permission.

-

Note: The asynchronous Clipboard and Permissions APIs are still in the process of being integrated into most browsers, so they often deviate from the official rules for permissions and the like. Be sure to review the {{anch("Browser compatibility", "compatibility table")}} before using these methods.

+

Note: The asynchronous Clipboard and Permissions APIs are still in the process of being integrated into most browsers, so they often deviate from the official rules for permissions and the like. Be sure to review the compatibility table before using these methods.

语法

diff --git a/files/zh-cn/web/api/clipboard/write/index.html b/files/zh-cn/web/api/clipboard/write/index.html index a7f69da118..ef3cf82beb 100644 --- a/files/zh-cn/web/api/clipboard/write/index.html +++ b/files/zh-cn/web/api/clipboard/write/index.html @@ -16,7 +16,7 @@ translation_of: Web/API/Clipboard/write

但是你要提前获取 "Permissions API" 的 "clipboard-write" 权限才能将数据写入到剪贴板。

-

注意: 浏览器对这个异步剪贴板的 API 仍然在讨论中。所以在使用它之前请检查 {{anch("Browser compatibility", "compatibility table")}} 和 {{SectionOnPage("/en-US/docs/Web/API/Clipboard", "Clipboard availability")}} 以获得更多的兼容性信息。

+

注意: 浏览器对这个异步剪贴板的 API 仍然在讨论中。所以在使用它之前请检查 浏览器兼容性 和 {{SectionOnPage("/en-US/docs/Web/API/Clipboard", "Clipboard availability")}} 以获得更多的兼容性信息。

语法

diff --git a/files/zh-cn/web/api/clipboard/writetext/index.html b/files/zh-cn/web/api/clipboard/writetext/index.html index e60e7204fe..2b6d77f43d 100644 --- a/files/zh-cn/web/api/clipboard/writetext/index.html +++ b/files/zh-cn/web/api/clipboard/writetext/index.html @@ -14,7 +14,7 @@ translation_of: Web/API/Clipboard/writeText

{{domxref("Clipboard")}} 接口的 writeText() 方法可以写入特定字符串到操作系统的剪切板。

-

Note: 规范要求在写入剪贴板之前使用 Permissions API 获取“剪贴板写入”权限。但是,不同浏览器的具体要求不同,因为这是一个新的API。有关详细信息,请查看{{anch("Browser compatibility", "compatibility table")}} and {{SectionOnPage("/en-US/docs/Web/API/Clipboard", "Clipboard availability")}}。

+

Note: 规范要求在写入剪贴板之前使用 Permissions API 获取“剪贴板写入”权限。但是,不同浏览器的具体要求不同,因为这是一个新的API。有关详细信息,请查看浏览器兼容性 and {{SectionOnPage("/en-US/docs/Web/API/Clipboard", "Clipboard availability")}}。

语法

@@ -63,6 +63,4 @@ translation_of: Web/API/Clipboard/writeText

浏览器兼容性

- -

{{Compat("api.Clipboard.writeText")}}

diff --git a/files/zh-cn/web/api/console/index.html b/files/zh-cn/web/api/console/index.html index 053d2784c0..be091e63ef 100644 --- a/files/zh-cn/web/api/console/index.html +++ b/files/zh-cn/web/api/console/index.html @@ -18,7 +18,7 @@ translation_of: Web/API/Console
console.log("Failed to open the specified link")
-

本页面记录了 Console 对象上的 {{anch("Methods")}}(方法)并给出了几个 {{anch("Usage")}} (用例)。

+

本页面记录了 Console 对象上的方法并给出了几个 Usage (用例)。

{{AvailableInWorkers}}

diff --git a/files/zh-cn/web/api/credentialscontainer/index.html b/files/zh-cn/web/api/credentialscontainer/index.html index 73092cb5f0..6ea38b4409 100644 --- a/files/zh-cn/web/api/credentialscontainer/index.html +++ b/files/zh-cn/web/api/credentialscontainer/index.html @@ -27,7 +27,7 @@ translation_of: Web/API/CredentialsContainer
{{domxref("CredentialsContainer.get()")}}
Returns a {{jsxref("Promise")}} that resolves with the {{domxref("Credential")}} instance that matches the provided parameters.
{{domxref("CredentialsContainer.preventSilentAccess()")}}
-
Sets a flag that specifies whether automatic log in is allowed for future visits to the current origin, then returns an empty {{jsxref("Promise")}}. For example, you might call this, after a user signs out of a website to ensure that he/she isn't automatically signed in on the next site visit. Earlier versions of the spec called this method requireUserMediation(). See {{anch("Browser compatibility")}} for support details.
+
Sets a flag that specifies whether automatic log in is allowed for future visits to the current origin, then returns an empty {{jsxref("Promise")}}. For example, you might call this, after a user signs out of a website to ensure that he/she isn't automatically signed in on the next site visit. Earlier versions of the spec called this method requireUserMediation(). See Browser compatibility for support details.
{{domxref("CredentialsContainer.store()")}}
Stores a set of credentials for a user, inside a provided {{domxref("Credential")}} instance and returns that instance in a {{jsxref("Promise")}}.
diff --git a/files/zh-cn/web/api/cssrule/index.html b/files/zh-cn/web/api/cssrule/index.html index 184e25376b..3af32d9c65 100644 --- a/files/zh-cn/web/api/cssrule/index.html +++ b/files/zh-cn/web/api/cssrule/index.html @@ -10,7 +10,7 @@ translation_of: Web/API/CSSRule ---
{{APIRef("CSSOM")}}
-

CSSRule 接口表示一条 CSS 规则。有几种不同的规则类型,在下面的{{anch("类型常量")}}部分中有悉数列出。

+

CSSRule 接口表示一条 CSS 规则。有几种不同的规则类型,在下面的类型常量部分中有悉数列出。

CSSRule 接口指定了所有类型的规则的公共属性,而特定类型的规则的专有属性则在这些规则各自类型的、更专用的接口中被指定。

@@ -26,7 +26,7 @@ translation_of: Web/API/CSSRule
{{domxref("CSSRule.parentStyleSheet")}} {{readonlyinline}}
返回包含此规则的样式表的 {{domxref("CSSStyleSheet")}} 对象。
{{domxref("CSSRule.type")}} {{readonlyinline}}
-
规则类型,表示 CSS 规则类型 {{anch("类型常量")}} 中的一种类型。
+
规则类型,表示 CSS 规则类型 类型常量 中的一种类型。

常量

diff --git a/files/zh-cn/web/api/cssstylesheet/index.html b/files/zh-cn/web/api/cssstylesheet/index.html index 1252210d3b..3824e21c62 100644 --- a/files/zh-cn/web/api/cssstylesheet/index.html +++ b/files/zh-cn/web/api/cssstylesheet/index.html @@ -27,7 +27,7 @@ translation_of: Web/API/CSSStyleSheet

另一条规则可能是一条“@”规则(at-rule),例如  {{cssxref("@import")}} 或 {{cssxref("@media")}} 等等。

-

在{{anch("说明")}}部分中查看 CSSStyleSheet 对象的多种获取方式。

+

说明部分中查看 CSSStyleSheet 对象的多种获取方式。

属性

diff --git a/files/zh-cn/web/api/datatransferitem/getasstring/index.html b/files/zh-cn/web/api/datatransferitem/getasstring/index.html index 3b8147f7f6..ce731b39dd 100644 --- a/files/zh-cn/web/api/datatransferitem/getasstring/index.html +++ b/files/zh-cn/web/api/datatransferitem/getasstring/index.html @@ -16,7 +16,7 @@ translation_of: Web/API/DataTransferItem/getAsString
callback
-
A callback function that has access to the {{domxref("DataTransferItem","data transfer item's")}} string data. See {{anch("Callback")}} below for details.
+
A callback function that has access to the {{domxref("DataTransferItem","data transfer item's")}} string data. See Callback below for details.

Return value

diff --git a/files/zh-cn/web/api/document/createelement/index.html b/files/zh-cn/web/api/document/createelement/index.html index a0b1fecfad..e45a93dac1 100644 --- a/files/zh-cn/web/api/document/createelement/index.html +++ b/files/zh-cn/web/api/document/createelement/index.html @@ -24,7 +24,7 @@ translation_of: Web/API/Document/createElement
tagName
指定要创建元素类型的字符串,创建元素时的 {{domxref("Node.nodeName", "nodeName")}} 使用 tagName 的值为初始化,该方法不允许使用限定名称(如:"html:a"),在 HTML 文档上调用 createElement() 方法创建元素之前会将tagName 转化成小写,在 Firefox、Opera 和 Chrome 内核中,createElement(null) 等同于 createElement("null")
options{{optional_inline}}
-
一个可选的参数 ElementCreationOptions 是包含一个属性名为 is 的对象,该对象的值是用 customElements.define() 方法定义过的一个自定义元素的标签名。为了向前兼容较老版本的 Custom Elements specification, 有一些浏览器会允许你传一个值为自定义元素的标签名的字符串作为该参数的值。可以参考本页下方的 {{anch("Web component example")}} Google 的 Extending native HTML elements 文档仔细了解如何使用该参数。
+
一个可选的参数 ElementCreationOptions 是包含一个属性名为 is 的对象,该对象的值是用 customElements.define() 方法定义过的一个自定义元素的标签名。为了向前兼容较老版本的 Custom Elements specification, 有一些浏览器会允许你传一个值为自定义元素的标签名的字符串作为该参数的值。可以参考本页下方的 Web component 示例 Google 的 Extending native HTML elements 文档仔细了解如何使用该参数。

返回值

diff --git a/files/zh-cn/web/api/document/createevent/index.html b/files/zh-cn/web/api/document/createevent/index.html index d371052ddc..efcd7e1288 100644 --- a/files/zh-cn/web/api/document/createevent/index.html +++ b/files/zh-cn/web/api/document/createevent/index.html @@ -20,7 +20,7 @@ translation_of: Web/API/Document/createEvent

示例

diff --git a/files/zh-cn/web/api/document/createnodeiterator/index.html b/files/zh-cn/web/api/document/createnodeiterator/index.html index 1e1b653d7a..139c554ef1 100644 --- a/files/zh-cn/web/api/document/createnodeiterator/index.html +++ b/files/zh-cn/web/api/document/createnodeiterator/index.html @@ -98,12 +98,12 @@ translation_of: Web/API/Document/createNodeIterator
filter {{ optional_inline() }}
-
是实现 {{ domxref("NodeFilter") }} 接口的对象; 其 acceptNode() 方法会对从根节点开始到子树中的每个节点都调用一次,哪些节点需要进入迭代节点列表等待调用则取决于whatToShow参数(也可以使用一个简单的回调函数代替acceptNode())。该方法需要返回下列常量之一: NodeFilter.FILTER_ACCEPT ,NodeFilter.FILTER_REJECTNodeFilter.FILTER_SKIP(见NodeFilter),参见{{ anch("示例") }}。
+
是实现 {{ domxref("NodeFilter") }} 接口的对象; 其 acceptNode() 方法会对从根节点开始到子树中的每个节点都调用一次,哪些节点需要进入迭代节点列表等待调用则取决于whatToShow参数(也可以使用一个简单的回调函数代替acceptNode())。该方法需要返回下列常量之一: NodeFilter.FILTER_ACCEPT ,NodeFilter.FILTER_REJECTNodeFilter.FILTER_SKIP(见NodeFilter),参见示例
注意: 在Gecko12.0{{ geckoRelease("12.0") }}以前,这个方法接收第四个可选的参数(entityReferenceExpansion),这不是DOM4 规范中的一部分,因此被移除了。这个参数表示实体引用节点的子代对于迭代器是否可见。因为浏览器不会创建这样的节点,这个参数没有任何作用。
-

示例

+

示例

const nodeIterator = document.createNodeIterator(
     document.body,
diff --git a/files/zh-cn/web/api/document/execcommand/index.html b/files/zh-cn/web/api/document/execcommand/index.html
index 355a4bd33f..cf51a9be23 100644
--- a/files/zh-cn/web/api/document/execcommand/index.html
+++ b/files/zh-cn/web/api/document/execcommand/index.html
@@ -31,7 +31,7 @@ translation_of: Web/API/Document/execCommand
 
 
aCommandName
-
一个 {{domxref("DOMString")}} ,命令的名称。可用命令列表请参阅 {{anch("命令")}} 。
+
一个 {{domxref("DOMString")}} ,命令的名称。可用命令列表请参阅 命令
aShowDefaultUI
一个 {{jsxref("Boolean")}}, 是否展示用户界面,一般为 false。Mozilla 没有实现。
aValueArgument
diff --git a/files/zh-cn/web/api/document/keypress_event/index.html b/files/zh-cn/web/api/document/keypress_event/index.html index 297a595b2b..a9c2bf2bf3 100644 --- a/files/zh-cn/web/api/document/keypress_event/index.html +++ b/files/zh-cn/web/api/document/keypress_event/index.html @@ -78,7 +78,7 @@ translation_of: Web/API/Document/keypress_event key {{readonlyInline}} DOMString (string) - The key value of the key represented by the event. If the value has a printed representation, this attribute's value is the same as the char attribute. Otherwise, it's one of the key value strings specified in {{ anch("Key values") }}. If the key can't be identified, this is the string "Unidentified". See key names and char values for the detail. Read Only. + The key value of the key represented by the event. If the value has a printed representation, this attribute's value is the same as the char attribute. Otherwise, it's one of the key value strings specified in Key Values. If the key can't be identified, this is the string "Unidentified". See key names and char values for the detail. Read Only. charCode {{readonlyInline}} @@ -90,7 +90,7 @@ translation_of: Web/API/Document/keypress_event keyCode {{readonlyInline}} Unsigned long (int) - A system and implementation dependent numerical code identifying the unmodified value of the pressed key. This is usually the decimal ASCII ({{ RFC(20) }}) or Windows 1252 code corresponding to the key; see {{ anch("Virtual key codes") }} for a list of common values. If the key can't be identified, this value is 0. + A system and implementation dependent numerical code identifying the unmodified value of the pressed key. This is usually the decimal ASCII ({{ RFC(20) }}) or Windows 1252 code corresponding to the key; see Virtual key codes for a list of common values. If the key can't be identified, this value is 0.
Warning: This attribute is deprecated; you should use key instead, if available.
@@ -137,7 +137,6 @@ translation_of: Web/API/Document/keypress_event true if the meta key was down when the event was fired. false otherwise. - diff --git a/files/zh-cn/web/api/document/queryselector/index.html b/files/zh-cn/web/api/document/queryselector/index.html index 8a449768ec..8f0332d2dc 100644 --- a/files/zh-cn/web/api/document/queryselector/index.html +++ b/files/zh-cn/web/api/document/queryselector/index.html @@ -29,7 +29,7 @@ translation_of: Web/API/Document/querySelector
-

提示:必须使用反斜杠字符转义不属于标准CSS语法的字符。 由于JavaScript也使用退格转义,因此在使用这些字符编写字符串文字时必须特别小心。 有关详细信息,请参阅{{anch("Escaping special characters")}}。

+

提示:必须使用反斜杠字符转义不属于标准CSS语法的字符。 由于JavaScript也使用退格转义,因此在使用这些字符编写字符串文字时必须特别小心。 有关详细信息,请参阅转义特殊字符

返回值

diff --git a/files/zh-cn/web/api/document/queryselectorall/index.html b/files/zh-cn/web/api/document/queryselectorall/index.html index 0e43d6020b..0f679ce98d 100644 --- a/files/zh-cn/web/api/document/queryselectorall/index.html +++ b/files/zh-cn/web/api/document/queryselectorall/index.html @@ -39,7 +39,7 @@ translation_of: Web/API/Document/querySelectorAll
-

注意: 必须使用反斜杠字符转义不属于标准CSS语法的字符。 由于JavaScript也使用反斜杠转义,因此在使用这些字符编写字符串文字时必须特别小心。 有关详细信息,请参阅 {{anch("Escaping special characters")}}

+

注意: 必须使用反斜杠字符转义不属于标准CSS语法的字符。 由于JavaScript也使用反斜杠转义,因此在使用这些字符编写字符串文字时必须特别小心。有关详细信息,请参阅转义特殊字符

返回值

@@ -163,11 +163,7 @@ inner.length; // 0

浏览器兼容性

-
- -

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

-

相关连接

diff --git a/files/zh-cn/web/api/document/title/index.html b/files/zh-cn/web/api/document/title/index.html index 40056fafe2..9b91ecff0e 100644 --- a/files/zh-cn/web/api/document/title/index.html +++ b/files/zh-cn/web/api/document/title/index.html @@ -10,7 +10,7 @@ translation_of: Web/API/Document/title

语法

var docTitle = document.title;
 
-

title 是一个包含 document 标题的字符串。如果通过设置 document.title 将标题覆盖,则返回覆盖后的值。否则返回标签里指定的标题(参见下面的 {{Anch("Notes")}})。

+

title 是一个包含 document 标题的字符串。如果通过设置 document.title 将标题覆盖,则返回覆盖后的值。否则返回标签里指定的标题(参见下面的 Notes)。

document.title = newTitle;
 

newTitle 是文档的新标题。赋值操作影响 document.title 的返回值,文档的显示标题(即窗口或标签页顶部的标题栏),另外还会影响文档的 DOM,即改变 HTML 文档中 <title> 元素的内容。

diff --git a/files/zh-cn/web/api/domexception/index.html b/files/zh-cn/web/api/domexception/index.html index 7616ea3c45..a5181039a5 100644 --- a/files/zh-cn/web/api/domexception/index.html +++ b/files/zh-cn/web/api/domexception/index.html @@ -24,7 +24,7 @@ translation_of: Web/API/DOMException
{{domxref("DOMException.code")}} {{deprecated_inline}} {{readOnlyInline}}
-
返回一个 short,包含 {{anch("Error codes", "error code constants")}} 中的一个,或者返回 0,如果没有匹配的话。这个字段由于历史原因被使用。现在不再使用这个新的DOM异常:他们把这个信息放入 {{domxref("DOMException.name")}} 属性。
+
返回一个 short,包含错误代码常量中的一个,或者返回 0,如果没有匹配的话。这个字段由于历史原因被使用。现在不再使用这个新的DOM异常:他们把这个信息放入 {{domxref("DOMException.name")}} 属性。
{{domxref("DOMException.message")}} {{readOnlyInline}}
返回一个 {{ domxref("DOMString") }} 代表与给定的错误名称有关信息或描述。
{{domxref("DOMException.name")}} {{readOnlyInline}}
diff --git a/files/zh-cn/web/api/element/getattribute/index.html b/files/zh-cn/web/api/element/getattribute/index.html index ce97f4a004..f6ce24319a 100644 --- a/files/zh-cn/web/api/element/getattribute/index.html +++ b/files/zh-cn/web/api/element/getattribute/index.html @@ -9,7 +9,7 @@ translation_of: Web/API/Element/getAttribute

概要

-

getAttribute() 返回元素上一个指定的属性值。如果指定的属性不存在,则返回  null 或 "" (空字符串);具体细节, 请参阅  {{Anch("Notes")}} 部分。

+

getAttribute() 返回元素上一个指定的属性值。如果指定的属性不存在,则返回  null 或 "" (空字符串);具体细节, 请参阅  Notes 部分。

语法

diff --git a/files/zh-cn/web/api/element/setattribute/index.html b/files/zh-cn/web/api/element/setattribute/index.html index 7a35901b5b..48de06340a 100644 --- a/files/zh-cn/web/api/element/setattribute/index.html +++ b/files/zh-cn/web/api/element/setattribute/index.html @@ -37,7 +37,7 @@ translation_of: Web/API/Element/setAttribute

尽管对于不存在的属性,getAttribute() 返回 null,你还是应该使用 removeAttribute() 代替 elt.setAttribute(attr, null) 来删除属性。

-

布尔属性(原文是Boolean attributes)只要出现在元素上就会被认为是 true ,无论它的值是什么; 一般来说, 你应该将 value 设置为空字符串 ("") 。(一些人使用这个属性的名称作为值; 这不会出现什么问题,但这是不规范的). See the {{anch("Example", "example")}} below for a practical demonstration.

+

布尔属性(原文是Boolean attributes)只要出现在元素上就会被认为是 true ,无论它的值是什么; 一般来说, 你应该将 value 设置为空字符串 ("") 。(一些人使用这个属性的名称作为值; 这不会出现什么问题,但这是不规范的). See the example below for a practical demonstration.

由于将指定的值转换为字符串,因此指定null不一定能达到您的期望。 而不是删除属性或将其值设置为{{jsxref("null")}},而是将属性的值设置为字符串“ null”。 如果要删除属性,请调用{{domxref("Element.removeAttribute”,“ removeAttribute()")}}}。

@@ -52,7 +52,7 @@ translation_of: Web/API/Element/setAttribute
指定的属性名称包含一个或多个在属性名称中无效的字符。
-

例子

+

示例

在下面的例子中,setAttribute() 被用于设置 {{HTMLElement("button")}} 上的属性。

diff --git a/files/zh-cn/web/api/event/eventphase/index.html b/files/zh-cn/web/api/event/eventphase/index.html index d5be77ae7a..fae6a99163 100644 --- a/files/zh-cn/web/api/event/eventphase/index.html +++ b/files/zh-cn/web/api/event/eventphase/index.html @@ -12,7 +12,7 @@ translation_of: Web/API/Event/eventPhase
var phase = event.eventPhase;
 
-

返回一个代表当前执行阶段的 整数值,下面列出了不同的执行阶段{{anch("Event phase constants")}}.

+

返回一个代表当前执行阶段的 整数值,下面列出了不同的执行阶段事件阶段常量.

常量

diff --git a/files/zh-cn/web/api/eventtarget/addeventlistener/index.html b/files/zh-cn/web/api/eventtarget/addeventlistener/index.html index 64f66c8e1c..d0e42edb58 100644 --- a/files/zh-cn/web/api/eventtarget/addeventlistener/index.html +++ b/files/zh-cn/web/api/eventtarget/addeventlistener/index.html @@ -33,13 +33,13 @@ Non-standard_inline}}); // Gecko/Mozilla only
type
表示监听事件类型的字符串。
listener
-
当所监听的事件类型触发时,会接收到一个事件通知(实现了 {{domxref("Event")}} 接口的对象)对象。listener 必须是一个实现了 {{domxref("EventListener")}} 接口的对象,或者是一个函数。有关回调本身的详细信息,请参阅{{anch("The event listener callback")}} 
+
当所监听的事件类型触发时,会接收到一个事件通知(实现了 {{domxref("Event")}} 接口的对象)对象。listener 必须是一个实现了 {{domxref("EventListener")}} 接口的对象,或者是一个函数。有关回调本身的详细信息,请参阅事件监听回调 
options {{optional_inline}}
一个指定有关 listener 属性的可选参数对象。可用的选项如下:
  • capture:  {{jsxref("Boolean")}},表示 listener 会在该类型的事件捕获阶段传播到该 EventTarget 时触发。
  • once:  {{jsxref("Boolean")}},表示 listener 在添加之后最多只调用一次。如果是 true, listener 会在其被调用之后自动移除。
  • -
  • passive: {{jsxref("Boolean")}},设置为true时,表示 listener 永远不会调用 preventDefault()。如果 listener 仍然调用了这个函数,客户端将会忽略它并抛出一个控制台警告。查看 {{anch("使用 passive 改善的滚屏性能")}} 了解更多.
  • +
  • passive: {{jsxref("Boolean")}},设置为true时,表示 listener 永远不会调用 preventDefault()。如果 listener 仍然调用了这个函数,客户端将会忽略它并抛出一个控制台警告。查看 使用 passive 改善的滚屏性能 了解更多.
  • signal:{{domxref("AbortSignal")}},该 AbortSignal 的 {{domxref("AbortController/abort()", "abort()")}} 方法被调用时,监听器会被移除。
  • {{non-standard_inline}} mozSystemGroup: 只能在 XBL 或者是 Firefox' chrome 使用,这是个 {{jsxref("Boolean")}},表示 listener 被添加到 system group。
@@ -319,7 +319,7 @@ el.addEventListener("click", () => { modifyText("four"); }, false);

{{ EmbedLiveSample('options用法示例', 600, 310, '', 'Web/API/EventTarget/addEventListener') }}

-

在使用options对象中具体的值前,最好确保用户的浏览器支持它,因为这些是历史上并非所有浏览器都支持的附加功能。你可以查看{{anch("Safely detecting option support")}}以了解更多

+

在使用options对象中具体的值前,最好确保用户的浏览器支持它,因为这些是历史上并非所有浏览器都支持的附加功能。你可以查看option支持的安全检测以了解更多

备注

diff --git a/files/zh-cn/web/api/fetch_api/using_fetch/index.md b/files/zh-cn/web/api/fetch_api/using_fetch/index.md index 165b290a82..b2833592a6 100644 --- a/files/zh-cn/web/api/fetch_api/using_fetch/index.md +++ b/files/zh-cn/web/api/fetch_api/using_fetch/index.md @@ -36,7 +36,7 @@ fetch('http://example.com/movies.json') 当然它只是一个 HTTP 响应,而不是真的 JSON。为了获取JSON的内容,我们需要使用 {{domxref("Response.json()", "json()")}} 方法(该方法返回一个将响应 body 解析成 JSON 的 promise)。 -> **备注:** {{anch("Body")}} 还有其他相似的方法,用于获取其他类型的内容。 +> **备注:** [Body](#Body) 还有其他相似的方法,用于获取其他类型的内容。 最好使用符合[内容安全策略 (CSP)](/zh-CN/docs/Web/HTTP/Headers/Content-Security-Policy)的链接而不是使用直接指向资源地址的方式来进行 fetch 的请求。 @@ -320,7 +320,7 @@ console.log(myHeaders.get('X-Custom-Header')); // null 虽然一些操作只能在 {{domxref("Service_Worker_API","ServiceWorkers")}} 中使用,但是它提供了更方便的操作 Headers 的 API。 -如果使用了一个不合法的 HTTP Header 属性名,那么 Headers 的方法通常都抛出 TypeError 异常。如果不小心写入了一个不可写的属性({{anch("Guard", "见下方")}}),也会抛出一个 TypeError 异常。除此以外的情况,失败了并不抛出异常。例如: +如果使用了一个不合法的 HTTP Header 属性名,那么 Headers 的方法通常都抛出 TypeError 异常。如果不小心写入了一个不可写的属性([见下方](#Guard)),也会抛出一个 TypeError 异常。除此以外的情况,失败了并不抛出异常。例如: ```js const myResponse = Response.error(); diff --git a/files/zh-cn/web/api/file/index.html b/files/zh-cn/web/api/file/index.html index d87a8ed3f0..12fbc5bee5 100644 --- a/files/zh-cn/web/api/file/index.html +++ b/files/zh-cn/web/api/file/index.html @@ -13,7 +13,7 @@ translation_of: Web/API/File

文件(File)接口提供有关文件的信息,并允许网页中的 JavaScript 访问其内容。

-

通常情况下, File 对象是来自用户在一个 {{HTMLElement("input")}} 元素上选择文件后返回的 {{domxref("FileList")}} 对象,也可以是来自由拖放操作生成的 {{domxref("DataTransfer")}} 对象,或者来自 {{domxref("HTMLCanvasElement")}} 上的 mozGetAsFile() API。在Gecko中,特权代码可以创建代表任何本地文件的File对象,而无需用户交互(有关详细信息,请参阅{{anch("注意事项")}}。

+

通常情况下, File 对象是来自用户在一个 {{HTMLElement("input")}} 元素上选择文件后返回的 {{domxref("FileList")}} 对象,也可以是来自由拖放操作生成的 {{domxref("DataTransfer")}} 对象,或者来自 {{domxref("HTMLCanvasElement")}} 上的 mozGetAsFile() API。在Gecko中,特权代码可以创建代表任何本地文件的File对象,而无需用户交互(有关详细信息,请参阅注意事项

File 对象是特殊类型的 {{domxref("Blob")}},且可以用在任意的 Blob 类型的 context 中。比如说, {{domxref("FileReader")}}, {{domxref("URL.createObjectURL()")}}, {{domxref("ImageBitmapFactories.createImageBitmap()", "createImageBitmap()")}}, 及 {{domxref("XMLHttpRequest", "", "send()")}} 都能处理 Blob File

diff --git a/files/zh-cn/web/api/file/using_files_from_web_applications/index.html b/files/zh-cn/web/api/file/using_files_from_web_applications/index.html index 8d2a0f91aa..24f339f10b 100644 --- a/files/zh-cn/web/api/file/using_files_from_web_applications/index.html +++ b/files/zh-cn/web/api/file/using_files_from_web_applications/index.html @@ -284,7 +284,7 @@ function dragover(e) { </div> -

这确定我们的文件 {{ HTMLElement("input") }} 元素显示为一个可以调用文件选择器的链接(我们隐藏了文件输入元素来阻止显示用户不友好的界面)。这个在 {{ anch("Using hidden file input elements using the click() method") }}节已经说明了这种调用文件选择器的方法。

+

这确定我们的文件 {{ HTMLElement("input") }} 元素显示为一个可以调用文件选择器的链接(我们隐藏了文件输入元素来阻止显示用户不友好的界面)。这个在 通过 click() 方法使用隐藏的 file input 元素已经说明了这种调用文件选择器的方法。

handleFiles() 方法如下:

diff --git a/files/zh-cn/web/api/file_and_directory_entries_api/index.html b/files/zh-cn/web/api/file_and_directory_entries_api/index.html index 83bb4e222b..30046632a6 100644 --- a/files/zh-cn/web/api/file_and_directory_entries_api/index.html +++ b/files/zh-cn/web/api/file_and_directory_entries_api/index.html @@ -15,7 +15,7 @@ translation_of: Web/API/File_and_Directory_Entries_API

文件与目录条目 API 模拟一个 web 应用可以导航和访问的本地文件系统。你在虚拟的沙箱文件系统中可以开发一个读、写、创建文件或者目录的应用。

-

因为这是一个非标准 API,它的规范目前还没有在标准的轨道上,所以要记住,并不是所有的浏览器都实现了它,而且那些实现了的浏览器可能只实现了它的一小部分。有关详细信息,请查看{{anch("浏览器兼容性")}}部分。

+

因为这是一个非标准 API,它的规范目前还没有在标准的轨道上,所以要记住,并不是所有的浏览器都实现了它,而且那些实现了的浏览器可能只实现了它的一小部分。有关详细信息,请查看浏览器兼容性部分。

根据您希望的是异步行为还是同步行为,存在两个非常相似的 API。同步 API 可在 {{domxref("Worker")}} 中使用,并将返回所需的值。异步 API 不会阻塞和函数,API不会返回值;相反,您将需要提供一个回调函数,以便在响应到达时处理它。

diff --git a/files/zh-cn/web/api/file_handle_api/index.html b/files/zh-cn/web/api/file_handle_api/index.html index e955cdf0ab..5421612b10 100644 --- a/files/zh-cn/web/api/file_handle_api/index.html +++ b/files/zh-cn/web/api/file_handle_api/index.html @@ -44,7 +44,7 @@ IDBReq.onsuccess = function(){

{{domxref("IDBDatabase.mozCreateFileHandle","mozCreateFileHandle()")}}接受两个参数:名称和可选类型。 这两个都是描述性的,数据库不使用。 但是,它们对于{{domxref("FileHandle")}}对象很重要,因为它可以生成{{domxref("File")}}对象,这些对象继承自己的{{domxref("File.name","name")}}和{{domxref("File.type","type")}}的值。 就是说,由于名称与任何实际文件名都不匹配,因此它可以是一个空字符串,甚至不必是唯一的。

-

Note: the above code only creates a "temporary file" that exists only while you hold the {{domxref("FileHandle")}} instance. If you want a file to survive a page refresh/app relaunch, you need to store the handle in a more permanent location, like the database itself. See {{Anch("File storage")}} below to learn more about this.

+

Note: the above code only creates a "temporary file" that exists only while you hold the {{domxref("FileHandle")}} instance. If you want a file to survive a page refresh/app relaunch, you need to store the handle in a more permanent location, like the database itself. See 文件储存 below to learn more about this.

执行读写操作

diff --git a/files/zh-cn/web/api/filesystemdirectoryentry/index.html b/files/zh-cn/web/api/filesystemdirectoryentry/index.html index 22b7a7aeef..df09ad89c8 100644 --- a/files/zh-cn/web/api/filesystemdirectoryentry/index.html +++ b/files/zh-cn/web/api/filesystemdirectoryentry/index.html @@ -8,7 +8,7 @@ translation_of: Web/API/FileSystemDirectoryEntry

文件和目录条目 API 的 FileSystemDirectoryEntry 接口表示文件系统中的目录。它提供了方法,使其能够访问和操作目录中的文件,以及访问目录中的条目。

-

由于这是个非标准的 API,它的规范当前并没有在标准进程中,重要的是要记住,并不是所有浏览器都实现了他,并且实现它的浏览器可能仅仅实现了一小部分。更多细节请查看 {{anch("Browser compatibility")}} 。

+

由于这是个非标准的 API,它的规范当前并没有在标准进程中,重要的是要记住,并不是所有浏览器都实现了他,并且实现它的浏览器可能仅仅实现了一小部分。更多细节请查看 Browser compatibility

基本概念

diff --git a/files/zh-cn/web/api/filesystemdirectoryreader/index.html b/files/zh-cn/web/api/filesystemdirectoryreader/index.html index 471b5a4240..d3d71b3169 100644 --- a/files/zh-cn/web/api/filesystemdirectoryreader/index.html +++ b/files/zh-cn/web/api/filesystemdirectoryreader/index.html @@ -20,7 +20,7 @@ translation_of: Web/API/FileSystemDirectoryReader

The FileSystemDirectoryReader interface of the File and Directory Entries API lets you access the {{domxref("FileEntry")}}-based objects (generally {{domxref("FileSystemFileEntry")}} or {{domxref("FileSystemDirectoryEntry")}}) representing each entry in a directory.

-

Because this is a non-standard API, whose specification is not currently on a standards track, it's important to keep in mind that not all browsers implement it, and those that do may implement only small portions of it. Check the {{anch("Browser compatibility")}} section for details.

+

Because this is a non-standard API, whose specification is not currently on a standards track, it's important to keep in mind that not all browsers implement it, and those that do may implement only small portions of it. Check the Browser compatibility section for details.

Methods

diff --git a/files/zh-cn/web/api/filesystementry/index.html b/files/zh-cn/web/api/filesystementry/index.html index 8cfed42aaf..6618309e50 100644 --- a/files/zh-cn/web/api/filesystementry/index.html +++ b/files/zh-cn/web/api/filesystementry/index.html @@ -8,7 +8,7 @@ translation_of: Web/API/FileSystemEntry

The FileSystemEntry interface of the File and Directory Entries API represents a single in a file system. The entry can be a file or a directory (directories are represented by the {{domxref("DirectoryEntry")}} interface). It includes methods for working with files—including copying, moving, removing, and reading files—as well as information about a file it points to—including the file name and its path from the root to the entry.

-

Because this is a non-standard API, whose specification is not currently on a standards track, it's important to keep in mind that not all browsers implement it, and those that do may implement only small portions of it. Check the {{anch("Browser compatibility")}} section for details.

+

Because this is a non-standard API, whose specification is not currently on a standards track, it's important to keep in mind that not all browsers implement it, and those that do may implement only small portions of it. Check the Browser compatibility section for details.

Basic concepts

diff --git a/files/zh-cn/web/api/filesystemfileentry/index.html b/files/zh-cn/web/api/filesystemfileentry/index.html index de0f33c260..8b330192b1 100644 --- a/files/zh-cn/web/api/filesystemfileentry/index.html +++ b/files/zh-cn/web/api/filesystemfileentry/index.html @@ -8,7 +8,7 @@ translation_of: Web/API/FileSystemFileEntry

文件系统 API 的 FileSystemFileEntry 接口表示文件系统中的文件。它提供了属性,描述文件的属性,以及 {{domxref("FileSystemFileEntry.file", "file()")}} 方法,它创建了可以用于读取文件的 {{domxref("File")}} 对象。

-

由于这是个非标准 API,它的规范当前并不在标准化过程中。重要的是要记住,并不是所有浏览器都实现了它,并且实现它的浏览器可能仅仅实现一小部分。点击 {{anch("Browser compatibility")}} 来查看更多细节。

+

由于这是个非标准 API,它的规范当前并不在标准化过程中。重要的是要记住,并不是所有浏览器都实现了它,并且实现它的浏览器可能仅仅实现一小部分。点击 Browser compatibility 来查看更多细节。

属性

diff --git a/files/zh-cn/web/api/fullscreen_api/guide/index.html b/files/zh-cn/web/api/fullscreen_api/guide/index.html index f6b27bbb90..325cae8184 100644 --- a/files/zh-cn/web/api/fullscreen_api/guide/index.html +++ b/files/zh-cn/web/api/fullscreen_api/guide/index.html @@ -67,7 +67,7 @@ if (elem.requestFullscreen) {

 

-

用户总是可以自行退出全屏模式;详见 {{Anch("Things your users want to know")}}。你也可以以编程方式通过调用 {{DOMxRef("Document.exitFullscreen()")}} 方法来做到这点。

+

用户总是可以自行退出全屏模式;详见 Things your users want to know。你也可以以编程方式通过调用 {{DOMxRef("Document.exitFullscreen()")}} 方法来做到这点。

其他信息

diff --git a/files/zh-cn/web/api/fullscreen_api/index.html b/files/zh-cn/web/api/fullscreen_api/index.html index 87e6fec637..b2dca17e13 100644 --- a/files/zh-cn/web/api/fullscreen_api/index.html +++ b/files/zh-cn/web/api/fullscreen_api/index.html @@ -19,7 +19,7 @@ translation_of: Web/API/Fullscreen_API

可以在全屏 API 指南这篇文章了解更多细节。

-

注意:当前并不是所有的浏览器都支持该 API,大多数浏览器需要使用供应商前缀或者尚未实现该规范。下面的浏览器兼容性表 {{anch("Browser compatibility")}} 可以看到各个浏览器对此的支持(你也可以使用 Fscreen 来提供跨浏览器 API 访问)。

+

注意:当前并不是所有的浏览器都支持该 API,大多数浏览器需要使用供应商前缀或者尚未实现该规范。下面的浏览器兼容性表 Browser compatibility 可以看到各个浏览器对此的支持(你也可以使用 Fscreen 来提供跨浏览器 API 访问)。

接口

diff --git a/files/zh-cn/web/api/gamepad/index.html b/files/zh-cn/web/api/gamepad/index.html index 05a3b1b61d..33a7a2b46d 100644 --- a/files/zh-cn/web/api/gamepad/index.html +++ b/files/zh-cn/web/api/gamepad/index.html @@ -71,14 +71,14 @@ translation_of: Web/API/Gamepad {{SpecName("GamepadExtensions", "#partial-gamepad-interface", "Gamepad extensions")}} {{Spec2("GamepadExtensions")}} - Defines the {{anch("Experimental extensions to Gamepad")}} + Defines the Experimental extensions to Gamepad

浏览器兼容性

-

{{Compat("api.Gamepad")}}

+

{{Compat}}

另请参阅

diff --git a/files/zh-cn/web/api/gamepad_api/index.html b/files/zh-cn/web/api/gamepad_api/index.html index 114a054a0d..91c1cd80e9 100644 --- a/files/zh-cn/web/api/gamepad_api/index.html +++ b/files/zh-cn/web/api/gamepad_api/index.html @@ -74,7 +74,7 @@ translation_of: Web/API/Gamepad_API {{SpecName("GamepadExtensions")}} {{Spec2("GamepadExtensions")}} - Defines the {{anch("Experimental Gamepad extensions")}}. + 定义 实验性 Gamepad 扩展. {{SpecName("Gamepad", "", "The Gamepad API specification")}} diff --git a/files/zh-cn/web/api/headers/index.html b/files/zh-cn/web/api/headers/index.html index 6ee8e3e390..213545befe 100644 --- a/files/zh-cn/web/api/headers/index.html +++ b/files/zh-cn/web/api/headers/index.html @@ -10,7 +10,7 @@ translation_of: Web/API/Headers ---

{{ APIRef("Fetch") }}

-

Fetch API 的 Headers 接口允许您对HTTP请求和响应头执行各种操作。 这些操作包括检索,设置,添加和删除。 一个Headers对象具有关联的头列表,它最初为空,由零个或多个键值对组成。你可以使用 {{domxref("Headers.append","append()")}} 方法添加 之类的方法添加到此(参见 {{anch("Examples")}})。在该接口的所有方法中,标题名称由不区分大小写的字节序列匹配。

+

Fetch API 的 Headers 接口允许您对HTTP请求和响应头执行各种操作。 这些操作包括检索,设置,添加和删除。 一个Headers对象具有关联的头列表,它最初为空,由零个或多个键值对组成。你可以使用 {{domxref("Headers.append","append()")}} 方法添加 之类的方法添加到此(参见 示例)。在该接口的所有方法中,标题名称由不区分大小写的字节序列匹配。

出于安全考虑,某些头只能由用户代理控制。这些头信息包括 {{Glossary("Forbidden_header_name", "forbidden header names", 1)}}  和 {{Glossary("Forbidden_response_header_name", "forbidden response header names", 1)}}。

@@ -67,7 +67,7 @@ translation_of: Web/API/Headers
用于返回具有给定名称的 Headers 对象中所有值的数组; 这个方法现在已经从规范中删除了,{{domxref("Headers.get()")}} 方法现在返回所有的值而不是一个。
-

范例

+

示例

在这个小示例中, 我们将会通过Headers构造函数创建一个新的header, 先使用append()方法添加一个header, 然后通过get()方法返回这个header的值

diff --git a/files/zh-cn/web/api/html_drag_and_drop_api/index.html b/files/zh-cn/web/api/html_drag_and_drop_api/index.html index 98718c5e67..d844938fe5 100644 --- a/files/zh-cn/web/api/html_drag_and_drop_api/index.html +++ b/files/zh-cn/web/api/html_drag_and_drop_api/index.html @@ -96,7 +96,7 @@ translation_of: Web/API/HTML_Drag_and_Drop_API

{{domxref("DataTransfer")}} 和 {{domxref("DataTransferItem")}} 接口的一个主要的不同是前者使用同步的 {{domxref("DataTransfer.getData","getData()")}} 方法去得到拖拽项的数据,而后者使用异步的 {{domxref("DataTransferItem.getAsString","getAsString()")}} 方法得到拖拽项的数据。

-

注意: {{domxref("DragEvent")}} 和 {{domxref("DataTransfer")}} 接口是所有桌面浏览器都支持的。但是, {{domxref("DataTransferItem")}} 和{{domxref("DataTransferItemList")}} 接口并不被所有浏览器支持。请移步 {{anch("互操作性")}} 了解更多关于拖拽行为的信息.

+

注意: {{domxref("DragEvent")}} 和 {{domxref("DataTransfer")}} 接口是所有桌面浏览器都支持的。但是, {{domxref("DataTransferItem")}} 和{{domxref("DataTransferItemList")}} 接口并不被所有浏览器支持。请移步 互操作性 了解更多关于拖拽行为的信息.

Gecko 专用接口

diff --git a/files/zh-cn/web/api/htmliframeelement/index.html b/files/zh-cn/web/api/htmliframeelement/index.html index b88291b452..cc60d292c1 100644 --- a/files/zh-cn/web/api/htmliframeelement/index.html +++ b/files/zh-cn/web/api/htmliframeelement/index.html @@ -52,7 +52,7 @@ translation_of: Web/API/HTMLIFrameElement

浏览器 API 方法

-

为支持浏览器{{HTMLElement("iframe")}}的需求,HTMLIFrameElement已经扩展了一些新的方法来让{{HTMLElement("iframe")}}有更多的能力。他们并未成为规范(参见 {{anch("Browser compatibility")}})。

+

为支持浏览器{{HTMLElement("iframe")}}的需求,HTMLIFrameElement已经扩展了一些新的方法来让{{HTMLElement("iframe")}}有更多的能力。他们并未成为规范(参见 Browser compatibility)。

导航方法

diff --git a/files/zh-cn/web/api/htmlmediaelement/play/index.html b/files/zh-cn/web/api/htmlmediaelement/play/index.html index e492d4581e..4fd427fda3 100644 --- a/files/zh-cn/web/api/htmlmediaelement/play/index.html +++ b/files/zh-cn/web/api/htmlmediaelement/play/index.html @@ -50,7 +50,7 @@ translation_of: Web/API/HTMLMediaElement/play

虽然“autoplay”这个词常常被用于描述当媒体加载完成时立即开始播放,浏览器的自动播放策略其实也应用于脚本驱动的媒体播放,包括调用 play()

-

如果 {{Glossary("user agent")}} 被设置为不允许自动或脚本驱动的媒体播放,调用 play() 会导致返回的 promise 被立即以 NotAllowedError 拒绝。网页应该对这种情况做好准备。举个例子,一个网页不应该假定播放已经自动开始而直接展示相应的用户界面,而应该在返回的 promise 被解决或拒绝后再更新用户界面。更多信息参见 {{anch("示例", "示例")}}。

+

如果 {{Glossary("user agent")}} 被设置为不允许自动或脚本驱动的媒体播放,调用 play() 会导致返回的 promise 被立即以 NotAllowedError 拒绝。网页应该对这种情况做好准备。举个例子,一个网页不应该假定播放已经自动开始而直接展示相应的用户界面,而应该在返回的 promise 被解决或拒绝后再更新用户界面。更多信息参见 示例

注意:play() 方法可能会让用户被询问是否给予播放媒体的权限,这可能会使返回的 promise 延迟解决。你应该确保你的代码不需要即时响应。

diff --git a/files/zh-cn/web/api/idbcursor/direction/index.html b/files/zh-cn/web/api/idbcursor/direction/index.html index 00ca2da3fa..54de6a616d 100644 --- a/files/zh-cn/web/api/idbcursor/direction/index.html +++ b/files/zh-cn/web/api/idbcursor/direction/index.html @@ -5,7 +5,7 @@ translation_of: Web/API/IDBCursor/direction ---

{{ APIRef("IDBCursor") }}

-

 {{domxref("IDBCursor")}} 的方向属性是一个 {{domxref("DOMString")}} ,表示游标遍历的方向, (比如可以通过 {{domxref("IDBObjectStore.openCursor")}} 设置). 查看下文中 {{anch("Values")}} 章节获取可取值.

+

 {{domxref("IDBCursor")}} 的方向属性是一个 {{domxref("DOMString")}} ,表示游标遍历的方向, (比如可以通过 {{domxref("IDBObjectStore.openCursor")}} 设置). 查看下文中取值章节获取可取值.

语法

cursor.direction;
diff --git a/files/zh-cn/web/api/indexeddb_api/browser_storage_limits_and_eviction_criteria/index.html b/files/zh-cn/web/api/indexeddb_api/browser_storage_limits_and_eviction_criteria/index.html index 7934d15e70..380cb097d5 100644 --- a/files/zh-cn/web/api/indexeddb_api/browser_storage_limits_and_eviction_criteria/index.html +++ b/files/zh-cn/web/api/indexeddb_api/browser_storage_limits_and_eviction_criteria/index.html @@ -50,14 +50,14 @@ translation_of: Web/API/IndexedDB_API/Browser_storage_limits_and_eviction_criter

在Firefox中,当使用持久存储时,会向用户提供一个UI弹出窗口,提醒他们这些数据将持续存在,并询问他们是否对此感到满意。临时数据存储不会引发任何用户提示。

默认的是临时存储;开发人员可以选择使用{{domxref("StorageManager.persist()")}}方法使用持久储存。

-

数据存储在哪里?

+

数据存储在哪里?

每种存储类型代表一个单独的存储库。这是用户Firefox配置文件下目录的实际映射(其他浏览器可能略有不同):

diff --git a/files/zh-cn/web/api/indexeddb_api/using_indexeddb/index.html b/files/zh-cn/web/api/indexeddb_api/using_indexeddb/index.html index 7c7f278f51..0802eed354 100644 --- a/files/zh-cn/web/api/indexeddb_api/using_indexeddb/index.html +++ b/files/zh-cn/web/api/indexeddb_api/using_indexeddb/index.html @@ -119,7 +119,7 @@ request.onsuccess = function(event) {

创建和更新数据库版本号

-

当你创建一个新的数据库或者增加已存在的数据库的版本号(当{{ anch("打开数据库")}}时,指定一个比之前更大的版本号), onupgradeneeded 事件会被触发,IDBVersionChangeEvent 对象会作为参数传递给绑定在 request.result(例如例子中的 db)上的 onversionchange 事件处理函数,你应该在此创建该版本需要的对象仓库(object store)。

+

当你创建一个新的数据库或者增加已存在的数据库的版本号(当打开数据库时,指定一个比之前更大的版本号), onupgradeneeded 事件会被触发,IDBVersionChangeEvent 对象会作为参数传递给绑定在 request.result(例如例子中的 db)上的 onversionchange 事件处理函数,你应该在此创建该版本需要的对象仓库(object store)。

要更新数据库的 schema,也就是创建或者删除对象存储空间,需要实现 onupgradeneeded 处理程序,这个处理程序将会作为一个允许你处理对象存储空间的 versionchange 事务的一部分被调用。

@@ -321,7 +321,7 @@ customerData.forEach(function(customer) { }; }); -

调用 call() 方法产生的请求的 result 是被添加的数据的键。所以在该例中,它应该全等于被添加对象的 ssn 属性,因为对象仓库使用 ssn 属性作为键路径(key path)。注意,add() 方法的调用时,对象仓库中不能存在相同键的对象。如果你想修改一个已存在的条目,或者你不关心该数据是否已存在,你可以使用 put() 方法,就像下面 {{ anch("Updating an entry in the database") }} 模块所展示的。

+

调用 call() 方法产生的请求的 result 是被添加的数据的键。所以在该例中,它应该全等于被添加对象的 ssn 属性,因为对象仓库使用 ssn 属性作为键路径(key path)。注意,add() 方法的调用时,对象仓库中不能存在相同键的对象。如果你想修改一个已存在的条目,或者你不关心该数据是否已存在,你可以使用 put() 方法,就像下面 更新数据库中的记录 模块所展示的。

从数据库中删除数据

diff --git a/files/zh-cn/web/api/intersection_observer_api/timing_element_visibility/index.html b/files/zh-cn/web/api/intersection_observer_api/timing_element_visibility/index.html index 37c36f7c23..643a5cc3f6 100644 --- a/files/zh-cn/web/api/intersection_observer_api/timing_element_visibility/index.html +++ b/files/zh-cn/web/api/intersection_observer_api/timing_element_visibility/index.html @@ -302,7 +302,7 @@ function startup() {

Handling periodic actions

-

Our interval handler, handleRefreshInterval(), is called about once per second courtesy of the call to {{domxref("WindowOrGlobalScope.setInterval", "setInterval")}} made in the startup() function {{anch("Setting up", "described above")}}. Its main job is to update the timers every second and schedule a redraw to update the timers we'll be drawing within each ad.

+

Our interval handler, handleRefreshInterval(), is called about once per second courtesy of the call to {{domxref("WindowOrGlobalScope.setInterval", "setInterval")}} made in the startup() function described above. Its main job is to update the timers every second and schedule a redraw to update the timers we'll be drawing within each ad.

function handleRefreshInterval() {
   let redrawList = [];
@@ -333,7 +333,7 @@ function startup() {
 
 

Updating an ad's visibility timer

-

Previously (see {{anch("Handling document visibility changes")}} and {{anch("Handling periodic actions")}}), we've seen that when we need to update an ad's "total visible time" counter, we call a function named updateAdTimer() to do so. This function takes as an input an ad's {{domxref("HTMLDivElement")}} object. Here it is:

+

Previously (see Handling document visibility changes and Handling periodic actions), we've seen that when we need to update an ad's "total visible time" counter, we call a function named updateAdTimer() to do so. This function takes as an input an ad's {{domxref("HTMLDivElement")}} object. Here it is:

function updateAdTimer(adBox) {
   let lastStarted = adBox.dataset.lastViewStarted;
@@ -382,7 +382,7 @@ function startup() {
 
 

Building the page contents

-

The buildContents() function is called by the {{anch("Setting up", "startup code")}} to select and insert into the document the articles and ads to be presented:

+

The buildContents() function is called by the startup code to select and insert into the document the articles and ads to be presented:

let loremIpsum = "<p>Lorem ipsum dolor sit amet, consectetur adipiscing" +
   " elit. Cras at sem diam. Vestibulum venenatis massa in tincidunt" +
@@ -525,11 +525,11 @@ function buildContents() {
 
 

Finally, we set the ID of the <div> which will show the timer we'll present in the ad to show how long it's been visible, giving it the class "timer". The initial text is set to "0:00", to represent the starting time of 0 minutes and 0 seconds, and it's appended to the ad.

-

If we're not replacing an existing ad, we need to append the element to the content area of the page using {{domxref("Node.appendChild", "Document.appendChild()")}}. If we're replacing an ad, it's already there, with its contents replaced with the new ad's. Then we call the {{domxref("IntersectionObserver.observe", "observe()")}} method on our Intersection Observer, adObserver, to start watching the ad for changes to its intersection with the viewport. From now on, any time the ad becomes 100% obscured or even a single pixel becomes visible, or the ad passes through 75% visible in one way or another, the {{anch("Handling intersection changes", "observer's callback")}} is executed.

+

If we're not replacing an existing ad, we need to append the element to the content area of the page using {{domxref("Node.appendChild", "Document.appendChild()")}}. If we're replacing an ad, it's already there, with its contents replaced with the new ad's. Then we call the {{domxref("IntersectionObserver.observe", "observe()")}} method on our Intersection Observer, adObserver, to start watching the ad for changes to its intersection with the viewport. From now on, any time the ad becomes 100% obscured or even a single pixel becomes visible, or the ad passes through 75% visible in one way or another, the observer's callback is executed.

Replacing an existing ad

-

Our {{anch("Handling intersection changes", "observer's callback")}} keeps an eye out for ads which become 100% obscured and have a total visible time of at least one minute. When that happens, the replaceAd() function is called with that ad's element as an input, so that the old ad can be replaced with a new one.

+

Our observer's callback keeps an eye out for ads which become 100% obscured and have a total visible time of at least one minute. When that happens, the replaceAd() function is called with that ad's element as an input, so that the old ad can be replaced with a new one.

function replaceAd(adBox) {
   let visibleTime;
@@ -544,7 +544,7 @@ function buildContents() {
 
 

replaceAd() begins by calling updateAdTimer() on the existing ad, to ensure that its timer is up-to-date. This ensures that when we read its totalViewTime, we see the exact final value for how long the ad was visible to the user. We then report that data; in this case, by logging it to console, but in the real world, you'd submit the information to an ad service's API or save it into a database.

-

Then we load a new ad by calling {{anch("Creating an ad", "loadRandomAd()")}}, specifying the ad to be replaced as an input parameter. As we saw previously, loadRandomAd() will replace an existing ad with content and data corresponding to a new ad, if you specify an existing ad's element as an input parameter.

+

Then we load a new ad by calling loadRandomAd(), specifying the ad to be replaced as an input parameter. As we saw previously, loadRandomAd() will replace an existing ad with content and data corresponding to a new ad, if you specify an existing ad's element as an input parameter.

The new ad's element object is returned to the caller in case it's needed.

diff --git a/files/zh-cn/web/api/keyboardevent/index.html b/files/zh-cn/web/api/keyboardevent/index.html index 1439268d80..b2a136a052 100644 --- a/files/zh-cn/web/api/keyboardevent/index.html +++ b/files/zh-cn/web/api/keyboardevent/index.html @@ -108,7 +108,7 @@ translation_of: Web/API/KeyboardEvent
Note: This does not describe the locale of the data being entered. A user may be using one keyboard layout while typing text in a different language.
{{domxref("KeyboardEvent.location")}} {{Readonlyinline}}
-
Returns a {{jsxref("Number")}} representing the location of the key on the keyboard or other input device. A list of the constants identifying the locations is shown above in {{anch("Keyboard locations")}}.
+
Returns a {{jsxref("Number")}} representing the location of the key on the keyboard or other input device. A list of the constants identifying the locations is shown above in Keyboard locations.
{{domxref("KeyboardEvent.metaKey")}} {{Readonlyinline}}
Returns a {{jsxref("Boolean")}} that is true if the Meta key (on Mac keyboards, the ⌘ Command key; on Windows keyboards, the Windows key ()) was active when the key event was generated.
{{domxref("KeyboardEvent.repeat")}} {{Readonlyinline}}
diff --git a/files/zh-cn/web/api/keyboardevent/key/key_values/index.html b/files/zh-cn/web/api/keyboardevent/key/key_values/index.html index 5923333c5d..48c2359234 100644 --- a/files/zh-cn/web/api/keyboardevent/key/key_values/index.html +++ b/files/zh-cn/web/api/keyboardevent/key/key_values/index.html @@ -895,7 +895,7 @@ translation_of: Web/API/KeyboardEvent/key/Key_Values A dead "combining" key; that is, a key which is used in tandem with other keys to generate accented and other modified characters. If pressed by itself, it doesn't generate a character. If you wish to identify which specific dead key was pressed (in cases where more than one exists), you can do so by examining the {{domxref("KeyboardEvent")}}'s associated {{event("compositionupdate")}} event's {{domxref("CompositionEvent.data", "data")}} property. - See {{anch("Dead keycodes for Linux")}} below + See Dead keycodes for Linux below @@ -2393,7 +2393,7 @@ translation_of: Web/API/KeyboardEvent/key/Key_Values
-

Remote controls typically include keys whose values are already defined elsewhere, such as under {{anch("Multimedia keys")}} or {{anch("Audio control keys")}}. Those keys' values will match what's documented in those tables.

+

Remote controls typically include keys whose values are already defined elsewhere, such as under Multimedia keys or Audio control keys. Those keys' values will match what's documented in those tables.

diff --git a/files/zh-cn/web/api/mediadevices/getdisplaymedia/index.html b/files/zh-cn/web/api/mediadevices/getdisplaymedia/index.html index c9f62fd8f4..ec05503d91 100644 --- a/files/zh-cn/web/api/mediadevices/getdisplaymedia/index.html +++ b/files/zh-cn/web/api/mediadevices/getdisplaymedia/index.html @@ -41,7 +41,7 @@ translation_of: Web/API/MediaDevices/getDisplayMedia

一个被解析为 {{domxref("MediaStream")}} 的 {{jsxref("Promise")}},其中包含一个视频轨道。视频轨道的内容来自用户选择的屏幕区域以及一个可选的音频轨道。

-

Note: 浏览器对音频的支持程度各不相同,既取决于是否支持,也取决于音频源. 点击 {{anch("Browser compatibility", "compatibility table")}} 来查看各个浏览器的支持性.

+

Note: 浏览器对音频的支持程度各不相同,既取决于是否支持,也取决于音频源. 点击 浏览器兼容性 来查看各个浏览器的支持性.

异常

diff --git a/files/zh-cn/web/api/mutationobserver/mutationobserver/index.html b/files/zh-cn/web/api/mutationobserver/mutationobserver/index.html index 9846fe7648..956d9d24bd 100644 --- a/files/zh-cn/web/api/mutationobserver/mutationobserver/index.html +++ b/files/zh-cn/web/api/mutationobserver/mutationobserver/index.html @@ -22,7 +22,7 @@ translation_of: Web/API/MutationObserver/MutationObserver
callback
-
一个回调函数,每当被指定的节点或子树以及配置项有Dom变动时会被调用。回调函数拥有两个参数:一个是描述所有被触发改动的 {{domxref("MutationRecord")}} 对象数组,另一个是调用该函数的MutationObserver 对象。参见下方的{{anch("Example", "示例")}}了解更多细节
+
一个回调函数,每当被指定的节点或子树以及配置项有Dom变动时会被调用。回调函数拥有两个参数:一个是描述所有被触发改动的 {{domxref("MutationRecord")}} 对象数组,另一个是调用该函数的MutationObserver 对象。参见下方的示例了解更多细节

返回值

diff --git a/files/zh-cn/web/api/navigator/registerprotocolhandler/index.html b/files/zh-cn/web/api/navigator/registerprotocolhandler/index.html index fd1de837c9..bbace1dc5a 100644 --- a/files/zh-cn/web/api/navigator/registerprotocolhandler/index.html +++ b/files/zh-cn/web/api/navigator/registerprotocolhandler/index.html @@ -67,7 +67,7 @@ translation_of: Web/API/Navigator/registerProtocolHandler

允许的协议标记

-

出于安全考虑,registerProtocolHandler() 严格限制了允许注册的协议标记。以 web+ 作为前缀的方式可以注册一个自定义的标记协议,至少要有5个字符的长度(包括 web+ 前缀),而且只能使用小写的ASCII字母作为名称。例如 web+burger ,如下面的{{anch("示例")}}所示。

+

出于安全考虑,registerProtocolHandler() 严格限制了允许注册的协议标记。以 web+ 作为前缀的方式可以注册一个自定义的标记协议,至少要有5个字符的长度(包括 web+ 前缀),而且只能使用小写的ASCII字母作为名称。例如 web+burger ,如下面的示例所示。

除此之外,还可以使用下文所列的白名单中的协议标记:

diff --git a/files/zh-cn/web/api/node/firstchild/index.html b/files/zh-cn/web/api/node/firstchild/index.html index 9c9808c4b5..c4b7410aea 100644 --- a/files/zh-cn/web/api/node/firstchild/index.html +++ b/files/zh-cn/web/api/node/firstchild/index.html @@ -12,9 +12,9 @@ translation_of: Web/API/Node/firstChild ---
{{ ApiRef("DOM") }}
-

Node.firstChild 只读属性返回树中节点的第一个子节点,如果节点是无子节点,则返回 null。

+

Node.firstChild 只读属性返回树中节点的第一个子节点,如果节点是无子节点,则返回 null。

-

语法

+

语法

var childNode = node.firstChild;
 
@@ -23,11 +23,11 @@ translation_of: Web/API/Node/firstChild

如果有一个子节点, childNode 是节点的第一个子节点的引用,否则为null。

-

例子

+

示例

-

Example 1

+

示例 1

-

这个例子演示了firstChild属性的用法以及空白符节点对该属性的使用可能造成的影响.参见{{ Anch("备注") }}部分了解Gecko DOM中关于处理空白符的更多信息.

+

这个例子演示了firstChild属性的用法以及空白符节点对该属性的使用可能造成的影响.参见备注部分了解Gecko DOM中关于处理空白符的更多信息.

<p id="para-01">
   <span>First span</span>
@@ -53,14 +53,14 @@ translation_of: Web/API/Node/firstChild
 </script>
 
-

Example 2

+

示例 2

假设我们有一个HTML文档,如果该文档有一个DTD(文档类型定义),则下面的语句会弹出[object DocumentType],如果该文档没有一个DTD,则下面的语句会弹出[object HTMLHtmlElement].

alert(document.firstChild);
 
-

备注

+

备注

Gecko内核的浏览器会在源代码中标签内部有空白符的地方插入一个文本结点到文档中.因此,使用诸如 Node.firstChildNode.previousSibling 之类的方法可能会引用到一个空白符文本节点, @@ -69,7 +69,7 @@ translation_of: Web/API/Node/firstChild

详情请参见 DOM 中的空白符W3C DOM 3 FAQ: 为什么一些文本节点是空的.

-

规范

+

规范

DOM Level 1 Core: firstChild

diff --git a/files/zh-cn/web/api/node/nodetype/index.html b/files/zh-cn/web/api/node/nodetype/index.html index f535443f96..e3e23748cd 100644 --- a/files/zh-cn/web/api/node/nodetype/index.html +++ b/files/zh-cn/web/api/node/nodetype/index.html @@ -24,7 +24,7 @@ translation_of: Web/API/Node/nodeType
var type = node.nodeType;
 
-

返回一个整数,其代表的是节点类型。其所有可能的值请参考 {{anch("节点类型常量")}}.

+

返回一个整数,其代表的是节点类型。其所有可能的值请参考 节点类型常量.

常量

diff --git a/files/zh-cn/web/api/notifications_api/using_the_notifications_api/index.html b/files/zh-cn/web/api/notifications_api/using_the_notifications_api/index.html index 49d914d0c5..ed97432158 100644 --- a/files/zh-cn/web/api/notifications_api/using_the_notifications_api/index.html +++ b/files/zh-cn/web/api/notifications_api/using_the_notifications_api/index.html @@ -17,9 +17,9 @@ original_slug: Web/API/notification/Using_Web_Notifications

通常,系统通知是指操作系统的标准通知机制,例如思考典型的桌面系统或移动设备如何发布通知。

-

                             

+

-

                        

+

系统通知系统当然会因平台和浏览器而异,但无需担心,通知API被编写为通用的,足以与大多数系统通知系统兼容。

@@ -43,7 +43,7 @@ original_slug: Web/API/notification/Using_Web_Notifications
default
-
用户还未被询问是否授权,所以通知不会被显示。参看 {{anch("Getting permission")}} 以了解如何请求显示通知的权限。
+
用户还未被询问是否授权,所以通知不会被显示。参看 获得权限 以了解如何请求显示通知的权限。
granted
表示之前已经询问过用户,并且用户已经授予了显示通知的权限。
denied
diff --git a/files/zh-cn/web/api/oscillatornode/index.html b/files/zh-cn/web/api/oscillatornode/index.html index 69275dff46..aacf53ca9b 100644 --- a/files/zh-cn/web/api/oscillatornode/index.html +++ b/files/zh-cn/web/api/oscillatornode/index.html @@ -38,7 +38,7 @@ translation_of: Web/API/OscillatorNode
{{domxref("OscillatorNode.OscillatorNode", "OscillatorNode()")}}
-
创建一个OscillatorNode对象的示例, 为node{{anch("properties")}}提供可选的一个定义默认值的对象.  如果默认值可接受,你可以简单地调用{{domxref("AudioContext.createOscillator()")}}工厂方法.
+
创建一个OscillatorNode对象的示例, 为node属性提供可选的一个定义默认值的对象.  如果默认值可接受,你可以简单地调用{{domxref("AudioContext.createOscillator()")}}工厂方法.

属性

diff --git a/files/zh-cn/web/api/payment_request_api/concepts/index.html b/files/zh-cn/web/api/payment_request_api/concepts/index.html index 30e58235f5..d2addc6acd 100644 --- a/files/zh-cn/web/api/payment_request_api/concepts/index.html +++ b/files/zh-cn/web/api/payment_request_api/concepts/index.html @@ -70,7 +70,7 @@ original_slug: Web/API/支付_请求_接口/Concepts
  1. 确保交易正确进行。 交易正确进行的条件取决于不同的支付类型和用户的支付请求;例如,如果用户选择了信用卡支付,而收款方并不支持这种方式,交易就无法正确进行。
  2. -
  3. 响应用户代理发起的对商家进行认证的请求(在处理机支持商家认证的前提下)。 详细说明请参考{{anch("Merchant validation")}}。
  4. +
  5. 响应用户代理发起的对商家进行认证的请求(在处理机支持商家认证的前提下)。 详细说明请参考商家认证
  6. 验证用户提交的信息有资格发起一次有效交易。这一步骤会创建并返回一个基于具体支付方式的对象,此对象包含处理交易所需要的信息。
diff --git a/files/zh-cn/web/api/performance_timeline/index.html b/files/zh-cn/web/api/performance_timeline/index.html index 7f7839fbe7..280d3c949d 100644 --- a/files/zh-cn/web/api/performance_timeline/index.html +++ b/files/zh-cn/web/api/performance_timeline/index.html @@ -5,7 +5,7 @@ translation_of: Web/API/Performance_Timeline ---
{{DefaultAPISidebar("Performance Timeline API")}}
-

The Performance Timeline API defines extensions to the {{domxref("Performance")}} interface to support client-side latency measurements within applications. The extensions provide interfaces to retrieve {{domxref("PerformanceEntry","performance entry metrics", '', 'true')}} based on specific filter criteria. The standard also includes interfaces that allow an application to define {{anch("Performance_Observers","performance observer", '', 'true')}} callbacks that are notified when specific performance events are added to the browser's performance timeline.

+

The Performance Timeline API defines extensions to the {{domxref("Performance")}} interface to support client-side latency measurements within applications. The extensions provide interfaces to retrieve {{domxref("PerformanceEntry","performance entry metrics", '', 'true')}} based on specific filter criteria. The standard also includes interfaces that allow an application to define performance observer callbacks that are notified when specific performance events are added to the browser's performance timeline.

This document provides an overview of the standard's interfaces. For more details about the interfaces, see the reference pages and Using Performance Timeline.

diff --git a/files/zh-cn/web/api/resource_timing_api/index.html b/files/zh-cn/web/api/resource_timing_api/index.html index 238135639e..6b02dc7532 100644 --- a/files/zh-cn/web/api/resource_timing_api/index.html +++ b/files/zh-cn/web/api/resource_timing_api/index.html @@ -5,17 +5,13 @@ translation_of: Web/API/Resource_Timing_API ---
{{DefaultAPISidebar("Resource Timing API")}}
-
 
- -
通过Resource Timing API可以获取和分析应用资源加载的详细网络计时数据, 应用程序可以
+
通过Resource Timing API可以获取和分析应用资源加载的详细网络计时数据, 应用程序可以
使用时间度量标准来确定加载特定资源所需要的时间, 比如 {{domxref("XMLHttpRequest")}}, {{SVGElement("SVG","SVG element")}}, 图片, 或者脚本.
-
 
- -

Resource Timing API为网络事件(如重定向的开始和结束事件, DNS查找的开始和结束事件, 请求开始, 响应开始和结束时间等)生成有高分辨率时间戳( {{domxref("DOMHighResTimeStamp","high-resolution timestamps", "", 1)}} )的资源加载时间线, 并提供了资源大小和资源类型.

+

Resource Timing API为网络事件(如重定向的开始和结束事件, DNS查找的开始和结束事件, 请求开始, 响应开始和结束时间等)生成有高分辨率时间戳( {{domxref("DOMHighResTimeStamp","high-resolution timestamps", "", 1)}} )的资源加载时间线, 并提供了资源大小和资源类型.

-

本文档是Resource Timing API的概述. 更多详细信息, 请查阅每个接口的参考说明, Using Resource Timing 和 {{anch("See_Also","附录")}} 的参考链接. 有关资源时序处理模型的图示,请参阅 resource timing phases .

+

本文档是Resource Timing API的概述. 更多详细信息, 请查阅每个接口的参考说明, Using Resource Timing参见 的参考链接. 有关资源时序处理模型的图示,请参阅 resource timing phases .

PerformanceResourceTiming 接口只统计{{domxref("PerformanceEntry","performance entries", "", 1)}} 中 {{domxref("PerformanceEntry.entryType","entryType")}} 为"resource"类型的 {{domxref("PerformanceEntry")}}

@@ -65,7 +61,7 @@ translation_of: Web/API/Resource_Timing_API

To test your browser's support for these interfaces, run the perf-api-support application.

-

附录

+

参见

-

备注:需要注意的是,IE9 及更早的 IE 浏览器不支持向回调函数传递额外参数(第一种语法)。如果你想要在IE中达到同样的功能,你必须使用一种兼容代码 (查看  {{anch("兼容旧环境(polyfill)")}} 一段).

+

备注:需要注意的是,IE9 及更早的 IE 浏览器不支持向回调函数传递额外参数(第一种语法)。如果你想要在IE中达到同样的功能,你必须使用一种兼容代码 (查看  兼容旧环境(polyfill) 一段).

返回值

diff --git a/files/zh-cn/web/api/web_audio_api/index.html b/files/zh-cn/web/api/web_audio_api/index.html index f7178d006c..75ce74566d 100644 --- a/files/zh-cn/web/api/web_audio_api/index.html +++ b/files/zh-cn/web/api/web_audio_api/index.html @@ -144,7 +144,7 @@ translation_of: Web/API/Web_Audio_API

可以编写JavaScript代码来处理音频数据。当然,这需要用到下面的接口和事件。

-

注意:这些功能在Web Audio API的2014年8月9日版本中已经标记为不推荐的,这些功能很快会被{{ anch("Audio_Workers") }}代替。

+

注意:这些功能在Web Audio API的2014年8月9日版本中已经标记为不推荐的,这些功能很快会被Audio_Workers代替。

diff --git a/files/zh-cn/web/api/web_workers_api/using_web_workers/index.html b/files/zh-cn/web/api/web_workers_api/using_web_workers/index.html index 107266e073..2704cf845d 100644 --- a/files/zh-cn/web/api/web_workers_api/using_web_workers/index.html +++ b/files/zh-cn/web/api/web_workers_api/using_web_workers/index.html @@ -92,7 +92,7 @@ second.onchange = function() {
-

注意: 当一个消息在主线程和worker之间传递时,它被复制或者转移了,而不是共享。请参阅{{anch("Transferring data to and from workers further details", "Transferring data to and from workers: further details")}} 获取更详尽的解释。

+

注意: 当一个消息在主线程和worker之间传递时,它被复制或者转移了,而不是共享。请参阅worker中数据的接收与发送:详细介绍 获取更详尽的解释。

终止worker

diff --git a/files/zh-cn/web/api/webgl_api/data/index.html b/files/zh-cn/web/api/webgl_api/data/index.html index ded07d6e36..a8570b2e68 100644 --- a/files/zh-cn/web/api/webgl_api/data/index.html +++ b/files/zh-cn/web/api/webgl_api/data/index.html @@ -27,7 +27,7 @@ translation_of: Web/API/WebGL_API/Data

GLSL 变量

-

GLSL中有三种类型的“变量”或者说数据存储类型。每一种类型都有特定的目标和使用方法:: {{anch("Attributes", "attributes")}}{{anch("Varyings", "varyings")}}{{anch("Uniforms", "uniforms")}}.

+

GLSL中有三种类型的“变量”或者说数据存储类型。每一种类型都有特定的目标和使用方法:: attributesvaryingsuniforms.

Attributes

diff --git a/files/zh-cn/web/api/webgl_api/index.html b/files/zh-cn/web/api/webgl_api/index.html index c890e01f68..492c7731b3 100644 --- a/files/zh-cn/web/api/webgl_api/index.html +++ b/files/zh-cn/web/api/webgl_api/index.html @@ -19,7 +19,7 @@ translation_of: Web/API/WebGL_API

目前支持 WebGL 的浏览器有:Firefox 4+, Google Chrome 9+, Opera 12+, Safari 5.1+, Internet Explorer 11+和Microsoft Edge build 10240+;然而, WebGL一些特性也需要用户的硬件设备支持。

-

{{anch("WebGL 2")}} API引入了对大部分的OpenGL ES 3.0功能集的支持; 它是通过{{domxref("WebGL2RenderingContext")}}界面提供的

+

WebGL 2 API引入了对大部分的OpenGL ES 3.0功能集的支持; 它是通过{{domxref("WebGL2RenderingContext")}}界面提供的

 {{HTMLElement("canvas")}} 元素也被 Canvas API 用于在网页上进行2D图形处理。

diff --git a/files/zh-cn/web/api/webgl_api/webgl_model_view_projection/index.html b/files/zh-cn/web/api/webgl_api/webgl_model_view_projection/index.html index 20804af827..a4d70b7095 100644 --- a/files/zh-cn/web/api/webgl_api/webgl_model_view_projection/index.html +++ b/files/zh-cn/web/api/webgl_api/webgl_model_view_projection/index.html @@ -421,7 +421,7 @@ gl_Position = vec4(transformedPosition.xyz, w);

Filling the W component and creating some projection.

-

看到那个深蓝色的小三角形吗?那是添加到对象上的另一个面,因为形状的旋转导致了该角延伸到裁剪空间之外,从而导致该角被裁剪掉。有关如何使用更复杂的矩阵来帮助控制和防止裁剪的介绍,请参照下面的 {{anch("Perspective matrix")}}。

+

看到那个深蓝色的小三角形吗?那是添加到对象上的另一个面,因为形状的旋转导致了该角延伸到裁剪空间之外,从而导致该角被裁剪掉。有关如何使用更复杂的矩阵来帮助控制和防止裁剪的介绍,请参照下面的 Perspective matrix

练习

@@ -506,7 +506,7 @@ var w = (2 * 0) + (3 * 0) + (4 * scaleFactor) + (1 * scaleFactor) }; -

尽管结果相同,但重要的步骤还是在顶点着色器中。与其直接修改顶点,不如将其乘以一个附加的 {{anch("Projection matrix", "projection matrix")}},该矩阵将3D点投影到2D绘图表面上:

+

尽管结果相同,但重要的步骤还是在顶点着色器中。与其直接修改顶点,不如将其乘以一个附加的 projection matrix,该矩阵将3D点投影到2D绘图表面上:

// 确保以相反的顺序读取转换矩阵
 gl_Position = projection * model * vec4(position, 1.0);
diff --git a/files/zh-cn/web/api/webrtc_api/signaling_and_video_calling/index.html b/files/zh-cn/web/api/webrtc_api/signaling_and_video_calling/index.html
index f8f8ab33aa..50a7f2de6e 100644
--- a/files/zh-cn/web/api/webrtc_api/signaling_and_video_calling/index.html
+++ b/files/zh-cn/web/api/webrtc_api/signaling_and_video_calling/index.html
@@ -341,27 +341,27 @@ function invite(evt) {
 
 
-

当需要你通过信令服务器将一个ICE候选发送给另一个对等端时,本地ICE层将会调用你的 {{event("icecandidate")}} 事件处理程序。有关更多信息,请参阅{{anch("Sending ICE candidates")}} 以查看此示例的代码。

+

当需要你通过信令服务器将一个ICE候选发送给另一个对等端时,本地ICE层将会调用你的 {{event("icecandidate")}} 事件处理程序。有关更多信息,请参阅交换 ICE 候选 以查看此示例的代码。

{{domxref("RTCPeerConnection.ontrack")}}
-
当向连接中添加磁道时,{{event("track")}} 事件的此处理程序由本地WebRTC层调用。例如,可以将传入媒体连接到元素以显示它。详见 {{anch("Receiving new streams")}} 。
+
当向连接中添加磁道时,{{event("track")}} 事件的此处理程序由本地WebRTC层调用。例如,可以将传入媒体连接到元素以显示它。详见接收新的流数据
{{domxref("RTCPeerConnection.onnegotiationneeded")}}
-
每当WebRTC基础结构需要你重新启动会话协商过程时,都会调用此函数。它的工作是创建和发送一个请求,给被叫方,要求它与我们联系。参见{{anch("Starting negotiation")}} 了解我们如何处理这一问题。
+
每当WebRTC基础结构需要你重新启动会话协商过程时,都会调用此函数。它的工作是创建和发送一个请求,给被叫方,要求它与我们联系。参见开始协商了解我们如何处理这一问题。
{{domxref("RTCPeerConnection.onremovetrack")}}
-
调用与 ontrack相对应的对象来处理 {{event("removetrack")}} 事件;当远程对等端从正在发送的媒体中删除磁道时,它将发送到RTCPeerConnection 。参见 {{anch("Handling the removal of tracks")}} 。
+
调用与 ontrack相对应的对象来处理 {{event("removetrack")}} 事件;当远程对等端从正在发送的媒体中删除磁道时,它将发送到RTCPeerConnection。参见 处理流的移除
{{domxref("RTCPeerConnection.oniceconnectionstatechange")}}
-
ICE层发送{{event("iceconnectionstatechange")}} 事件,让你了解ICE连接状态的更改。这可以帮助你了解连接何时失败或丢失。我们将在下面的{{anch("ICE connection state")}} 中查看此示例的代码。
+
ICE层发送{{event("iceconnectionstatechange")}} 事件,让你了解ICE连接状态的更改。这可以帮助你了解连接何时失败或丢失。我们将在下面的ICE 连接状态中查看此示例的代码。
{{domxref("RTCPeerConnection.onicegatheringstatechange")}}
-
当ICE代理收集候选对象的过程从一个状态切换到另一个状态(例如开始收集候选对象或完成协商)时,ICE层将向你发送事件(“ICegulatingStateChange”)事件。见下文 {{anch("ICE gathering state")}}。
+
当ICE代理收集候选对象的过程从一个状态切换到另一个状态(例如开始收集候选对象或完成协商)时,ICE层将向你发送事件(“ICegulatingStateChange”)事件。见下文 ICE 收集状态
{{domxref("RTCPeerConnection.onsignalingstatechange")}}
-

当信令进程的状态更改时(或如果到信令服务器的连接更改时),WebRTC架构将向你发送 {{event("signalingstatechange")}} 消息。参见{{anch("Signaling state")}} 查看我们的代码。

+

当信令进程的状态更改时(或如果到信令服务器的连接更改时),WebRTC架构将向你发送 {{event("signalingstatechange")}} 消息。参见ICE 信令状态查看我们的代码。

开始协商

-

一旦调用者创建了其 {{domxref("RTCPeerConnection")}} ,创建了媒体流,并将其磁道添加到连接中,如 {{anch("Starting a call")}} 所示,浏览器将向{{domxref("RTCPeerConnection")}} 传递一个 {{event("negotiationneeded")}} 事件,以指示它已准备好开始与其他对等方协商。以下是我们处理 {{event("negotiationneeded")}} 事件的代码:

+

一旦调用者创建了其 {{domxref("RTCPeerConnection")}} ,创建了媒体流,并将其磁道添加到连接中,如 开始通话的交互 所示,浏览器将向 {{domxref("RTCPeerConnection")}} 传递一个 {{event("negotiationneeded")}} 事件,以指示它已准备好开始与其他对等方协商。以下是我们处理 {{event("negotiationneeded")}} 事件的代码:

function handleNegotiationNeededEvent() {
   myPeerConnection.createOffer().then(function(offer) {
@@ -447,13 +447,13 @@ function invite(evt) {
   .catch(handleGetUserMediaError);
 }
-

此代码与我们在 {{anch("Starting a call")}} 中在 invite() 函数中所做的非常相似。它首先使用 createPeerConnection() 函数创建和配置{{domxref("RTCPeerConnection")}} 。然后,它从收到的 "video-offer" 消息中获取SDP请求,并使用它创建一个表示调用方会话描述的新 {{domxref("RTCSessionDescription")}} 对象。

+

此代码与我们在开始通话的交互中在 invite() 函数中所做的非常相似。它首先使用 createPeerConnection() 函数创建和配置{{domxref("RTCPeerConnection")}} 。然后,它从收到的 "video-offer" 消息中获取SDP请求,并使用它创建一个表示调用方会话描述的新 {{domxref("RTCSessionDescription")}} 对象。

然后将该会话描述传递到 {{domxref("RTCPeerConnection.setRemoteDescription", "myPeerConnection.setRemoteDescription()")}}。这将把接收到的请求建立为连接的远程(调用方)端的描述。如果成功,promise成功处理程序(在then()子句中)将使用 {{domxref("MediaDevices.getUserMedia", "getUserMedia()")}},将磁道添加到连接,以此类推,如前面在 invite()中看到的那样。

一旦使用 {{domxref("RTCPeerConnection.createAnswer", "myPeerConnection.createAnswer()")}} 创建了应答,通过调用{{domxref("RTCPeerConnection.setLocalDescription", "myPeerConnection.setLocalDescription()")}} 连接本地端的描述被设置为应答的SDP,则通过信令服务器将应答发送给调用者,让他们知道应答是什么。

-

捕捉到的任何错误都会被传递给 handleGetUserMediaError(),详见 {{anch("Handling getUserMedia() errors")}} 。

+

捕捉到的任何错误都会被传递给 handleGetUserMediaError(),详见 处理 getUserMedia() 错误

注意:与调用者的情况一样,一旦 setLocalDescription()实现处理程序运行完毕,浏览器将开始触发被调用者必须处理的{{event("icecandidate")}} 事件,每个需要传输到远程对等方的候选事件对应一个事件。

@@ -475,7 +475,7 @@ function invite(evt) { } }
-

这将构建一个包含候选对象的对象,然后使用前面在 {{anch("Sending messages to the signaling server")}} 中描述的sendToServer() 函数将其发送给另一个对等方。消息属性为:

+

这将构建一个包含候选对象的对象,然后使用前面在 向信令服务器发送信息 中描述的sendToServer() 函数将其发送给另一个对等方。消息属性为:

type

@@ -546,9 +546,9 @@ function invite(evt) { } } -

此代码从"received_video" {{HTMLElement("video")}}元素的{{htmlattrxref("srcObject", "video")}} 属性获取传入视频 {{domxref("MediaStream.getTracks", "getTracks()")}} 方法获取流的磁道数组。

+

此代码从"received_video" {{HTMLElement("video")}}元素的 {{htmlattrxref("srcObject", "video")}} 属性获取传入视频 {{domxref("MediaStream.getTracks", "getTracks()")}} 方法获取流的磁道数组。

-

如果数组的长度为零,意味着流中没有剩余的磁道,则通过调用 closeVideoCall()结束调用。这样就可以将我们的应用程序恢复到可以启动或接收另一个呼叫的状态。请参阅 {{anch("Ending the call")}} 了解 closeVideoCall() 的工作原理。

+

如果数组的长度为零,意味着流中没有剩余的磁道,则通过调用 closeVideoCall()结束调用。这样就可以将我们的应用程序恢复到可以启动或接收另一个呼叫的状态。请参阅 结束通话 了解 closeVideoCall() 的工作原理。

结束通话

diff --git a/files/zh-cn/web/api/websockets_api/writing_websocket_client_applications/index.html b/files/zh-cn/web/api/websockets_api/writing_websocket_client_applications/index.html index c5fefb2336..16ca1dcc5c 100644 --- a/files/zh-cn/web/api/websockets_api/writing_websocket_client_applications/index.html +++ b/files/zh-cn/web/api/websockets_api/writing_websocket_client_applications/index.html @@ -16,9 +16,9 @@ translation_of: Web/API/WebSockets_API/Writing_WebSocket_client_applications

创建 WebSocket 对象

-

为了使用 WebSocket 协议通信,你需要创建一个 WebSocket 对象;这将会自动地尝试建立与服务器的连接。

+

为了使用 WebSocket 协议通信,你需要创建一个 WebSocket 对象;这将会自动地尝试建立与服务器的连接。

-

WebSocket 构造函数接受一个必要参数和一个可选参数:

+

WebSocket 构造函数接受一个必要参数和一个可选参数:

WebSocket WebSocket(
   in DOMString url,
@@ -118,7 +118,7 @@ function sendText() {
 
 

接受与解析 JSON 对象

-

考虑在 {{ anch("Using JSON to transmit objects") }}中提到的聊天应用客户端。客户端会收到各种类型的数据包,比如:

+

考虑在 使用 JSON 发送对象中提到的聊天应用客户端。客户端会收到各种类型的数据包,比如:

  • 登陆握手
  • diff --git a/files/zh-cn/web/api/webvtt_api/index.html b/files/zh-cn/web/api/webvtt_api/index.html index a2e9979dce..9316bee752 100644 --- a/files/zh-cn/web/api/webvtt_api/index.html +++ b/files/zh-cn/web/api/webvtt_api/index.html @@ -231,7 +231,7 @@ Transcrit par Célestes™
    ::cue(#\31) { color: lime; }
     ::cue(#crédit\ de\ transcription) { color: red; }
    -

    Positioning of text tracks is also supported, by including positioning information after the timings in a cue, as seen below (see {{anch("Cue settings")}} for more information):

    +

    Positioning of text tracks is also supported, by including positioning information after the timings in a cue, as seen below (see Cue settings for more information):

    WEBVTT
     
    diff --git a/files/zh-cn/web/api/webxr_device_api/index.html b/files/zh-cn/web/api/webxr_device_api/index.html
    index e6a3bd823c..9e07a8b007 100644
    --- a/files/zh-cn/web/api/webxr_device_api/index.html
    +++ b/files/zh-cn/web/api/webxr_device_api/index.html
    @@ -86,7 +86,7 @@ translation_of: Web/API/WebXR_Device_API
     
    • 在用户事件句柄总或者在用户启动 web 应用中执行的 requestSession() 调用;
    • 文档是可信赖的,其中的内容是可靠的、及时更新的以及有着重点;
    • -
    • 用户有明确的使用沉浸式 VR 模式的意图,后文中 {{anch("User intent")}} 一节将有详细描述。
    • +
    • 用户有明确的使用沉浸式 VR 模式的意图,后文中,用户意图一节将有详细描述。

    如果上述三点均满足, requestSession() 返回的 Promise 将被 resolve,新的 {{domxref("XRSession")}} 对象被传入完成时的处理函数中。如果有不满足的情况,将会根据具体场景抛出异常,比如当没有权限进入沉浸式模式情况下, SecurityError 将被抛出。

    @@ -101,7 +101,7 @@ translation_of: Web/API/WebXR_Device_API
  • 如果 requestSession() 调用的发起既不来自用户事件中,也不是在 Web 应用启动时,那该请求将会被驳回,Promise 放返回 false;
  • 如果发起请求的文档不属于对应的脚本,该请求将被驳回;
  • 如果发起请求的文档不可信任,该请求会被驳回且 Promise 返回 false。一个可信任文档指的是该文档是活跃的、负责任的且有重点的;
  • -
  • 如果设备无法明确用户开启内联模式的意图,该请求将会被驳回。对{{anch("用户意图", "用户的目的")}}的理解可以是隐性或者显性的。
  • +
  • 如果设备无法明确用户开启内联模式的意图,该请求将会被驳回。对用户的目的的理解可以是隐性或者显性的。
diff --git a/files/zh-cn/web/api/window/devicepixelratio/index.html b/files/zh-cn/web/api/window/devicepixelratio/index.html index aba68dcdf8..0947108a83 100644 --- a/files/zh-cn/web/api/window/devicepixelratio/index.html +++ b/files/zh-cn/web/api/window/devicepixelratio/index.html @@ -9,7 +9,7 @@ translation_of: Web/API/Window/devicePixelRatio

当处理标准显示器与HiDPI或Retina显示器之间的差异时,这很有用,后者使用更多的屏幕像素绘制相同的对象,从而获得更清晰的图像。

-

您可以使用{{domxref("Window.matchMedia", "window.matchMedia()")}} 检查devicePixelRatio的值是否发生更改(例如,如果用户将窗口拖动到带有 不同的像素密度)。 请参阅{{anch("Monitoring screen resolution or zoom level changes", "下面的例子")}}.。

+

您可以使用{{domxref("Window.matchMedia", "window.matchMedia()")}} 检查devicePixelRatio的值是否发生更改(例如,如果用户将窗口拖动到带有 不同的像素密度)。 请参阅下面的例子

语法

diff --git a/files/zh-cn/web/api/xmlhttprequest/responsetype/index.html b/files/zh-cn/web/api/xmlhttprequest/responsetype/index.html index 7201946aae..c171e12d92 100644 --- a/files/zh-cn/web/api/xmlhttprequest/responsetype/index.html +++ b/files/zh-cn/web/api/xmlhttprequest/responsetype/index.html @@ -57,7 +57,7 @@ browser-compat: api.XMLHttpRequest.responseType
InvalidAccessError
-
试图更改 XMLHttpRequestresponseType,该值处于同步模式但不在 {{DOMxRef("Worker")}} 中。有关其他详细信息,请参阅下面的 {{anch("Synchronous_XHR_restrictions", "同步 XHR 限制")}}。
+
试图更改 XMLHttpRequestresponseType,该值处于同步模式但不在 {{DOMxRef("Worker")}} 中。有关其他详细信息,请参阅下面的 同步 XHR 限制

使用说明

-- cgit v1.2.3-54-g00ecf