From a02f4b2f60c81e09b318a090e5c9c2d2d641c878 Mon Sep 17 00:00:00 2001 From: t7yang Date: Sat, 17 Jul 2021 16:10:02 +0800 Subject: replace wiki links in zh-CN --- files/zh-cn/web/api/audiocontext/index.html | 2 +- .../web/api/canvas_api/tutorial/transformations/index.html | 2 +- .../web/api/canvasrenderingcontext2d/fillstyle/index.html | 2 +- files/zh-cn/web/api/canvasrenderingcontext2d/index.html | 2 +- .../api/canvasrenderingcontext2d/linedashoffset/index.html | 2 +- files/zh-cn/web/api/css/index.html | 2 +- files/zh-cn/web/api/devicemotionevent/index.html | 2 +- files/zh-cn/web/api/document/onfullscreenchange/index.html | 4 ++-- .../zh-cn/web/api/document/visibilitychange_event/index.html | 2 +- files/zh-cn/web/api/element/classlist/index.html | 2 +- files/zh-cn/web/api/element/mousemove_event/index.html | 2 +- files/zh-cn/web/api/event/cancelable/index.html | 2 +- files/zh-cn/web/api/eventtarget/index.html | 2 +- files/zh-cn/web/api/extendableevent/waituntil/index.html | 4 ++-- files/zh-cn/web/api/fetch_api/using_fetch/index.html | 2 +- files/zh-cn/web/api/fullscreen_api/index.html | 2 +- files/zh-cn/web/api/history_api/index.html | 2 +- files/zh-cn/web/api/htmlanchorelement/hash/index.html | 2 +- files/zh-cn/web/api/htmlcanvaselement/index.html | 10 +++++----- files/zh-cn/web/api/htmlelement/nonce/index.html | 2 +- files/zh-cn/web/api/htmlimageelement/index.html | 2 +- .../web/api/htmlinputelement/setselectionrange/index.html | 2 +- files/zh-cn/web/api/htmlmediaelement/load/index.html | 2 +- files/zh-cn/web/api/htmlmediaelement/play/index.html | 12 ++++++------ files/zh-cn/web/api/inputevent/data/index.html | 2 +- files/zh-cn/web/api/inputevent/datatransfer/index.html | 2 +- files/zh-cn/web/api/mediarecorder/index.html | 4 ++-- files/zh-cn/web/api/mouseevent/screeny/index.html | 2 +- .../navigation_timing_api/using_navigation_timing/index.html | 4 ++-- files/zh-cn/web/api/navigator/canshare/index.html | 2 +- .../web/api/navigator/registerprotocolhandler/index.html | 4 ++-- files/zh-cn/web/api/node/textcontent/index.html | 12 ++++++------ files/zh-cn/web/api/page_visibility_api/index.html | 8 ++++---- files/zh-cn/web/api/pointer_events/index.html | 2 +- files/zh-cn/web/api/rtcpeerconnection/addtrack/index.html | 2 +- files/zh-cn/web/api/server-sent_events/index.html | 2 +- .../server-sent_events/using_server-sent_events/index.html | 4 ++-- files/zh-cn/web/api/streams_api/concepts/index.html | 2 +- files/zh-cn/web/api/stylesheet/disabled/index.html | 2 +- files/zh-cn/web/api/touch/target/index.html | 2 +- files/zh-cn/web/api/url/index.html | 4 ++-- files/zh-cn/web/api/url/password/index.html | 2 +- files/zh-cn/web/api/url_api/index.html | 4 ++-- files/zh-cn/web/api/validitystate/index.html | 4 ++-- files/zh-cn/web/api/visualviewport/index.html | 8 ++++---- files/zh-cn/web/api/webgl_api/index.html | 4 ++-- .../api/webglrenderingcontext/createrenderbuffer/index.html | 2 +- .../zh-cn/web/api/webrtc_api/taking_still_photos/index.html | 4 ++-- files/zh-cn/web/api/window/beforeunload_event/index.html | 2 +- files/zh-cn/web/api/window/devicepixelratio/index.html | 6 +++--- files/zh-cn/web/api/window/getselection/index.html | 2 +- files/zh-cn/web/api/window/requestidlecallback/index.html | 2 +- files/zh-cn/web/api/windoweventhandlers/onunload/index.html | 2 +- files/zh-cn/web/api/worker/index.html | 6 +++--- .../web/api/xmlhttprequest/getresponseheader/index.html | 2 +- 55 files changed, 90 insertions(+), 90 deletions(-) (limited to 'files/zh-cn/web/api') diff --git a/files/zh-cn/web/api/audiocontext/index.html b/files/zh-cn/web/api/audiocontext/index.html index b70d5feb56..eae53ceaa1 100644 --- a/files/zh-cn/web/api/audiocontext/index.html +++ b/files/zh-cn/web/api/audiocontext/index.html @@ -98,6 +98,6 @@ var finish = audioCtx.destination;

相关链接

diff --git a/files/zh-cn/web/api/canvas_api/tutorial/transformations/index.html b/files/zh-cn/web/api/canvas_api/tutorial/transformations/index.html index d8e65e4dc4..fea4e7e8fc 100644 --- a/files/zh-cn/web/api/canvas_api/tutorial/transformations/index.html +++ b/files/zh-cn/web/api/canvas_api/tutorial/transformations/index.html @@ -212,7 +212,7 @@ translation_of: Web/API/Canvas_API/Tutorial/Transformations
{{domxref("CanvasRenderingContext2D.transform", "transform(a, b, c, d, e, f)")}}
这个方法是将当前的变形矩阵乘上一个基于自身参数的矩阵,如下面的矩阵所示:[acebdf001]\left[ \begin{array}{ccc} a & c & e \\ b & d & f \\ 0 & 0 & 1 \end{array} \right]
-
如果任意一个参数是Infinity,变形矩阵也必须被标记为无限大,否则会抛出异常。
+
如果任意一个参数是Infinity,变形矩阵也必须被标记为无限大,否则会抛出异常。

这个函数的参数各自代表如下:

diff --git a/files/zh-cn/web/api/canvasrenderingcontext2d/fillstyle/index.html b/files/zh-cn/web/api/canvasrenderingcontext2d/fillstyle/index.html index 09f8a09480..33cd174f64 100644 --- a/files/zh-cn/web/api/canvasrenderingcontext2d/fillstyle/index.html +++ b/files/zh-cn/web/api/canvasrenderingcontext2d/fillstyle/index.html @@ -154,7 +154,7 @@ setFillColor(c, m, y, k, a);

参见

