From b3d1ed70cbc7136a6840e9fd4bfeb9f552711b7c Mon Sep 17 00:00:00 2001 From: Jabriel <15688641+jukrb0x@users.noreply.github.com> Date: Tue, 10 Aug 2021 22:26:48 +0800 Subject: Fix mistranslation in Web/JavaScript/Reference/Strict_mode, zh-CN (#1995) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix typo 显示 to 显式 and remove unnecessary space * fix incorrect translation implicitly opting-out: **隐式**地脱离/隐式地退出 - 显示: display - 显式: explicit - 隐式: implicit --- files/zh-cn/web/javascript/reference/strict_mode/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'files/zh-cn') diff --git a/files/zh-cn/web/javascript/reference/strict_mode/index.html b/files/zh-cn/web/javascript/reference/strict_mode/index.html index 4f48146e49..0d9066e644 100644 --- a/files/zh-cn/web/javascript/reference/strict_mode/index.html +++ b/files/zh-cn/web/javascript/reference/strict_mode/index.html @@ -11,7 +11,7 @@ translation_of: Web/JavaScript/Reference/Strict_mode
如果遇到网络故障,{{domxref("GlobalFetch.fetch","fetch()")}} promise 将会 reject,带上一个 {{jsxref("TypeError")}} 对象。虽然这个情况经常是遇到了权限问题或类似问题——比如 404 不是一个网络故障。想要精确的判断 fetch()
是否成功,需要包含 promise resolved 的情况,此时再判断 {{domxref("Response.ok")}} 是不是为 true。类似以下代码:
如果遇到网络故障或服务端的 CORS 配置错误时,{{domxref("GlobalFetch.fetch","fetch()")}} promise 将会 reject,带上一个 {{jsxref("TypeError")}} 对象。虽然这个情况经常是遇到了权限问题或类似问题——比如 404 不是一个网络故障。想要精确的判断 fetch()
是否成功,需要包含 promise resolved 的情况,此时再判断 {{domxref("Response.ok")}} 是不是为 true。类似以下代码:
fetch('flowers.jpg').then(function(response) { if(response.ok) { -- cgit v1.2.3-54-g00ecf From 4420fe37e4677009eb5376d1a64a68945fd7dd8d Mon Sep 17 00:00:00 2001 From: zhyaoangDate: Tue, 10 Aug 2021 22:34:32 +0800 Subject: Update Web/API/Document/execCommand, zh-CN (#2001) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 仅IE浏览器支持的AutoUrlDetect --- files/zh-cn/web/api/document/execcommand/index.html | 2 ++ 1 file changed, 2 insertions(+) (limited to 'files/zh-cn') diff --git a/files/zh-cn/web/api/document/execcommand/index.html b/files/zh-cn/web/api/document/execcommand/index.html index 95624325e6..355a4bd33f 100644 --- a/files/zh-cn/web/api/document/execcommand/index.html +++ b/files/zh-cn/web/api/document/execcommand/index.html @@ -138,6 +138,8 @@ translation_of: Web/API/Document/execCommand 该属性已经废弃,使用 styleWithCSS 代替。 styleWithCSS
用这个取代 useCSS 命令。 参数如预期的那样工作, i.e. true modifies/generates 风格的标记属性, false 生成格式化元素。 ++ AutoUrlDetect
更改浏览器自动链接行为(仅IE浏览器支持) 示例
-- cgit v1.2.3-54-g00ecf From bb34d2a08f28118334cb0d41ce53095db72862e0 Mon Sep 17 00:00:00 2001 From: JJ <307400468@qq.com> Date: Wed, 11 Aug 2021 19:17:27 +0800 Subject: Update files/zh-cn/web/css/vertical-align/index.html (#2015) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原句中「用于垂直对齐一行文本的内的图片」中第一个「的」字应删去 --- files/zh-cn/web/css/vertical-align/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'files/zh-cn') diff --git a/files/zh-cn/web/css/vertical-align/index.html b/files/zh-cn/web/css/vertical-align/index.html index df895fe1cb..eacb94adfc 100644 --- a/files/zh-cn/web/css/vertical-align/index.html +++ b/files/zh-cn/web/css/vertical-align/index.html @@ -18,7 +18,7 @@ translation_of: Web/CSS/vertical-alignvertical-align属性可被用于两种环境:
-
- 使行内元素盒模型与其行内元素容器垂直对齐。例如,用于垂直对齐一行文本的内的图片{{HTMLElement("img")}}:
+- 使行内元素盒模型与其行内元素容器垂直对齐。例如,用于垂直对齐一行文本内的图片{{HTMLElement("img")}}:
-- cgit v1.2.3-54-g00ecf From 06b1b9f137e15e0d78de6b372971a3926403650c Mon Sep 17 00:00:00 2001 From: PocketZ <45301505+pocketdr@users.noreply.github.com> Date: Thu, 12 Aug 2021 12:18:20 +0800 Subject: Update MDN/Structures/Macros and MDN/Yari of l10n-zh (#2024) * Create MDN/Tools/KumaScript * Create MDN/Tools/KumaScript/Troubleshooting * Create MDN/Tools/KumaScript * Create MDN/Tools/KumaScript/Troubleshooting * Update MDN/Structures/Macros * Update MDN/Yari * Update content of Macros and KumaScript * delete no translated articel --- files/zh-cn/mdn/structures/macros/index.html | 34 ++++---- files/zh-cn/mdn/structures/macros/other/index.html | 92 ++++++++++++++++++++++ files/zh-cn/mdn/yari/index.html | 1 - files/zh-tw/mdn/yari/index.html | 24 +++--- 4 files changed, 118 insertions(+), 33 deletions(-) create mode 100644 files/zh-cn/mdn/structures/macros/other/index.html (limited to 'files/zh-cn') diff --git a/files/zh-cn/mdn/structures/macros/index.html b/files/zh-cn/mdn/structures/macros/index.html index b41123ab3f..4227374bac 100644 --- a/files/zh-cn/mdn/structures/macros/index.html +++ b/files/zh-cn/mdn/structures/macros/index.html @@ -1,5 +1,5 @@ --- -title: Macros +title: 使用宏 slug: MDN/Structures/Macros tags: - Guide @@ -11,36 +11,32 @@ translation_of: MDN/Structures/Macros ---{{MDNSidebar}}-Kuma 平台为 MDN 提供了强大的宏系统——KumaScript,使得 MDN 能够自动地去做各种东西。本文提供一些信息以便大家知道如何使用 MDN 上的文章内的宏。
+为了自动化执行某些工作,Yari 平台提供了一个强大的宏系统——KumaScript。本文提供了一些相关信息,方便你在参与编辑 MDN 时,使用这些宏。
-鉴于本文只是 KumaScript 的简介,KumaScript 指南提供了更深入的内容。
+本文只是简要介绍了 KumaScript,KumaScript 指南提供了更深入的内容,帮助你使用和掌握它。
-宏是如何实现的
+宏是如何实现的
-MDN使用的Macros(宏)是基于Node.js执行环境,并在服务端执行运行。这里包括了大量的代码库,另外对此还提供了丰富的wiki说明文档内容。如果你希望能学习到更多的内容,可以查看 KumaScript 指南, KumaScript reference 则提供了更多关于这些代码库和KumaScript的API的实现机理。
+MDN 使用宏是基于运行于服务器上的 JavaScript 代码实现的,并由 Node.js 解释执行。在此之上,已经实现了一个丰富的工具库,让宏可以与这个平台及其中的内容进行互动。
-在文章中使用宏
+在文章中使用宏
-要实际使用宏,只需将对宏的调用括在一对双括号中,其参数(如果有)括在括号中;如下:
+要实际使用宏,只需将对宏的调用和可能需要的参数写在一对双括号中,如下:
\{{macroname(parameter-list)}}关于宏调用的一些注意事项:
-
-- 宏名称区分大小写,但有些尝试是为了纠正常见的大写错误;即使宏名称在其中使用大写,您也可以使用全部小写,并且您可以将名称通常以小写字母开头的宏大写。
-- 参数以逗号分隔
-- 如果没有参数,您可以完全省略括号;
-\{{macroname()}}
和\{{macroname}}
完全相同。- 数字参数可以是引号,也可以不是。这取决于您(但是,如果您的版本号中包含多个小数,则需要在引号中)
-- 如果您遇到错误,请仔细检查您的代码。如果仍然无法弄清楚发生了什么,请参阅Troubleshooting KumaScript errors以获取帮助。
+- 宏的名称区分大小写,但一些常见的大小写错误也可以在执行时被纠正。比如将某个名称中含有大写的宏,全部使用小写字母,或者将某些名字以小写开头的宏大写。
+- 参数以逗号分隔。
+- 如果没有参数,括号可以省略:
+\{{macroname()}}
和\{{macroname}}
的效果是。- 数字参数可以是引号,也可以不是。这取决于您(但是,像版本号这类可能被识别成小数的参数,则包含在引号中)
+- 如果遇到错误,请先仔细检查代码。如果仍然无法弄清楚发生了什么,请参阅排查 KumaScript 中的错误以获取帮助。
宏被高度缓存;对于任何一组输入值(参数和环境值,例如运行宏的URL),结果都会被存储和重用。这意味着宏仅在输入发生变化时才实际运行。
+宏的几乎所有执行结果都会被缓存,以便被重用来加快执行速度。这意味着宏仅在输入发生变化时才实际运行,包括调用时的参数以及环境值(例如这个宏被调用时所在的路径)。
--+注意: 您可以通过在浏览器中强制刷新页面(即转移重新加载)来强制重新评估页面上的所有宏。
-宏既可以用来做一些简单的工作,比如插入更大的文本块或从MDN的另一部分交换内容一样简单,也可以通过搜索站点的各个部分,设置输出样式和添加链接来构建整个内容索引。
-宏可以像插入更大的文本块或从MDN的另一部分交换内容一样简单,也可以通过搜索站点的各个部分,设置输出样式和添加链接来构建整个内容索引。
- -您可以在Commonly-used macros页面上阅读我们最常用的宏;另外,这里有complete list of all macros。大多数宏都有内置的文档,作为顶部的注释。
+您可以在常用的宏页面看到一些我们最常用到的宏,还可以在我们 Github 的仓库中,浏览所有可用的宏。大多数宏顶部的注释中,都有内置的文档帮助你了解它的作用。
diff --git a/files/zh-cn/mdn/structures/macros/other/index.html b/files/zh-cn/mdn/structures/macros/other/index.html new file mode 100644 index 0000000000..d9dd6f2ea3 --- /dev/null +++ b/files/zh-cn/mdn/structures/macros/other/index.html @@ -0,0 +1,92 @@ +--- +title: 其他需要注意的宏 +slug: MDN/Structures/Macros/Other +tags: + - Macros + - Reference +--- +{{MDNSidebar}}+ +In contrast to the macros listed in Commonly-used macros, the macros documented in this article are used infrequently or only in specific contexts, or are deprecated.
+ +Special contexts
+ +These macros are used only with particular contexts, such as a specific API reference.
+ ++
+ +- +
Interwiki
makes it easy to create interwiki links. Currently it supports linking to Wikipedia and Wikimo. The first parameter is the name of the wiki ("wikipedia" or "wikimo"), and the second is the path of the article. For example,\{\{interwiki("wikipedia", "Firefox")\}\}
shows up as {{ interwiki("wikipedia", "Firefox") }}. This template auto-detects the page language and directs to the same language on Wikipedia, for example.- +
RFC
creates a link to the specified RFC, given its number. The syntax is:\{\{RFC(number)\}\}
. For example,\{\{RFC(2616)\}\}
becomes {{ RFC(2616) }}.- The
+anch
macro inserts a link to an anchor.\{\{Anch("top")\}\}
produces<a href="#top">top</a>
({{ Anch("top") }}). You can also add a second parameter which contains replacement text to display as the link text.Landing page components
+ +We have an assortment of macros that can be used to automatically generate the contents of landing pages. Here they are.
+ +Lists of subpages
+ ++
+ +- +
ListSubpages
generates an unordered list of links to all the immediate children of the current page; useful for automatically generating tables of contents for sets of documentation.- +
LandingPageListSubpages
outputs a two-column definition list of all immediate subpages of the current page, with their titles as the {{HTMLElement("dt")}} and their SEO summary as the {{HTMLElement("dd")}}. This makes it easy to automatically generate reasonably attractive landing pages.- +
NavListWithPrioritizedPages
generates an ordered list formatted properly for use in a zone navigation sidebar (or quicklinks). As input, you can specify zero or more page slugs that should be pulled out of the main list and instead inserted at the top of the list, in the given order. All remaining pages are placed in the list alphabetically. One level of subpages is included.- +
APIListAlpha
builds a list of the current page's subpages, formatted as a list of API terms, divided up by first letter. There are three parameters. The first is 0 if you want to include all top-level subpages or 1 to leave out subpages with "." in their names. The second and third let you add text to display as part of the name in each link. This can be used to add "<" and ">" for element links, or to add "()" at the end of lists of method names.- +
SubpagesWithSummaries
constructs a definition list of all the immediate children of the current page. There is no other formatting done. You can get a two-column list ready for use as a multi-column landing page usingLandingPageListSubpages
.Quicklinks
+ +We have some macros specifically designed to create quicklinks:
+ ++
+ +- The
+MakeSimpleQuicklinks
macro creates a flat list of links in the quicklinks box. Give it a set of paths to destination pages as its input arguments. Each link's text is the page title, and each link has a tooltip derived from the page summary.- +
QuickLinksWithSubpages
creates a set of quicklinks comprised of the pages below the current page (or specified page, if one is given). Up to two total levels of depth are generated.Transclusion
+ +Transclusion is the embedding of part or all of one page into another. Exercise caution when using this macro, to ensure that the transcluded content makes sense in the context of the page it is embedded into.
+ ++ +
page
lets you embed some or all of a specific page into a document. It accepts five parameters:+
+ +- The URI of the page to transclude. For example, "/en-US/docs/MDN/About".
+- The name of the section within the page to transclude. This can be specified either as the title string or as the ID of a block to copy over. If not specified, the entire article is transcluded. {{optional_inline}}
+- The revision number of the page version to transclude. This feature is not currently implemented, but would allow including text from specific versions of an article. {{unimplemented_inline}}
+- A Boolean value indicating whether or not to show the heading of the top-level section being transcluded. This is useful if you wish to specify your own heading. The default value is false, meaning the heading is not included by default. {{optional_inline}}
+- The heading level to use as the top heading level. This adjusts the outermost first-discovered level of the transcluded content to the specified number, and all other headings correspondingly. This lets you include content that has its own headings but adjust them to match the heading level at which you're including them. If you don't specify this value, the headings are not adjusted. {{unimplemented_inline}}
+Example without heading
+ +\{{Page("/en-US/docs/MDN/About", "How you can help")}}
+ +Result:
+ +{{Page("/en-US/docs/MDN/About", "How you can help")}}
+ +Example with heading
+ +\{{Page("/en-US/docs/MDN/About", "How you can help", 0, 1)}}
+ +Result:
+ +{{Page("/en-US/docs/MDN/About", "How you can help", 0, 1)}}
+ +Deprecated
+ +These macros have been replace by other ways of doing the same thing, and should no longer be used. If you find them in existing articles, please replace them.
+ +Linking
+ ++ +
diff --git a/files/zh-cn/mdn/yari/index.html b/files/zh-cn/mdn/yari/index.html index c48e06b138..07b623bec6 100644 --- a/files/zh-cn/mdn/yari/index.html +++ b/files/zh-cn/mdn/yari/index.html @@ -5,7 +5,6 @@ tags: - Yari - Landing - MDN Meta -translation_of: MDN/Yari ---- The
+SectionOnPage
macro creates a phrase that links to both the name of a section and the article containing that section. For example,\{{SectionOnPage("/en-US/docs/Mozilla/Firefox/Releases/21", "Changes for Web developers")}}
outputs the following: {{SectionOnPage("/en-US/docs/Mozilla/Firefox/Releases/21", "Changes for Web developers")}}.- The
+manch
inserts a link to a method within the current interface; this is intended only for use in interface documentation pages.\{\{manch("foo")\}\}
produces<code><a href="current/path#foo">foo()</a></code>
({{ manch("foo") }}).- The
+Link
macro inserts a link to the specified page on MDN, using the page's title as the visible string to click on, and the tooltip picked up from the page's SEO summary.- The
+LinkItem
macro inserts a link to a specified URL, with the indicated text as the visible string to click on. The link automatically picks up as its tooltip the summary of the target page. This differs fromLink
in that you must specify the title.- The
+LinkItemDL
macro inserts a link to a specified URL, with the indicated text as a {{HTMLElement("dt")}} which is also the link. The {{HTMLElement("dd")}} element contains the specified page's summary.- +
funcref
creates links to global functions (usually C++) documented on top-level pages. However, such pages are no longer created at the top-level of MDN.- +
source
allows you to link to a Mozilla source code file without having to type a long MXR URL using this syntax:\{\{Source("browser/Makefile.in")\}\}
. This gives you: {{ Source("browser/Makefile.in") }}. The text of the link is the path provided; if you want different text, then just provide a second parameter, like so:\{\{Source("browser/Makefile.in", "the browser/ Makefile.in")\}\}
, which produces {{ Source("browser/Makefile.in", "the browser/ Makefile.in") }}. Note that the link will be to the very latest version of the file in bleeding-edge code.- +
Source_cvs
works just likesource
, except it links to the CVS repository instead of the newer mozilla-central one.- +
LXRSearch
can be used to create an LXR search URL.{{MDNSidebar}}diff --git a/files/zh-tw/mdn/yari/index.html b/files/zh-tw/mdn/yari/index.html index 5d3587a166..07b623bec6 100644 --- a/files/zh-tw/mdn/yari/index.html +++ b/files/zh-tw/mdn/yari/index.html @@ -1,27 +1,25 @@ --- -title: 'Kuma: MDN 的維基平台' +title: "Yari: MDN's rendering platform" slug: MDN/Yari tags: - - Kuma + - Yari - Landing - MDN Meta -translation_of: MDN/Kuma -original_slug: MDN/Kuma ---{{MDNSidebar}}-{{IncludeSubnav("/zh-TW/docs/MDN")}}+Yari is the code that renders MDN Web Docs. It takes a JAMStack approach, which involves taking the MDN content stored as flat source files in a GitHub repo (which include front matter and macro calls), rendering them out to static HTML files, and serving those as quickly and efficiently as possible.
-Kuma 是由 MDN Web Docs 維護的 Django 程式碼。
+The core MDN platform now actually consists of two GitHub repos:
-{{SubpagesWithSummaries}}
- -參與 Kuma
++
-- The MDN content repo — this is where the MDN content is stored, along with information such as contributor history and redirects. Visit this repo if you want to contribute to the MDN content.
+- The Yari project — this is the platform code that renders and displays the MDN content, and deals with associated services such as user accounts. Visit this repo if you want to contribute to the MDN platform.
+要參與 Kuma:
+See also
-
-- cgit v1.2.3-54-g00ecf From 9c7081d94a149ed22801e7b7df8ccd2cfbf81225 Mon Sep 17 00:00:00 2001 From: Genitana <24569873+Genitana@users.noreply.github.com> Date: Thu, 12 Aug 2021 12:26:49 +0800 Subject: Update index.html (#2030) make 'timeout' More clear --- files/zh-cn/web/api/window/requestidlecallback/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'files/zh-cn') diff --git a/files/zh-cn/web/api/window/requestidlecallback/index.html b/files/zh-cn/web/api/window/requestidlecallback/index.html index 0632e3a3ce..667133cf18 100644 --- a/files/zh-cn/web/api/window/requestidlecallback/index.html +++ b/files/zh-cn/web/api/window/requestidlecallback/index.html @@ -35,7 +35,7 @@ translation_of: Web/API/Window/requestIdleCallback- 訪問一下 Github 的 Kuma 專案。
-- 去看一下貢獻指引。
-- 需要的話,深入探索Kuma 的完整文件。
+- MDN Web Docs evolves! Lowdown on the upcoming new platform — explanation of the need for a platform change, and the new architecture.
+- As needed, take a deep dive into the Welcome Yari: MDN Web Docs has a new platform — formal announcement of the new platform launch.
options
{{optional_inline}}包括可选的配置参数。具有如下属性: -- cgit v1.2.3-54-g00ecf From 013fe2609de0c3ec8745db6574c3be65a9f0046b Mon Sep 17 00:00:00 2001 From: hspn-
- +
timeout
:如果指定了timeout并具有一个正值,并且尚未通过超时毫秒数调用回调,那么回调会在下一次空闲时期被强制执行,尽管这样很可能会对性能造成负面影响。timeout
: 如果指定了timeout,并且有一个正值,而回调在timeout毫秒过后还没有被调用,那么回调任务将放入事件循环中排队,即使这样做有可能对性能产生负面影响。Date: Thu, 12 Aug 2021 12:32:50 +0800 Subject: fixing translation problem (#1870) --- files/zh-cn/web/api/web_workers_api/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'files/zh-cn') diff --git a/files/zh-cn/web/api/web_workers_api/index.html b/files/zh-cn/web/api/web_workers_api/index.html index d9ee40bbaa..ffc27215d7 100644 --- a/files/zh-cn/web/api/web_workers_api/index.html +++ b/files/zh-cn/web/api/web_workers_api/index.html @@ -18,7 +18,7 @@ translation_of: Web/API/Web_Workers_API 使用构造函数(例如,{{domxref("Worker.Worker", "Worker()")}})创建一个 worker 对象, 构造函数接受一个 JavaScript文件URL — 这个文件包含了将在 worker 线程中运行的代码。worker 将运行在与当前 {{domxref("window")}}不同的另一个全局上下文中,这个上下文由一个对象表示,标准情况下为{{domxref("DedicatedWorkerGlobalScope")}} (标准 workers 由单个脚本使用; 共享workers使用{{domxref("SharedWorkerGlobalScope")}})。
-你可以在worker 线程中运行任意的代码,但注意存在一些例外:直接在 worker 线程中操纵 DOM 元素;或使用{{domxref("window")}} 对象中的某些方法和属性。大部分 window 对象的方法和属性是可以使用的,包括 WebSockets,以及诸如 IndexedDB 和 FireFox OS 中独有的 Data Store API 这一类数据存储机制。更多信息请参见: Functions and classes available to workers 。
+你可以在worker 线程中运行任意的代码,但注意存在一些例外:你不能直接在 worker 线程中操纵 DOM 元素;或使用{{domxref("window")}} 对象中的某些方法和属性。大部分 window 对象的方法和属性是可以使用的,包括 WebSockets,以及诸如 IndexedDB 和 FireFox OS 中独有的 Data Store API 这一类数据存储机制。更多信息请参见: Functions and classes available to workers 。
主线程和 worker 线程相互之间使用
-- cgit v1.2.3-54-g00ecf From 90c5bda4bde106ac7bb477393e03c9df85f44406 Mon Sep 17 00:00:00 2001 From: GuanCun <37606400+GuanCun@users.noreply.github.com> Date: Thu, 12 Aug 2021 22:08:48 +0800 Subject: Fix typo in Web/JavaScript/Reference/Global_Objects/encodeURIComponent, zh-CN (#2033) This is a translation error. --- .../javascript/reference/global_objects/encodeuricomponent/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'files/zh-cn') diff --git a/files/zh-cn/web/javascript/reference/global_objects/encodeuricomponent/index.html b/files/zh-cn/web/javascript/reference/global_objects/encodeuricomponent/index.html index be7f03a446..dc3f9a00a2 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/encodeuricomponent/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/encodeuricomponent/index.html @@ -89,7 +89,7 @@ console.log(header); function encodeRFC5987ValueChars (str) { return encodeURIComponent(str). - // 注意,仅管 RFC3986 保留 "!",但 RFC5987 并没有 + // 注意,尽管 RFC3986 保留 "!",但 RFC5987 并没有 // 所以我们并不需要过滤它 replace(/['()]/g, escape). // i.e., %27 %28 %29 replace(/\*/g, '%2A'). -- cgit v1.2.3-54-g00ecf From e9170e87569188e45adab3a8d933b155c2165c47 Mon Sep 17 00:00:00 2001 From: meowmeowmeowcatpostMessage()
方法来发送信息, 并且通过onmessage
这个 event handler来接收信息(传递的信息包含在 {{event("Message")}} 这个事件的data
属性内) 。数据的交互方式为传递副本,而不是直接共享数据。Date: Thu, 12 Aug 2021 22:11:06 +0800 Subject: Fix typo in Web/API/Web_Workers_API/Structured_clone_algorithm, zh-CN (#2035) --- .../zh-cn/web/api/web_workers_api/structured_clone_algorithm/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'files/zh-cn') diff --git a/files/zh-cn/web/api/web_workers_api/structured_clone_algorithm/index.html b/files/zh-cn/web/api/web_workers_api/structured_clone_algorithm/index.html index 29bd42fc24..2206042e4b 100644 --- a/files/zh-cn/web/api/web_workers_api/structured_clone_algorithm/index.html +++ b/files/zh-cn/web/api/web_workers_api/structured_clone_algorithm/index.html @@ -14,7 +14,7 @@ original_slug: Web/Guide/API/DOM/The_structured_clone_algorithm
- -
Error
以及Function
对象是不能被结构化克隆算法复制的;如果你尝试这样子去做,这会导致抛出DATA_CLONE_ERR
的异常。- 企图去克隆 DOM 节点同样会抛出
+DATA_CLONE_ERROR
异常。- 企图去克隆 DOM 节点同样会抛出
DATA_CLONE_ERR
异常。- 对象的某些特定参数也不会被保留
- -- cgit v1.2.3-54-g00ecf From 88a0fb5f5447955f55b4e7679c788f92aa320af3 Mon Sep 17 00:00:00 2001 From: PocketZ <45301505+pocketdr@users.noreply.github.com> Date: Thu, 12 Aug 2021 22:29:03 +0800 Subject: Improve translation MDN/Contribute, zh-CN (#2038) --- files/zh-cn/mdn/contribute/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'files/zh-cn') diff --git a/files/zh-cn/mdn/contribute/index.html b/files/zh-cn/mdn/contribute/index.html index dfe3a9361d..bc427255e1 100644 --- a/files/zh-cn/mdn/contribute/index.html +++ b/files/zh-cn/mdn/contribute/index.html @@ -15,7 +15,7 @@ translation_of: MDN/Contribute
RegExp
对象的lastIndex
字段不会被保留注意
-目前 MDN 的内容已经迁移至 GitHub ,之前编辑网站内容的已经失效。不论你之前是否参与编辑过 MDN 网站的内容,你都可以在初识 MDN 中了解新的参与方式。
+目前 MDN 的内容已经迁移至 GitHub ,之前编辑网站内容的途径已经失效。不论你之前是否参与编辑过 MDN 网站的内容,你都可以在初识 MDN 中了解新的参与方式。
我可以做些什么?
@@ -108,7 +108,7 @@ translation_of: MDN/Contribute-注意:如果你在使用 MDN 时发现了一些错误,却不知道怎么改正,你可以提交一个 issue。记得写个合适的标题(你可以在 issue 列表里参考一下别人的格式),并简单描述一下问题的位置和涉及到的内容,这样可以方便别人确定问题到底出在哪。
+注意:如果你在使用 MDN 时发现了一些错误,却不知道怎么改正,你可以提交一个 issue。记得写个合适的标题(你可以在 issue 列表里参考一下别人的格式),并简单描述一下问题的位置和涉及到的内容,这样可以方便别人确定问题到底出在哪。如果你发现的问题属于翻译上的错误,向 Translated-content Repo提交一个 issue 会更加合适。
相关链接
-- cgit v1.2.3-54-g00ecf From daa688a5619e649742d1585a828d1e3a91ef1dbe Mon Sep 17 00:00:00 2001 From: Zjl37 <2693911885@qq.com> Date: Sun, 15 Aug 2021 17:40:45 +0800 Subject: Add Web/Security/Weak_Signature_Algorithm, zh-CN (#1993) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 添加翻译 Web/Security/Weak_Signature_Algorithm * 将 Web/Security/Weak_Signature_Algorithm 改为 HTML * 将 id 改为英文 --- .../security/weak_signature_algorithm/index.html | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 files/zh-cn/web/security/weak_signature_algorithm/index.html (limited to 'files/zh-cn') diff --git a/files/zh-cn/web/security/weak_signature_algorithm/index.html b/files/zh-cn/web/security/weak_signature_algorithm/index.html new file mode 100644 index 0000000000..1b3963f2ec --- /dev/null +++ b/files/zh-cn/web/security/weak_signature_algorithm/index.html @@ -0,0 +1,32 @@ +--- +title: 弱签名算法 +slug: Web/Security/Weak_Signature_Algorithm +tags: + - Cryptography + - Guide + - Security + - 密码学 + - 指南 + - 安全 +translation_of: Web/Security/Weak_Signature_Algorithm +--- + +在给{{Glossary("Digital certificate", "数字证书")}}{{Glossary("Signature/Security", "签名")}}时,用到的哈希算法的强度对证书的安全性至关重要。本文将提供一些已知的弱签名算法的信息,以便你在适当的时候避免使用它们。
+ +弱的哈希算法可以使攻击者能够伪造证书。技术进步使网络攻击变得更加可行,随着新型的网络攻击不断被发现,我们不鼓励使用旧的算法,并最终移除了对它们的支持。
+ +SHA-1
+ +从 2017 年开始,主流浏览器不再认为 SHA-1 证书安全。应该使用那些采用更安全的哈希算法(如 SHA-256 或 SHA-512)的证书。
+ +MD5
+ +对基于 MD5 的签名的支持在 2012 年初被移除。
+ +相关资料
+ + + +{{QuickLinksWithSubpages("/zh-CN/docs/Web/Security")}}
\ No newline at end of file -- cgit v1.2.3-54-g00ecf From 5aab2b42a992494838189fc7d302df136519846d Mon Sep 17 00:00:00 2001 From: meowmeowmeowcatDate: Mon, 16 Aug 2021 22:13:32 +0800 Subject: Fix broken live sample (#2060) --- files/zh-cn/web/html/element/input/checkbox/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'files/zh-cn') diff --git a/files/zh-cn/web/html/element/input/checkbox/index.html b/files/zh-cn/web/html/element/input/checkbox/index.html index 14a0d21aef..4f349c2449 100644 --- a/files/zh-cn/web/html/element/input/checkbox/index.html +++ b/files/zh-cn/web/html/element/input/checkbox/index.html @@ -25,7 +25,7 @@ translation_of: Web/HTML/Element/input/checkbox - 指定checkbox处于不定状态(在大多数平台,这样会产生一个划过checkbox的横线)。
-示例
+示例
<p> <input type="checkbox" id="cbox1" value="first_checkbox"> -- cgit v1.2.3-54-g00ecf From 2478646b4648d9c3b98482f186e542fc8ca0cc19 Mon Sep 17 00:00:00 2001 From: IrvinDate: Tue, 17 Aug 2021 02:46:21 +0800 Subject: bring some orphaned docs and relocate according to it's counterpart eng doc (partial revert #1616) (#1618) * Revert "Remove previously orphaned file (#1616)" This reverts commit 49c5601989809c347a5a595e3c5edc08731e5305. * fix broken slugs * rm orphaned docs that eng origin is not available * Web/API/Element/after: sync origin english content --- files/zh-cn/web/api/element/after/index.html | 91 ++++++++++ files/zh-cn/web/api/element/before/index.html | 193 +++++++++++++++++++++ files/zh-cn/web/api/element/remove/index.html | 98 +++++++++++ files/zh-cn/web/api/element/replacewith/index.html | 116 +++++++++++++ files/zh-cn/web/api/renderingcontext/index.html | 30 ++++ 5 files changed, 528 insertions(+) create mode 100644 files/zh-cn/web/api/element/after/index.html create mode 100644 files/zh-cn/web/api/element/before/index.html create mode 100644 files/zh-cn/web/api/element/remove/index.html create mode 100644 files/zh-cn/web/api/element/replacewith/index.html create mode 100644 files/zh-cn/web/api/renderingcontext/index.html (limited to 'files/zh-cn') diff --git a/files/zh-cn/web/api/element/after/index.html b/files/zh-cn/web/api/element/after/index.html new file mode 100644 index 0000000000..ea111ec412 --- /dev/null +++ b/files/zh-cn/web/api/element/after/index.html @@ -0,0 +1,91 @@ +--- +title: Element.after() +slug: Web/API/Element/after +translation_of: Web/API/Element/after +original_slug: Web/API/ChildNode/after +tags: + - API + - DOM + - Method + - Node + - Reference +browser-compat: api.Element.after +--- + {{APIRef("DOM")}}+ ++ +
Element.after()
方法会在其父节点的子节点列表中插入一些 {{domxref("Node")}} 或 {{domxref("DOMString")}} 对象。插入位置为该节点之后。{{domxref("DOMString")}} 对象会被以 {{domxref("Text")}} 的形式插入。语法
+ ++after(... nodes) ++ +参数
+ ++
+ +- +
nodes
- 一组准备插入的 {{domxref("Node")}} 或 {{domxref("DOMString")}} 。
+错误
+ ++
+ +- {{domxref("HierarchyRequestError")}}: 在某些不正确的层级结构进行了插入操作。
+示例
+ +插入元素
+ +let container = document.createElement("div"); +let p = document.createElement("p"); +container.appendChild(p); +let span = document.createElement("span"); + +p.after(span); + +console.log(container.outerHTML); +// "<div><p></p><span></span></div>" ++ +插入文本
+ +let container = document.createElement("div"); +let p = document.createElement("p"); +container.appendChild(p); + +p.after("Text"); + +console.log(container.outerHTML); +// "<div><p></p>Text</div>"+ +同时插入元素和文本
+ +let container = document.createElement("div"); +let p = document.createElement("p"); +container.appendChild(p); +let span = document.createElement("span"); + +p.after(span, "Text"); + +console.log(container.outerHTML); +// "<div><p></p><span></span>Text</div>"+ +规范
+ +{{Specifications}} + +浏览器兼容性
+ +{{Compat}}
+ +相关链接
+ ++
diff --git a/files/zh-cn/web/api/element/before/index.html b/files/zh-cn/web/api/element/before/index.html new file mode 100644 index 0000000000..11553a0194 --- /dev/null +++ b/files/zh-cn/web/api/element/before/index.html @@ -0,0 +1,193 @@ +--- +title: Element.before() +slug: Web/API/Element/before +tags: + - API + - DOM + - Method + - Node + - Reference +translation_of: Web/API/Element/before +original_slug: Web/API/ChildNode/before +browser-compat: api.Element.before +--- +- {{domxref("Element.before()")}}
+- {{domxref("Element.append()")}}
+- {{domxref("Node.appendChild()")}}
+- {{domxref("Element.insertAdjacentElement()")}}
+- {{domxref("NodeList")}}
+{{APIRef("DOM")}} {{SeeCompatTable}}+ ++ +
ChildNode
.before
方法可以在ChildNode这个节点的父节点中插入一些列的
{{domxref("Node")}} 或者 {{domxref("DOMString")}} 对象,位置就是在ChildNode节点的前面,
{{domxref("DOMString")}} 对象其实和 {{domxref("Text")}}节点一样的方式来完成插入的。语法
+ +[Throws, Unscopable] +void Element.before((Node or DOMString)... nodes); ++ +Parameters参数
+ ++
+ +- +
nodes
- 一系列的 {{domxref("Node")}} 或者 {{domxref("DOMString")}}
+Exceptions
+ ++
+ +- {{domxref("HierarchyRequestError")}}: 当节点插入了错误的层级就会出现报错,需要遵循html标签的层级关系,
+Examples事例
+ +Inserting an element插入元素节点
+ +var parent = document.createElement("div"); +var child = document.createElement("p"); +parent.appendChild(child); +var span = document.createElement("span"); + +child.before(span); + +console.log(parent.outerHTML); +// "<div><span></span><p></p></div>" ++ +Inserting text插入文本节点
+ +var parent = document.createElement("div"); +var child = document.createElement("p"); +parent.appendChild(child); + +child.before("Text"); + +console.log(parent.outerHTML); +// "<div>Text<p></p></div>"+ +Inserting an element and text同时插入文本和元素
+ +var parent = document.createElement("div"); +var child = document.createElement("p"); +parent.appendChild(child); +var span = document.createElement("span"); + +child.before(span, "Text"); + +console.log(parent.outerHTML); +// "<div><span></span>Text<p></p></div>"+ ++ +
Element.before()
is unscopable不可使用区域The
+ +before()
不能配合with声明使用,See {{jsxref("Symbol.unscopables")}} for more information.with(node) { + before("foo"); +} +// ReferenceError: before is not defined+ +Polyfill
+ +兼容ie9或者更高版本的方法,You can polyfill the
+ +before() method
in Internet Explorer 9 and higher with the following code:// from: https://github.com/jserz/js_piece/blob/master/DOM/ChildNode/before()/before().md +(function (arr) { + arr.forEach(function (item) { + if (item.hasOwnProperty('before')) { + return; + } + Object.defineProperty(item, 'before', { + configurable: true, + enumerable: true, + writable: true, + value: function before() { + var argArr = Array.prototype.slice.call(arguments), + docFrag = document.createDocumentFragment(); + + argArr.forEach(function (argItem) { + var isNode = argItem instanceof Node; + docFrag.appendChild(isNode ? argItem : document.createTextNode(String(argItem))); + }); + + this.parentNode.insertBefore(docFrag, this); + } + }); + }); +})([Element.prototype, CharacterData.prototype, DocumentType.prototype]);+ +Specification
+ ++ +
+ ++ +Specification +Status +Comment ++ + +{{SpecName('DOM WHATWG', '#dom-childnode-before', 'Element.before()')}} +{{Spec2('DOM WHATWG')}} +Initial definition. +Browser compatibility
+ +{{CompatibilityTable}}
+ +++ ++ +
++ +Feature +Chrome +Firefox (Gecko) +Internet Explorer +Opera +Safari ++ + +Basic support +{{CompatChrome(54.0)}} +{{CompatGeckoDesktop(49)}} +{{CompatUnknown}} +{{CompatOpera(39)}} +{{CompatUnknown}} +++ ++ +
++ +Feature +Android +Android Webview +Firefox Mobile (Gecko) +IE Mobile +Opera Mobile +Safari Mobile +Chrome for Android ++ + +Basic support +{{CompatNo}} +{{CompatChrome(54.0)}} +{{CompatGeckoMobile(49)}} +{{CompatUnknown}} +{{CompatOpera(39)}} +{{CompatUnknown}} +{{CompatChrome(54.0)}} +See also
+ ++
diff --git a/files/zh-cn/web/api/element/remove/index.html b/files/zh-cn/web/api/element/remove/index.html new file mode 100644 index 0000000000..b244385222 --- /dev/null +++ b/files/zh-cn/web/api/element/remove/index.html @@ -0,0 +1,98 @@ +--- + +title: Element.remove() +slug: Web/API/Element/remove +tags: + - API + - Element + - DOM + - Method +translation_of: Web/API/Element/remove +original_slug: Web/API/ChildNode/remove +browser-compat: api.Element.remove +--- +- {{domxref("ChildNode")}} and {{domxref("ParentNode")}}
+- {{domxref("ChildNode.after()")}}
+- {{domxref("ParentNode.append()")}}
+- {{domxref("Node.appendChild()")}}
+- {{domxref("Node.insertBefore()")}}
+- {{domxref("NodeList")}}
+{{APIRef("DOM")}}
+ ++ +
Element.remove()
方法,把对象从它所属的 DOM 树中删除。语法
+ +node.remove();+ +示例
+ +使用
+ +remove()
<div id="div-01">Here is div-01</div> +<div id="div-02">Here is div-02</div> +<div id="div-03">Here is div-03</div> ++ +var el = document.getElementById('div-02'); +el.remove(); +// id 为 'div-02' 的 div 被删掉了 ++ +{{EmbedLiveSample('使用_remove()')}}
+ ++ +
Element.remove()
是不可见的在
+ +with
语句中,remove()
方法是不可见的。参阅 {{jsxref("Symbol.unscopables")}} 了解更多信息。with(node) { + remove(); +} +// ReferenceError: remove is not defined+ +Polyfill
+ +You can polyfill the
+ +remove()
method in Internet Explorer 9 and higher with the following code://https://github.com/jserz/js_piece/blob/master/DOM/ChildNode/remove()/remove().md +(function (arr) { + arr.forEach(function (item) { + if (item.hasOwnProperty('remove')) { + return; + } + Object.defineProperty(item, 'remove', { + configurable: true, + enumerable: true, + writable: true, + value: function remove() { + this.parentNode.removeChild(this); + } + }); + }); +})([Element.prototype, CharacterData.prototype, DocumentType.prototype]);+ +规范
+ ++ +
+ ++ +规范 +状态 +注释 ++ + +{{SpecName('DOM WHATWG', '#dom-childnode-remove', 'Element.remove')}} +{{Spec2('DOM WHATWG')}} +Initial definition. +浏览器兼容性
+ + + +{{Compat("api.Element.remove")}}
+ +参见
+ ++
diff --git a/files/zh-cn/web/api/element/replacewith/index.html b/files/zh-cn/web/api/element/replacewith/index.html new file mode 100644 index 0000000000..13fe96c23b --- /dev/null +++ b/files/zh-cn/web/api/element/replacewith/index.html @@ -0,0 +1,116 @@ +--- +title: Element.replaceWith() +slug: Web/API/Element/replaceWith +tags: + - API + - DOM + - Method + - Element + - Reference +browser-compat: api.Element.replaceWith +translation_of: Web/API/Element/replaceWith +original_slug: Web/API/ChildNode/replaceWith +--- +- {{domxref("ChildNode")}} 纯接口。
+- +
+实现此纯接口的对象类型: {{domxref("CharacterData")}}、{{domxref("Element")}} , 和 {{domxref("DocumentType")}}.+{{APIRef("DOM")}} {{SeeCompatTable}}+ ++ +
ChildNode
.replaceWith()
的方法用一套 {{domxref("Node")}} 对象或者 {{domxref("DOMString")}} 对象,替换了该节点父节点下的子节点 。{{domxref("DOMString")}} 对象被当做等效的{{domxref("Text")}} 节点插入。语法
+ +[Throws, Unscopable] +void ChildNode.replaceWith((Node or DOMString)... nodes); ++ +参数
+ ++
+ +- +
节点
- 一系列用来替换的{{domxref("Node")}} 对象或者 {{domxref("DOMString")}} 对象。
+例外
+ ++
+ +- {{domxref("HierarchyRequestError")}}: 无法在层次结构中的指定点插入节点。
+案例
+ +Using
+ +replaceWith()
var parent = document.createElement("div"); +var child = document.createElement("p"); +parent.appendChild(child); +var span = document.createElement("span"); + +child.replaceWith(span); + +console.log(parent.outerHTML); +// "<div><span></span></div>" ++ ++ +
ChildNode.replaceWith()
is unscopable+ +
replaceWith()
的方法并没有作用于with语句. 参考 {{jsxref("Symbol.unscopables")}} 获取更多信息.with(node) { + replaceWith("foo"); +} +// ReferenceError: replaceWith is not defined+ +Polyfill
+ +你可以在IE9及更高级的浏览器中使用下面的代码向上兼容
+ +replaceWith()
的方法:(function (arr) { + arr.forEach(function (item) { + if (item.hasOwnProperty('replaceWith')) { + return; + } + Object.defineProperty(item, 'replaceWith', { + configurable: true, + enumerable: true, + writable: true, + value: function replaceWith() { + var argArr = Array.prototype.slice.call(arguments), + docFrag = document.createDocumentFragment(); + + argArr.forEach(function (argItem) { + var isNode = argItem instanceof Node; + docFrag.appendChild(isNode ? argItem : document.createTextNode(String(argItem))); + }); + + this.parentNode.replaceChild(docFrag, this); + } + }); + }); +})([Element.prototype, CharacterData.prototype, DocumentType.prototype]);+ +规范
+ ++ +
+ ++ +规范 +状态 +注释 ++ + +{{SpecName('DOM WHATWG', '#dom-childnode-replacewith', 'ChildNode.replacewith()')}} +{{Spec2('DOM WHATWG')}} +Initial definition. +浏览器兼容性
+ +{{Compat("api.ChildNode.replaceWith")}}
+ +参阅
+ ++
diff --git a/files/zh-cn/web/api/renderingcontext/index.html b/files/zh-cn/web/api/renderingcontext/index.html new file mode 100644 index 0000000000..4cf1dfc0b7 --- /dev/null +++ b/files/zh-cn/web/api/renderingcontext/index.html @@ -0,0 +1,30 @@ +--- +title: RenderingContext +slug: Web/API/RenderingContext +translation_of: Web/API/RenderingContext +original_slug: Web/API/RenderingContext +--- +- {{domxref("ChildNode")}} 和 {{domxref("ParentNode")}}
+- {{domxref("Node.replaceChild()")}}
+- {{domxref("NodeList")}}
+{{APIRef("Canvas API")}}
+ ++ +
RenderingContext
是一个辅助类型,描述下面任何一个渲染上下文: {{domxref("CanvasRenderingContext2D")}}, {{domxref("WebGLRenderingContext")}} 或者 {{domxref("WebGL2RenderingContext")}} (继承自WebGLRenderingContext
)。这是简化规范的辅助类型,它不是一个接口,也没有对象实现它。
+ +规范描述
+ ++ +
+ ++ +Specification +Status +Comment ++ + +{{SpecName('HTML WHATWG', "scripting.html#renderingcontext", "RenderingContext")}} +{{Spec2('HTML WHATWG')}} +Initial definition. +\ No newline at end of file -- cgit v1.2.3-54-g00ecf