diff --git a/files/zh-cn/web/api/document/onfullscreenchange/index.html b/files/zh-cn/web/api/document/onfullscreenchange/index.html index 68c269c2a0..e012de078f 100644 --- a/files/zh-cn/web/api/document/onfullscreenchange/index.html +++ b/files/zh-cn/web/api/document/onfullscreenchange/index.html @@ -59,8 +59,8 @@ document.documentElement.onclick = function () {

相关文章

diff --git a/files/zh-cn/web/api/document/visibilitychange_event/index.html b/files/zh-cn/web/api/document/visibilitychange_event/index.html index f1c945c5ea..a2099d511b 100644 --- a/files/zh-cn/web/api/document/visibilitychange_event/index.html +++ b/files/zh-cn/web/api/document/visibilitychange_event/index.html @@ -33,7 +33,7 @@ translation_of: Web/API/Document/visibilitychange_event

该事件不包括文档的更新的可见性状态,但是您可以从文档的  {{domxref("Document.visibilityState", "visibilityState")}} 属性中获取该信息。

-

当 visibleStateState 属性的值转换为 hidden 时,Safari不会按预期触发visibilitychange; 因此,在这种情况下,您还需要包含代码以侦听 pagehide 事件。

+

当 visibleStateState 属性的值转换为 hidden 时,Safari不会按预期触发visibilitychange; 因此,在这种情况下,您还需要包含代码以侦听 pagehide 事件。

diff --git a/files/zh-cn/web/api/element/classlist/index.html b/files/zh-cn/web/api/element/classlist/index.html index 4cd64f9d9f..194b627074 100644 --- a/files/zh-cn/web/api/element/classlist/index.html +++ b/files/zh-cn/web/api/element/classlist/index.html @@ -24,7 +24,7 @@ translation_of: Web/API/Element/classList

返回值

-

elementClasses 是一个 {{domxref("DOMTokenList")}} 表示  elementNodeReference 的类属性 。如果类属性未设置或为空,那么 elementClasses.length 返回 0。虽然 element.classList 本身是只读的,但是你可以使用 add() 和 remove() 方法修改它。

+

elementClasses 是一个 {{domxref("DOMTokenList")}} 表示  elementNodeReference 的类属性 。如果类属性未设置或为空,那么 elementClasses.length 返回 0。虽然 element.classList 本身是只读的,但是你可以使用 add() 和 remove() 方法修改它。

示例

diff --git a/files/zh-cn/web/api/element/mousemove_event/index.html b/files/zh-cn/web/api/element/mousemove_event/index.html index a6aace0933..f549324971 100644 --- a/files/zh-cn/web/api/element/mousemove_event/index.html +++ b/files/zh-cn/web/api/element/mousemove_event/index.html @@ -41,7 +41,7 @@ translation_of: Web/API/Element/mousemove_event

例子

-

下面的例子将使用 {{domxref("Element/mousedown_event", "mousedown")}}, mousemove 以及 {{domxref("Element/mouseup_event", "mouseup")}} 事件,实现一个允许用户在 HTML5 canvas绘图的功能。这个例子的功能很简单:线的粗细设置为1,颜色始终为黑色。

+

下面的例子将使用 {{domxref("Element/mousedown_event", "mousedown")}}, mousemove 以及 {{domxref("Element/mouseup_event", "mouseup")}} 事件,实现一个允许用户在 HTML5 canvas绘图的功能。这个例子的功能很简单:线的粗细设置为1,颜色始终为黑色。

当页面加载完成,我们使用变量 myPics 和context分别保存ID为myPics的DOM元素和接下来需要加工的的2d元素。

diff --git a/files/zh-cn/web/api/event/cancelable/index.html b/files/zh-cn/web/api/event/cancelable/index.html index 260da1a336..a7433f1e4e 100644 --- a/files/zh-cn/web/api/event/cancelable/index.html +++ b/files/zh-cn/web/api/event/cancelable/index.html @@ -11,7 +11,7 @@ translation_of: Web/API/Event/cancelable

大部分由用户与页面交互产生的原生浏览器事件都可以被取消。取消{{event("click")}},{{event("scroll")}} 或 {{event("beforeunload")}} 事件将分别阻止用户点击某些元素,滚动页面或跳离页面。

-

使用其它 JavaScript 代码创建的 Custom events ,可以在初始化事件的时候控制该事件是否可以被取消。

+

使用其它 JavaScript 代码创建的 Custom events ,可以在初始化事件的时候控制该事件是否可以被取消。

语法

diff --git a/files/zh-cn/web/api/eventtarget/index.html b/files/zh-cn/web/api/eventtarget/index.html index 3793a8b749..8d22342e6b 100644 --- a/files/zh-cn/web/api/eventtarget/index.html +++ b/files/zh-cn/web/api/eventtarget/index.html @@ -14,7 +14,7 @@ translation_of: Web/API/EventTarget

{{domxref("Element")}},{{domxref("document")}} 和 {{domxref("window")}} 是最常见的 event targets ,但是其他对象也可以作为 event targets,比如 {{domxref("XMLHttpRequest")}},{{domxref("AudioNode")}},{{domxref("AudioContext")}}  等等。

-

许多 event targets (包括 elements, documents 和 windows)支持通过 onevent 特性和属性设置事件处理程序 (event handlers)。

+

许多 event targets (包括 elements, documents 和 windows)支持通过 onevent 特性和属性设置事件处理程序 (event handlers)。

{{InheritanceDiagram}}

diff --git a/files/zh-cn/web/api/extendableevent/waituntil/index.html b/files/zh-cn/web/api/extendableevent/waituntil/index.html index 8e48586b67..919ceac2c6 100644 --- a/files/zh-cn/web/api/extendableevent/waituntil/index.html +++ b/files/zh-cn/web/api/extendableevent/waituntil/index.html @@ -7,9 +7,9 @@ translation_of: Web/API/ExtendableEvent/waitUntil

ExtendableEvent.waitUntil() 方法告诉事件分发器该事件仍在进行。这个方法也可以用于检测进行的任务是否成功。在服务工作线程中,这个方法告诉浏览器事件一直进行,直至 promise 解决,浏览器不应该在事件中的异步操作完成之前终止服务工作线程。

-

服务工作线程(service workers)中的 {{domxref("ServiceWorkerGlobalScope/install_event", "install")}} 事件使用 waitUntil() 来将服务工作线程保持在 {{domxref("ServiceWorkerRegistration.installing", "installing")}} 阶段。如果传入 waitUntil() 的 promise 被拒绝,则将此次安装视为失败,丢弃这个服务工作线程。这主要用于确保在服务工作线程安装以前,所有依赖的核心缓存都已经成功载入。

+

服务工作线程(service workers)中的 {{domxref("ServiceWorkerGlobalScope/install_event", "install")}} 事件使用 waitUntil() 来将服务工作线程保持在 {{domxref("ServiceWorkerRegistration.installing", "installing")}} 阶段。如果传入 waitUntil() 的 promise 被拒绝,则将此次安装视为失败,丢弃这个服务工作线程。这主要用于确保在服务工作线程安装以前,所有依赖的核心缓存都已经成功载入。

-

服务工作线程(service workers)中的 {{domxref("ServiceWorkerGlobalScope/activate_event", "activate")}} 事件使用 waitUntil() 来延迟函数事件,如 fetch 和 push,直至传入 waitUntil() 的 promise 被解决。这让服务工作线程有时间更新数据库架构(database schema)和删除过时缓存({{domxref("Cache", "caches")}}),让其他事件能在一个完成更新的状态下进行。

+

服务工作线程(service workers)中的 {{domxref("ServiceWorkerGlobalScope/activate_event", "activate")}} 事件使用 waitUntil() 来延迟函数事件,如 fetch 和 push,直至传入 waitUntil() 的 promise 被解决。这让服务工作线程有时间更新数据库架构(database schema)和删除过时缓存({{domxref("Cache", "caches")}}),让其他事件能在一个完成更新的状态下进行。

 waitUntil() 方法最初必须在事件回调里调用,在此之后,方法可以被调用多次,直至所有传入的 promise 被解决。

diff --git a/files/zh-cn/web/api/fetch_api/using_fetch/index.html b/files/zh-cn/web/api/fetch_api/using_fetch/index.html index eb8f12659b..d08d605958 100644 --- a/files/zh-cn/web/api/fetch_api/using_fetch/index.html +++ b/files/zh-cn/web/api/fetch_api/using_fetch/index.html @@ -20,7 +20,7 @@ translation_of: Web/API/Fetch_API/Using_Fetch diff --git a/files/zh-cn/web/api/fullscreen_api/index.html b/files/zh-cn/web/api/fullscreen_api/index.html index 59bea9a990..87e6fec637 100644 --- a/files/zh-cn/web/api/fullscreen_api/index.html +++ b/files/zh-cn/web/api/fullscreen_api/index.html @@ -117,7 +117,7 @@ translation_of: Web/API/Fullscreen_API

全屏模式可由功能策略( Feature Policy)控制。全屏模式功能由字符串“full screen”标识,默认的允许列表值为“self”,这意味着在顶级文档上下文 以及 从与顶级文档相同的源加载的嵌套上下文中允许使用全屏模式。

-

请参阅使用功能策略( Feature Policy )以了解有关使用功能策略控制对API的访问的更多信息。

+

请参阅使用功能策略( Feature Policy )以了解有关使用功能策略控制对API的访问的更多信息。

使用说明

diff --git a/files/zh-cn/web/api/history_api/index.html b/files/zh-cn/web/api/history_api/index.html index 2c4edffce9..c7e54a41b3 100644 --- a/files/zh-cn/web/api/history_api/index.html +++ b/files/zh-cn/web/api/history_api/index.html @@ -209,5 +209,5 @@ history.pushState(stateObj, "page 2", "bar.html");

Guides

diff --git a/files/zh-cn/web/api/htmlanchorelement/hash/index.html b/files/zh-cn/web/api/htmlanchorelement/hash/index.html index 5f9305da09..257a572947 100644 --- a/files/zh-cn/web/api/htmlanchorelement/hash/index.html +++ b/files/zh-cn/web/api/htmlanchorelement/hash/index.html @@ -10,7 +10,7 @@ original_slug: Web/API/HTMLHyperlinkElementUtils/hash

HTMLHyperlinkElementUtils.hash 属性返回一个包含“#”的 {{domxref("DOMString")}} , 后跟URL的片段标识符。

-

片段没有百分比解码。如果URL没有包含片段标识符,这个属性为一个空的字符串, "".

+

片段没有百分比解码。如果URL没有包含片段标识符,这个属性为一个空的字符串, "".

Syntax

diff --git a/files/zh-cn/web/api/htmlcanvaselement/index.html b/files/zh-cn/web/api/htmlcanvaselement/index.html index b5efafdf5b..75396fc50c 100644 --- a/files/zh-cn/web/api/htmlcanvaselement/index.html +++ b/files/zh-cn/web/api/htmlcanvaselement/index.html @@ -32,7 +32,7 @@ translation_of: Web/API/HTMLCanvasElement
{{domxref("HTMLCanvasElement.captureStream()")}} {{experimental_inline}}
返回{{domxref("CanvasCaptureMediaStream")}} ,它是对画布表面的实时视频捕获。
{{domxref("HTMLCanvasElement.getContext()")}}
-
返回画布上的绘图上下文;如果不支持上下文ID,则返回null。 绘图上下文可让您在画布上绘图。 调用getContext传入"2d" 可以返回一个{{domxref("CanvasRenderingContext2D")}}对象,也可以传入"webgl"(或"experimental-webgl")返回一个{{domxref("WebGLRenderingContext")}} 对象。 此上下文仅在实现WebGL的浏览器上可用。
+
返回画布上的绘图上下文;如果不支持上下文ID,则返回null。 绘图上下文可让您在画布上绘图。 调用getContext传入"2d" 可以返回一个{{domxref("CanvasRenderingContext2D")}}对象,也可以传入"webgl"(或"experimental-webgl")返回一个{{domxref("WebGLRenderingContext")}} 对象。 此上下文仅在实现WebGL的浏览器上可用。
{{domxref("HTMLCanvasElement.toDataURL()")}}
返回一个数据URL,该URL包含由类型参数指定的格式的图像(默认为png)。 返回的图像分辨率为96dpi。
{{domxref("HTMLCanvasElement.toBlob()")}}
@@ -48,14 +48,14 @@ translation_of: Web/API/HTMLCanvasElement

事件

-

使用addEventListener()监听这些事件。

+

使用addEventListener()监听这些事件。

-
webglcontextcreationerror
+
webglcontextcreationerror
如果用户代理无法创建WebGLRenderingContext 或WebGL2RenderingContext 上下文,则触发该事件。
-
webglcontextlost
+
webglcontextlost
如果用户代理检测到与WebGLRenderingContext 或WebGL2RenderingContext 对象关联的绘图缓冲区已丢失,则触发此事件。
-
webglcontextrestored
+
webglcontextrestored
如果用户代理为WebGLRenderingContext 或WebGL2RenderingContext 对象恢复绘图缓冲区,则触发该事件。
diff --git a/files/zh-cn/web/api/htmlelement/nonce/index.html b/files/zh-cn/web/api/htmlelement/nonce/index.html index 018a276376..0e427038a4 100644 --- a/files/zh-cn/web/api/htmlelement/nonce/index.html +++ b/files/zh-cn/web/api/htmlelement/nonce/index.html @@ -26,7 +26,7 @@ HTMLElement.nonce = nonce

访问nonce属性值

-

以前,并不是所有的浏览器都支持 nonce IDL属性,因此在实际应用场景中,尝试使用getAttribute 作为备选:

+

以前,并不是所有的浏览器都支持 nonce IDL属性,因此在实际应用场景中,尝试使用getAttribute 作为备选:

let nonce = script['nonce'] || script.getAttribute('nonce');
diff --git a/files/zh-cn/web/api/htmlimageelement/index.html b/files/zh-cn/web/api/htmlimageelement/index.html index 19ae9dd455..bf35d8b582 100644 --- a/files/zh-cn/web/api/htmlimageelement/index.html +++ b/files/zh-cn/web/api/htmlimageelement/index.html @@ -29,7 +29,7 @@ translation_of: Web/API/HTMLImageElement
一个 {{domxref("DOMString")}} 表示这个img元素的 CORS 设置。参考 CORS settings attributes。This may be null if CORS is not used.
{{domxref("HTMLImageElement.currentSrc")}} {{readonlyInline}}
返回一个 {{domxref("DOMString")}}  表示加载当前显示的图像的URL。
- 这可能会改变,因为图像是调整,由于不断变化的条件,由任何 media queries 的地方。
+ 这可能会改变,因为图像是调整,由于不断变化的条件,由任何 media queries 的地方。
{{domxref("HTMLImageElement.decoding")}}
An optional {{domxref("DOMString")}} representing a hint given to the browser on how it should decode the image. If this value is provided, it must be one of the possible permitted values: sync to decode the image synchronously, async to decode it asynchronously, or auto to indicate no preference (which is the default). Read the {{domxref("HTMLImageElement.decoding", "decoding")}} page for details on the implications of this property's values.
{{domxref("HTMLImageElement.height")}}
diff --git a/files/zh-cn/web/api/htmlinputelement/setselectionrange/index.html b/files/zh-cn/web/api/htmlinputelement/setselectionrange/index.html index 0d7070858d..b571e8cf9a 100644 --- a/files/zh-cn/web/api/htmlinputelement/setselectionrange/index.html +++ b/files/zh-cn/web/api/htmlinputelement/setselectionrange/index.html @@ -20,7 +20,7 @@ translation_of: Web/API/HTMLInputElement/setSelectionRange

要注意的是,在 WHATWG forms spec 中,selectionStartselectionEnd 属性和 setSelectionRange 方法只能应用于类型为文本、搜索、链接、电话号码和密码的输入。Chrome 从版本 33 开始会在访问其余类型的这些属性和方法时抛出异常。例如,输入类型为数字时会抛出:“不能从'HTMLInputElement'中读取'selectionStart'属性:输入元素的类型('number')不支持选择(Failed to read the 'selectionStart' property from 'HTMLInputElement': The input element's type ('number') does not support selection)”。

-

如果你希望全选输入元素中的文本,你可以使用 HTMLInputElement.select() 方法。

+

如果你希望全选输入元素中的文本,你可以使用 HTMLInputElement.select() 方法。

语法

diff --git a/files/zh-cn/web/api/htmlmediaelement/load/index.html b/files/zh-cn/web/api/htmlmediaelement/load/index.html index eb674466d9..9f3d3c4496 100644 --- a/files/zh-cn/web/api/htmlmediaelement/load/index.html +++ b/files/zh-cn/web/api/htmlmediaelement/load/index.html @@ -23,7 +23,7 @@ translation_of: Web/API/HTMLMediaElement/load

用法

-

调用 load() 会使媒体上所有正在进行的操作中止,然后根据 audio 或者 video 元素的 src 或者 source 属性里寻找合适的播放源并重新加载媒体内容。 更多查看  Supporting multiple formats 和 Video and audio content 。

+

调用 load() 会使媒体上所有正在进行的操作中止,然后根据 audio 或者 video 元素的 src 或者 source 属性里寻找合适的播放源并重新加载媒体内容。 更多查看  Supporting multiple formats 和 Video and audio content 。

The process of aborting any ongoing activities will cause any outstanding {{jsxref("Promise")}}s returned by {{domxref("HTMLMediaElement.play", "play()")}} being resolved or rejected as appropriate based on their status before the loading of new media can begin. Pending play promises are aborted with an "AbortError" {{domxref("DOMException")}}.

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

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

-

关于自动播放和禁止自动播放的更多深度内容,参见我们的文章 Autoplay guide for media and Web Audio APIs

+

关于自动播放和禁止自动播放的更多深度内容,参见我们的文章 Autoplay guide for media and Web Audio APIs

示例

@@ -86,7 +86,7 @@ function handlePlayButton() { } } -

在这个例子中,视频的播放由 async playVideo() 函数控制。函数尝试播放视频,如果播放成功,将 playButton 元素的类名称设为 "playing"。如果播放失败,去除 playButton 元素的类名称,恢复其原来的样式。通过监视 play() 返回的 {{jsxref("Promise")}} 是被解决还是被拒绝以保证播放按钮的外观与实际的播放状态相匹配。

+

在这个例子中,视频的播放由 async playVideo() 函数控制。函数尝试播放视频,如果播放成功,将 playButton 元素的类名称设为 "playing"。如果播放失败,去除 playButton 元素的类名称,恢复其原来的样式。通过监视 play() 返回的 {{jsxref("Promise")}} 是被解决还是被拒绝以保证播放按钮的外观与实际的播放状态相匹配。

上述代码开始执行时,先获取 {{HTMLElement("video")}} 元素和用于切换播放、暂停的 {{HTMLElement("button")}} 元素的引用。在切换按钮上添加 {{event("click")}} 事件的处理程序。最后调用 playVideo() 尝试自动开始播放。

@@ -125,10 +125,10 @@ function handlePlayButton() {

参见

diff --git a/files/zh-cn/web/api/inputevent/data/index.html b/files/zh-cn/web/api/inputevent/data/index.html index 0b1259df38..fc88ca7c42 100644 --- a/files/zh-cn/web/api/inputevent/data/index.html +++ b/files/zh-cn/web/api/inputevent/data/index.html @@ -26,7 +26,7 @@ translation_of: Web/API/InputEvent/data

示例

-

在下面的简单示例中,我们在 input 事件上设置了一个事件监听器,以便在对 {{htmlelement("input")}} 元素的内容进行任何更改时(通过键入或粘贴),通过 InputEvent.data 属性检索添加的文本,并在 <input> 下面的段落中报告。

+

在下面的简单示例中,我们在 input 事件上设置了一个事件监听器,以便在对 {{htmlelement("input")}} 元素的内容进行任何更改时(通过键入或粘贴),通过 InputEvent.data 属性检索添加的文本,并在 <input> 下面的段落中报告。

<p>Some text to copy and paste.</p>
 
diff --git a/files/zh-cn/web/api/inputevent/datatransfer/index.html b/files/zh-cn/web/api/inputevent/datatransfer/index.html
index 680c567b7f..80699e5fd9 100644
--- a/files/zh-cn/web/api/inputevent/datatransfer/index.html
+++ b/files/zh-cn/web/api/inputevent/datatransfer/index.html
@@ -22,7 +22,7 @@ translation_of: Web/API/InputEvent/dataTransfer
 
 

示例

-

在下面的简单示例中,我们在 input 事件上设置了一个事件监听器,以便在将任何内容粘贴到 {{htmlelement("p")}} 元素时,通过 InputEvent.dataTransfer.getData() 方法检索其HTML源代码,并在输入框下面的段落中报告。

+

在下面的简单示例中,我们在 input 事件上设置了一个事件监听器,以便在将任何内容粘贴到 {{htmlelement("p")}} 元素时,通过 InputEvent.dataTransfer.getData() 方法检索其HTML源代码,并在输入框下面的段落中报告。

尝试复制并粘贴提供的部分内容以查看效果。注意,部分浏览器对其支持不佳。

diff --git a/files/zh-cn/web/api/mediarecorder/index.html b/files/zh-cn/web/api/mediarecorder/index.html index 5f42134e79..369e6dd27d 100644 --- a/files/zh-cn/web/api/mediarecorder/index.html +++ b/files/zh-cn/web/api/mediarecorder/index.html @@ -84,9 +84,9 @@ translation_of: Web/API/MediaRecorder

Listen to these events using addEventListener() or by assigning an event listener to the oneventname property of this interface.

-
error
+
error
Fired when an error occurs: for example because recording wasn't allowed or was attempted using an unsupported codec.
- Also available via the onerror property.
+ Also available via the onerror property.
diff --git a/files/zh-cn/web/api/mouseevent/screeny/index.html b/files/zh-cn/web/api/mouseevent/screeny/index.html index 4286534635..c90e1708d2 100644 --- a/files/zh-cn/web/api/mouseevent/screeny/index.html +++ b/files/zh-cn/web/api/mouseevent/screeny/index.html @@ -11,7 +11,7 @@ translation_of: Web/API/MouseEvent/screenY ---

{{APIRef("DOM Events")}}

-

 screenX 是 MouseEvent 的只读属性,提供鼠标在全局(屏幕)中的水平坐标(偏移量)。

+

 screenX 是 MouseEvent 的只读属性,提供鼠标在全局(屏幕)中的水平坐标(偏移量)。

语法

diff --git a/files/zh-cn/web/api/navigation_timing_api/using_navigation_timing/index.html b/files/zh-cn/web/api/navigation_timing_api/using_navigation_timing/index.html index 6f8c12dcf9..c2a1a1c2a3 100644 --- a/files/zh-cn/web/api/navigation_timing_api/using_navigation_timing/index.html +++ b/files/zh-cn/web/api/navigation_timing_api/using_navigation_timing/index.html @@ -46,7 +46,7 @@ translation_of: Web/API/Navigation_timing_API/Using_Navigation_Timing

列出的值适用于上面展示了示例的{{HTMLElement("iframe")}}。

-

你可以在{{domxref("PerformanceTiming")}}中查找可用的计时值的列表,请参见{{domxref("PerformanceTiming")}}接口的“属性”部分。

+

你可以在{{domxref("PerformanceTiming")}}中查找可用的计时值的列表,请参见{{domxref("PerformanceTiming")}}接口的“属性”部分。

确定导航类型

@@ -114,7 +114,7 @@ translation_of: Web/API/Navigation_timing_API/Using_Navigation_Timing

也可以看看

diff --git a/files/zh-cn/web/api/navigator/canshare/index.html b/files/zh-cn/web/api/navigator/canshare/index.html index 9fe117805d..6f807819d7 100644 --- a/files/zh-cn/web/api/navigator/canshare/index.html +++ b/files/zh-cn/web/api/navigator/canshare/index.html @@ -7,7 +7,7 @@ translation_of: Web/API/Navigator/canShare
-
如果对Navigator.share() 的调用成功,则Web Share API的Navigator.canShare()方法将返回true。
+
如果对Navigator.share() 的调用成功,则Web Share API的Navigator.canShare()方法将返回true。

语法

diff --git a/files/zh-cn/web/api/navigator/registerprotocolhandler/index.html b/files/zh-cn/web/api/navigator/registerprotocolhandler/index.html index b51348f2ef..fd1de837c9 100644 --- a/files/zh-cn/web/api/navigator/registerprotocolhandler/index.html +++ b/files/zh-cn/web/api/navigator/registerprotocolhandler/index.html @@ -35,7 +35,7 @@ translation_of: Web/API/Navigator/registerProtocolHandler
url
-
处理器的URL,string类型。这个字符串应该包含一个"%s"的占位符,其会被将要受理的文档的 escaped 链接所替换。这个链接(译者按:指将要受理的文档的 escaped 链接,也就是替换占位符的字符串)可能是一个真实的URL,或者是一个电话号码,邮件地址之类的。
+
处理器的URL,string类型。这个字符串应该包含一个"%s"的占位符,其会被将要受理的文档的 escaped 链接所替换。这个链接(译者按:指将要受理的文档的 escaped 链接,也就是替换占位符的字符串)可能是一个真实的URL,或者是一个电话号码,邮件地址之类的。
这个处理器的 URL 必须以 http 或者 https 协议标记作为开头,最好是 https ,以满足一些浏览器出于安全考虑的要求。
@@ -53,7 +53,7 @@ translation_of: Web/API/Navigator/registerProtocolHandler
  • 指定了一个非法的协议标记,例如一个浏览器自身的标记(https:about: 等)。
  • -
  • 处理器URL的 origin 与调用这个API的页面的 origin不匹配。
  • +
  • 处理器URL的 origin 与调用这个API的页面的 origin不匹配。
  • 浏览器要求这个函数由安全的上下文调用。
  • 浏览器要求处理器的URL使用 HTTPS 协议。
diff --git a/files/zh-cn/web/api/node/textcontent/index.html b/files/zh-cn/web/api/node/textcontent/index.html index 1a2cd275e7..d9b4f26e86 100644 --- a/files/zh-cn/web/api/node/textcontent/index.html +++ b/files/zh-cn/web/api/node/textcontent/index.html @@ -13,7 +13,7 @@ translation_of: Web/API/Node/textContent

{{domxref ("Node")}} 接口的 textContent 属性表示一个节点及其后代的文本内容。

-

注意: textContent 和 {{domxref("HTMLElement.innerText")}} 容易混淆,但这两个属性在重要方面有不同之处 。

+

注意: textContent 和 {{domxref("HTMLElement.innerText")}} 容易混淆,但这两个属性在重要方面有不同之处 。

语法

@@ -30,13 +30,13 @@ translation_of: Web/API/Node/textContent

textContent 的值取决于具体情况:

    -
  • 如果节点是一个 {{domxref("document")}},或者一个 DOCTYPE ,则 textContent 返回 null。 +
  • 如果节点是一个 {{domxref("document")}},或者一个 DOCTYPE ,则 textContent 返回 null
    -

    如果你要获取整个文档的文本以及 CDATA data ,可以使用 document.documentElement.textContent

    +

    如果你要获取整个文档的文本以及 CDATA data ,可以使用 document.documentElement.textContent

  • -
  • 如果节点是个 CDATA section、注释、processing instruction 或者 text nodetextContent 返回节点内部的文本内容,例如 {{domxref("Node.nodeValue")}}。
  • +
  • 如果节点是个 CDATA section、注释、processing instruction 或者 text nodetextContent 返回节点内部的文本内容,例如 {{domxref("Node.nodeValue")}}。
  • 对于其他节点类型,textContent 将所有子节点的 textContent 合并后返回,除了注释和processing instructions。(如果该节点没有子节点的话,返回一个空字符串。)
@@ -50,7 +50,7 @@ translation_of: Web/API/Node/textContent
  • textContent 会获取所有元素的内容,包括 {{HTMLElement("script")}} 和 {{HTMLElement("style")}} 元素,然而 innerText 只展示给人看的元素。
  • textContent 会返回节点中的每一个元素。相反,innerText 受 CSS 样式的影响,并且不会返回隐藏元素的文本,
      -
    • 此外,由于 innerText 受 CSS 样式的影响,它会触发回流( reflow )去确保是最新的计算样式。(回流在计算上可能会非常昂贵,因此应尽可能避免。)
    • +
    • 此外,由于 innerText 受 CSS 样式的影响,它会触发回流( reflow )去确保是最新的计算样式。(回流在计算上可能会非常昂贵,因此应尽可能避免。)
  • 与 textContent 不同的是, 在 Internet Explorer (小于和等于 11 的版本) 中对 innerText 进行修改, 不仅会移除当前元素的子节点,而且还会永久性地破坏所有后代文本节点。在之后不可能再次将节点再次插入到任何其他元素或同一元素中。
  • @@ -60,7 +60,7 @@ translation_of: Web/API/Node/textContent

    正如其名称,{{domxref("Element.innerHTML")}} 返回 HTML。通常,为了在元素中检索或写入文本,人们使用 innerHTML。但是,textContent 通常具有更好的性能,因为文本不会被解析为HTML。

    -

    此外,使用 textContent 可以防止 XSS 攻击

    +

    此外,使用 textContent 可以防止 XSS 攻击

    例子

    diff --git a/files/zh-cn/web/api/page_visibility_api/index.html b/files/zh-cn/web/api/page_visibility_api/index.html index 383b0304bd..55e8f2c211 100644 --- a/files/zh-cn/web/api/page_visibility_api/index.html +++ b/files/zh-cn/web/api/page_visibility_api/index.html @@ -42,11 +42,11 @@ translation_of: Web/API/Page_Visibility_API
    • 大多数浏览器不会调用被隐藏的标签页或{{ HTMLElement("iframe") }}框架当中{{domxref("Window.requestAnimationFrame", "requestAnimationFrame()")}}定义的回调函数,这会提升性能并且延长电池的使用寿命。
    • -
    • 在调用被隐藏的标签页或iframe框架中 {{domxref("WindowOrWorkerGlobalScope.setTimeout", "setTimeout()")}}等计时器会被加速。 See Reasons for delays longer than specified for more details.
    • +
    • 在调用被隐藏的标签页或iframe框架中 {{domxref("WindowOrWorkerGlobalScope.setTimeout", "setTimeout()")}}等计时器会被加速。 See Reasons for delays longer than specified for more details.
    • Budget-based background timeout throttling is now available in modern browsers (Firefox 58+, Chrome 57+), placing an additional limit on background timer CPU usage. This operates in a similar way across modern browsers, with the details being as follows:
      • In Firefox, windows in background tabs each have their own time budget in milliseconds — a max and a min value of +50 ms and -150 ms, respectively. Chrome is very similar except that the budget is specified in seconds.
      • -
      • Windows are subjected to throttling after 30 seconds, with the same throttling delay rules as specified for window timers (again, see Reasons for delays longer than specified). In Chrome, this value is 10 seconds.
      • +
      • Windows are subjected to throttling after 30 seconds, with the same throttling delay rules as specified for window timers (again, see Reasons for delays longer than specified). In Chrome, this value is 10 seconds.
      • Timer tasks are only permitted when the budget is non-negative.
      • Once a timer's code has finished running, the duration of time it took to execute is subtracted from its window's timeout budget.
      • The budget regenerates at a rate of 10 ms per second, in both Firefox and Chrome.
      • @@ -58,8 +58,8 @@ translation_of: Web/API/Page_Visibility_API
        • Tabs which are playing audio are considered foreground and aren’t throttled.
        • -
        • Tabs running code that's using real-time network connections (WebSockets and WebRTC) go unthrottled in order to avoid closing these connections timing out and getting unexpectedly closed.
        • -
        • IndexedDB processes are also left unthrottled in order to avoid timeouts.
        • +
        • Tabs running code that's using real-time network connections (WebSockets and WebRTC) go unthrottled in order to avoid closing these connections timing out and getting unexpectedly closed.
        • +
        • IndexedDB processes are also left unthrottled in order to avoid timeouts.

        示例

        diff --git a/files/zh-cn/web/api/pointer_events/index.html b/files/zh-cn/web/api/pointer_events/index.html index 2a00f157a4..ee402fa91a 100644 --- a/files/zh-cn/web/api/pointer_events/index.html +++ b/files/zh-cn/web/api/pointer_events/index.html @@ -22,7 +22,7 @@ translation_of: Web/API/Pointer_events
        active buttons state
        -
        The condition when a pointer has a non-zero value for the buttons property. For example, in the case of a pen, when the pen has physical contact with the digitizer, or at least one button is depressed while hovering.
        +
        The condition when a pointer has a non-zero value for the buttons property. For example, in the case of a pen, when the pen has physical contact with the digitizer, or at least one button is depressed while hovering.
        diff --git a/files/zh-cn/web/api/rtcpeerconnection/addtrack/index.html b/files/zh-cn/web/api/rtcpeerconnection/addtrack/index.html index df295671eb..024fd5d0ed 100644 --- a/files/zh-cn/web/api/rtcpeerconnection/addtrack/index.html +++ b/files/zh-cn/web/api/rtcpeerconnection/addtrack/index.html @@ -148,7 +148,7 @@ pc.ontrack = ev => {

        实例

        -

        这个例子是从文章中给出的Signaling and video calling及其相应的示例代码中提取的。它来自那里的handleVideoOfferMsg()方法,该方法在从远程对等方接收到报价消息时被调用。

        +

        这个例子是从文章中给出的Signaling and video calling及其相应的示例代码中提取的。它来自那里的handleVideoOfferMsg()方法,该方法在从远程对等方接收到报价消息时被调用。

        var mediaConstraints = {
           audio: true,            // We want an audio track
        diff --git a/files/zh-cn/web/api/server-sent_events/index.html b/files/zh-cn/web/api/server-sent_events/index.html
        index a6e44fee83..0f3324ec7d 100644
        --- a/files/zh-cn/web/api/server-sent_events/index.html
        +++ b/files/zh-cn/web/api/server-sent_events/index.html
        @@ -11,7 +11,7 @@ original_slug: Server-sent_events
         ---
         
        {{DefaultAPISidebar("Server Sent Events")}}
        -

        一个网页获取新的数据通常需要发送一个请求到服务器,也就是向服务器请求的页面。使用 server-sent 事件,服务器可以在任何时刻向我们的 Web 页面推送数据和信息。这些被推送进来的信息可以在这个页面上作为 Events + data 的形式来处理。

        +

        一个网页获取新的数据通常需要发送一个请求到服务器,也就是向服务器请求的页面。使用 server-sent 事件,服务器可以在任何时刻向我们的 Web 页面推送数据和信息。这些被推送进来的信息可以在这个页面上作为 Events + data 的形式来处理。

        概念与使用

        diff --git a/files/zh-cn/web/api/server-sent_events/using_server-sent_events/index.html b/files/zh-cn/web/api/server-sent_events/using_server-sent_events/index.html index 5665f55722..fe30961b9f 100644 --- a/files/zh-cn/web/api/server-sent_events/using_server-sent_events/index.html +++ b/files/zh-cn/web/api/server-sent_events/using_server-sent_events/index.html @@ -100,7 +100,7 @@ while (true) {

        错误处理

        -

        当发生错误(例如请求超时或与HTTP访问控制(CORS)有关的问题), 会生成一个错误事件. 您可以通过在EventSource对象上使用onerror回调来对此采取措施:

        +

        当发生错误(例如请求超时或与HTTP访问控制(CORS)有关的问题), 会生成一个错误事件. 您可以通过在EventSource对象上使用onerror回调来对此采取措施:

        evtSource.onerror = function(err) {
           console.error("EventSource failed:", err);
        @@ -114,7 +114,7 @@ while (true) {
         
         

        事件流格式

        -

        事件流仅仅是一个简单的文本数据流,文本应该使用 UTF-8 格式的编码.每条消息后面都由一个空行作为分隔符.以冒号开头的行为注释行,会被忽略.

        +

        事件流仅仅是一个简单的文本数据流,文本应该使用 UTF-8 格式的编码.每条消息后面都由一个空行作为分隔符.以冒号开头的行为注释行,会被忽略.

        注:注释行可以用来防止连接超时,服务器可以定期发送一条消息注释行,以保持连接不断.
        diff --git a/files/zh-cn/web/api/streams_api/concepts/index.html b/files/zh-cn/web/api/streams_api/concepts/index.html index a634fb4f07..02fd6a3a82 100644 --- a/files/zh-cn/web/api/streams_api/concepts/index.html +++ b/files/zh-cn/web/api/streams_api/concepts/index.html @@ -22,7 +22,7 @@ original_slug: Web/API/Streams_API/概念
      • Pull sources 需要您在连接到它们后,显式地从它们请求数据。例如通过 Fetch 或 XHR 请求访问一个文件。
      -

      数据被按序读入到许多小块,这些小块被称作 chunkchunk 可以是单个字节,也可以是某种更大的数据类型,例如特定大小的 typed array 。来自一个流的 chunks 可以有不同的大小和类型。

      +

      数据被按序读入到许多小块,这些小块被称作 chunkchunk 可以是单个字节,也可以是某种更大的数据类型,例如特定大小的 typed array 。来自一个流的 chunks 可以有不同的大小和类型。

      diff --git a/files/zh-cn/web/api/stylesheet/disabled/index.html b/files/zh-cn/web/api/stylesheet/disabled/index.html index a18d5f068f..353f423a33 100644 --- a/files/zh-cn/web/api/stylesheet/disabled/index.html +++ b/files/zh-cn/web/api/stylesheet/disabled/index.html @@ -13,7 +13,7 @@ translation_of: Web/API/StyleSheet/disabled
      {{domxref("StyleSheet")}}接口的 disabled 属性用于决定样式表是否被禁用于文档。
      -
      样式表被禁用可能由于这个属性被手动设置为 true,也可能是因为样式表是未激活的alternative style sheet。注意 disabled == false 并不保证样式表一定生效(例如它可能被移除出文档)。
      +
      样式表被禁用可能由于这个属性被手动设置为 true,也可能是因为样式表是未激活的alternative style sheet。注意 disabled == false 并不保证样式表一定生效(例如它可能被移除出文档)。

      语法

      diff --git a/files/zh-cn/web/api/touch/target/index.html b/files/zh-cn/web/api/touch/target/index.html index be815271e8..7abb8b55fb 100644 --- a/files/zh-cn/web/api/touch/target/index.html +++ b/files/zh-cn/web/api/touch/target/index.html @@ -16,7 +16,7 @@ translation_of: Web/API/Touch/target

      概述

      -

      这个属性返回触摸点最初接触的 Element,即使这个触摸点已经移出那个元素的交互区域,甚至移出文档。需要注意的是,如果这个元素在触摸过程中被移除,这个事件仍然会指向它,因此这个事件也不会冒泡到 window 或 document 对象。因此,如果有元素在触摸过程中可能被移除,最佳实践是将触摸事件的监听器绑定到这个元素本身,防止元素被移除后,无法再从它的上一级元素上侦测到从该元素冒泡的事件。

      +

      这个属性返回触摸点最初接触的 Element,即使这个触摸点已经移出那个元素的交互区域,甚至移出文档。需要注意的是,如果这个元素在触摸过程中被移除,这个事件仍然会指向它,因此这个事件也不会冒泡到 window 或 document 对象。因此,如果有元素在触摸过程中可能被移除,最佳实践是将触摸事件的监听器绑定到这个元素本身,防止元素被移除后,无法再从它的上一级元素上侦测到从该元素冒泡的事件。

      语法

      diff --git a/files/zh-cn/web/api/url/index.html b/files/zh-cn/web/api/url/index.html index ef89407946..36ad901d75 100644 --- a/files/zh-cn/web/api/url/index.html +++ b/files/zh-cn/web/api/url/index.html @@ -131,8 +131,8 @@ console.log(parsedUrl.searchParams.get("id")); // "123"

      相关链接

      diff --git a/files/zh-cn/web/api/url/password/index.html b/files/zh-cn/web/api/url/password/index.html index 5490343afd..eb9989246a 100644 --- a/files/zh-cn/web/api/url/password/index.html +++ b/files/zh-cn/web/api/url/password/index.html @@ -8,7 +8,7 @@ original_slug: Web/API/URL/密码

       {{domxref("URL")}}接口的password属性为{{domxref("USVString")}},其中包含在域名之前指定的密码。

      -

      如果在未设置username属性的情况下进行调用,默认失败。

      +

      如果在未设置username属性的情况下进行调用,默认失败。

      {{AvailableInWorkers}}

      diff --git a/files/zh-cn/web/api/url_api/index.html b/files/zh-cn/web/api/url_api/index.html index f138baa59a..0e3e4a8d63 100644 --- a/files/zh-cn/web/api/url_api/index.html +++ b/files/zh-cn/web/api/url_api/index.html @@ -56,8 +56,8 @@ try { diff --git a/files/zh-cn/web/api/validitystate/index.html b/files/zh-cn/web/api/validitystate/index.html index 4fc6e0d3ef..64c560e215 100644 --- a/files/zh-cn/web/api/validitystate/index.html +++ b/files/zh-cn/web/api/validitystate/index.html @@ -83,6 +83,6 @@ translation_of: Web/API/ValidityState

      参见

      diff --git a/files/zh-cn/web/api/visualviewport/index.html b/files/zh-cn/web/api/visualviewport/index.html index e07f4aa91d..da9f74123e 100644 --- a/files/zh-cn/web/api/visualviewport/index.html +++ b/files/zh-cn/web/api/visualviewport/index.html @@ -15,7 +15,7 @@ translation_of: Web/API/VisualViewport ---

      {{SeeCompatTable}}{{APIRef("Visual Viewport")}}

      -

       Visual Viewport API 提供了当前页面的视觉视口接口,即 VisualViewport 。对于每个页面容器来说(如 iframe),都存在有一个独立的 window 对象。每个页面容器的 window 对象都有一个独立的 VisualViewport 属性。

      +

       Visual Viewport API 提供了当前页面的视觉视口接口,即 VisualViewport 。对于每个页面容器来说(如 iframe),都存在有一个独立的 window 对象。每个页面容器的 window 对象都有一个独立的 VisualViewport 属性。

      你可以使用 {{domxref("Window.visualViewport")}} 获得对应 window 的视觉视口 API。

      @@ -46,13 +46,13 @@ translation_of: Web/API/VisualViewport

      Events

      -

      通过使用 addEventListener() 或者将监听回调函数赋值给对应的 oneventname 属性,可以为对应的视口事件添加监听。

      +

      通过使用 addEventListener() 或者将监听回调函数赋值给对应的 oneventname 属性,可以为对应的视口事件添加监听。

      -
      resize
      +
      resize
      当视觉视口被改变时触发。
      也可以为 {{domxref("VisualViewport.onresize")}} 属性赋值来添加监听。
      -
      scroll
      +
      scroll
      当视觉视口滑动时触发。
      也可以为 {{domxref("VisualViewport.onscroll")}} 属性赋值来添加监听。
      diff --git a/files/zh-cn/web/api/webgl_api/index.html b/files/zh-cn/web/api/webgl_api/index.html index ed1f1dede2..a9ec0c7ec2 100644 --- a/files/zh-cn/web/api/webgl_api/index.html +++ b/files/zh-cn/web/api/webgl_api/index.html @@ -21,7 +21,7 @@ translation_of: Web/API/WebGL_API

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

      -

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

      +

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

      参考

      @@ -149,7 +149,7 @@ translation_of: Web/API/WebGL_API
      一个基础的 WebGL 的 2D 动画示例
      此示例演示了单色形状的简单动画。检查的主题是适应宽高比差异,从多个着色器集合构建着色器程序的功能,以及 WebGL 绘图的基础知识。
      -
      WebGL示例
      +
      WebGL示例
      一系列带有简短说明的实时示例展示了WebGL的概念和功能。根据主题和难易程度对示例进行了排序,涵盖了WebGL渲染上下文,着色器编程,纹理,几何图形,用户交互等。
      diff --git a/files/zh-cn/web/api/webglrenderingcontext/createrenderbuffer/index.html b/files/zh-cn/web/api/webglrenderingcontext/createrenderbuffer/index.html index 11599ea586..86370b0652 100644 --- a/files/zh-cn/web/api/webglrenderingcontext/createrenderbuffer/index.html +++ b/files/zh-cn/web/api/webglrenderingcontext/createrenderbuffer/index.html @@ -5,7 +5,7 @@ translation_of: Web/API/WebGLRenderingContext/createRenderbuffer ---
      {{APIRef("WebGL")}}
      -

      WebGL APIWebGLRenderingContext.createRenderbuffer() 方法 创建并初始化一个 {{domxref("WebGLRenderbuffer")}} 对象。

      +

      WebGL APIWebGLRenderingContext.createRenderbuffer() 方法 创建并初始化一个 {{domxref("WebGLRenderbuffer")}} 对象。

      语法

      diff --git a/files/zh-cn/web/api/webrtc_api/taking_still_photos/index.html b/files/zh-cn/web/api/webrtc_api/taking_still_photos/index.html index c8fc957a8b..470f3dcd1d 100644 --- a/files/zh-cn/web/api/webrtc_api/taking_still_photos/index.html +++ b/files/zh-cn/web/api/webrtc_api/taking_still_photos/index.html @@ -114,13 +114,13 @@ translation_of: Web/API/WebRTC_API/Taking_still_photos

      成功回调接收一个 stream 对象作为输入。它是新视频的 {{HTMLElement("video")}} 元素的源。

      -

      一旦流被链接到 {{HTMLElement("video")}} 元素,我们通过调用 HTMLMediaElement.play() 开始播放。

      +

      一旦流被链接到 {{HTMLElement("video")}} 元素,我们通过调用 HTMLMediaElement.play() 开始播放。

      如果打开流失败,则调用失败回调函数。 在没有连接兼容的相机,或者用户拒绝访问时,则会发生这种情况。

      监听视频开始播放

      -

      在 {{HTMLElement("video")}} 上调用 HTMLMediaElement.play() 之后,在视频流开始流动之前,有一段(希望简短)的时间段过去了。 为了避免在此之前一直阻塞,我们为 {{HTMLElement("video")}} 加上一个 {{event("canplay")}} 事件的监听器,当视频播放实际开始时会触发该事件。 那时,视频对象中的所有属性都已基于流的格式进行配置。

      +

      在 {{HTMLElement("video")}} 上调用 HTMLMediaElement.play() 之后,在视频流开始流动之前,有一段(希望简短)的时间段过去了。 为了避免在此之前一直阻塞,我们为 {{HTMLElement("video")}} 加上一个 {{event("canplay")}} 事件的监听器,当视频播放实际开始时会触发该事件。 那时,视频对象中的所有属性都已基于流的格式进行配置。

          video.addEventListener('canplay', function(ev){
             if (!streaming) {
      diff --git a/files/zh-cn/web/api/window/beforeunload_event/index.html b/files/zh-cn/web/api/window/beforeunload_event/index.html
      index f582257cb1..08deab442d 100644
      --- a/files/zh-cn/web/api/window/beforeunload_event/index.html
      +++ b/files/zh-cn/web/api/window/beforeunload_event/index.html
      @@ -50,7 +50,7 @@ original_slug: Web/Events/beforeunload
       
       

      为避免意外弹出窗口,除非页面已与之交互,否则浏览器可能不会显示在beforeunload事件中创建的提示,甚至根本不会显示它们。

      -

      将事件处理程序/监听器加到window或 documentbeforeunload事件后,将阻止浏览器使用内存中的页面导航缓存,例如Firefox的Back-Forward缓存WebKit的Page Cache

      +

      将事件处理程序/监听器加到window或 documentbeforeunload事件后,将阻止浏览器使用内存中的页面导航缓存,例如Firefox的Back-Forward缓存WebKit的Page Cache

      HTML规范指出在此事件中调用{{domxref("window.alert()")}},{{domxref("window.confirm()")}}以及{{domxref("window.prompt()")}}方法,可能会失效。更多详细信息,请参见HTML规范

      diff --git a/files/zh-cn/web/api/window/devicepixelratio/index.html b/files/zh-cn/web/api/window/devicepixelratio/index.html index a5976667d9..aba68dcdf8 100644 --- a/files/zh-cn/web/api/window/devicepixelratio/index.html +++ b/files/zh-cn/web/api/window/devicepixelratio/index.html @@ -172,8 +172,8 @@ matchMedia(mqString).addListener(updatePixelRatio);

      参见

      diff --git a/files/zh-cn/web/api/window/getselection/index.html b/files/zh-cn/web/api/window/getselection/index.html index 825ee1787d..fcaf9bf733 100644 --- a/files/zh-cn/web/api/window/getselection/index.html +++ b/files/zh-cn/web/api/window/getselection/index.html @@ -48,7 +48,7 @@ translation_of: Web/API/Window/getSelection

      值得注意的是,目前在Firefox, Edge (非 Chromium 版本) 及 Internet Explorer 中,getSelection() 对 {{htmlelement("textarea")}} 及 {{htmlelement("input")}} 元素不起作用。 {{domxref("HTMLInputElement.setSelectionRange()")}} 或 selectionStart 及 selectionEnd 属性可用于解决此问题。

      -

      还要注意选择不同于焦点(详见 Selection 及输入焦点)。可使用{{domxref("Document.activeElement")}} 来返回当前的焦点元素.

      +

      还要注意选择不同于焦点(详见 Selection 及输入焦点)。可使用{{domxref("Document.activeElement")}} 来返回当前的焦点元素.

      浏览器兼容性

      diff --git a/files/zh-cn/web/api/window/requestidlecallback/index.html b/files/zh-cn/web/api/window/requestidlecallback/index.html index dc36051a1f..0632e3a3ce 100644 --- a/files/zh-cn/web/api/window/requestidlecallback/index.html +++ b/files/zh-cn/web/api/window/requestidlecallback/index.html @@ -42,7 +42,7 @@ translation_of: Web/API/Window/requestIdleCallback

      Example

      -

      See our complete example in the article Cooperative Scheduling of Background Tasks API.

      +

      See our complete example in the article Cooperative Scheduling of Background Tasks API.

      规范

      diff --git a/files/zh-cn/web/api/windoweventhandlers/onunload/index.html b/files/zh-cn/web/api/windoweventhandlers/onunload/index.html index 4d72f33a18..b4ef99f0cf 100644 --- a/files/zh-cn/web/api/windoweventhandlers/onunload/index.html +++ b/files/zh-cn/web/api/windoweventhandlers/onunload/index.html @@ -15,7 +15,7 @@ original_slug: Web/API/Window/onunload
      -

      onunload 特性(乃至 unload 事件本身) 并非使用 sendBeacon()的正确途径,要调用 sendBeacon() 接口,应当使用 visibilitychange 和 pagehide 事件。 参见 Beacon API is broken

      +

      onunload 特性(乃至 unload 事件本身) 并非使用 sendBeacon()的正确途径,要调用 sendBeacon() 接口,应当使用 visibilitychange 和 pagehide 事件。 参见 Beacon API is broken

      语法

      diff --git a/files/zh-cn/web/api/worker/index.html b/files/zh-cn/web/api/worker/index.html index 552a122239..24d6bbc738 100644 --- a/files/zh-cn/web/api/worker/index.html +++ b/files/zh-cn/web/api/worker/index.html @@ -10,19 +10,19 @@ translation_of: Web/API/Worker

      Worker 接口是 Web Workers API 的一部分,指的是一种可由脚本创建的后台任务,任务执行中可以向其创建者收发信息。要创建一个 Worker只须调用 Worker(URL) 构造函数,函数参数 `URL` 为指定的脚本。

      -

      Worker 也可以创建新的 Worker,当然,所有 Worker 必须与其创建者同源(注意:Blink暂时不支持嵌套 Worker)。 

      +

      Worker 也可以创建新的 Worker,当然,所有 Worker 必须与其创建者同源(注意:Blink暂时不支持嵌套 Worker)。 

      需要注意的是,不是所有函数和构造函数(或者说…类)都可以在 Worker 中使用。具体参考页面 Worker 所支持的函数和类。Worker 可以使用 XMLHttpRequest 发送请求,但是请求的  responseXML 与 channel 两个属性值始终返回 null (fetch 仍可正常使用,没有类似的限制)。 

      -

       如果你要在火狐浏览器的扩展使用 Worker 访问 js-ctypes,应使用 {{ domxref("ChromeWorker") }} 对象来替代。(译者注:这里没有看懂,希望有人能驳正,或添加说明)

      +

       如果你要在火狐浏览器的扩展使用 Worker 访问 js-ctypes,应使用 {{ domxref("ChromeWorker") }} 对象来替代。(译者注:这里没有看懂,希望有人能驳正,或添加说明)

      构造函数

      {{domxref("Worker.Worker", "Worker()")}}
      -
      创建一个专用Web worker,它只执行URL指定的脚本。使用 Blob URL 作为参数亦可。
      +
      创建一个专用Web worker,它只执行URL指定的脚本。使用 Blob URL 作为参数亦可。

      属性

      diff --git a/files/zh-cn/web/api/xmlhttprequest/getresponseheader/index.html b/files/zh-cn/web/api/xmlhttprequest/getresponseheader/index.html index e447182f2b..fe2e66b3c0 100644 --- a/files/zh-cn/web/api/xmlhttprequest/getresponseheader/index.html +++ b/files/zh-cn/web/api/xmlhttprequest/getresponseheader/index.html @@ -134,7 +134,7 @@ client.onreadystatechange = function() {//设定侦听器onreadystatechange。
      • 如何使用XMLHttpRequest
      • -
      • HTTP headers
      • +
      • HTTP headers
      • {{DOMxRef("XMLHttpRequest.getAllResponseHeaders", "getAllResponseHeaders()")}}
      • {{DOMxRef("XMLHttpRequest.response", "response")}}
      • 设置请求头: {{DOMxRef("XMLHttpRequest.setRequestHeader", "setRequestHeader()")}}
      • -- cgit v1.2.3-54-g00ecf