From 310fd066e91f454b990372ffa30e803cc8120975 Mon Sep 17 00:00:00 2001 From: Florian Merz Date: Thu, 11 Feb 2021 12:56:40 +0100 Subject: unslug zh-cn: move --- files/zh-cn/web/api/node/baseuriobject/index.html | 19 ---- files/zh-cn/web/api/node/innertext/index.html | 92 ----------------- files/zh-cn/web/api/node/nodeprincipal/index.html | 19 ---- files/zh-cn/web/api/node/outertext/index.html | 9 -- files/zh-cn/web/api/node/rootnode/index.html | 115 ---------------------- 5 files changed, 254 deletions(-) delete mode 100644 files/zh-cn/web/api/node/baseuriobject/index.html delete mode 100644 files/zh-cn/web/api/node/innertext/index.html delete mode 100644 files/zh-cn/web/api/node/nodeprincipal/index.html delete mode 100644 files/zh-cn/web/api/node/outertext/index.html delete mode 100644 files/zh-cn/web/api/node/rootnode/index.html (limited to 'files/zh-cn/web/api/node') diff --git a/files/zh-cn/web/api/node/baseuriobject/index.html b/files/zh-cn/web/api/node/baseuriobject/index.html deleted file mode 100644 index ad04356656..0000000000 --- a/files/zh-cn/web/api/node/baseuriobject/index.html +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: Node.baseURIObject -slug: Web/API/Node/baseURIObject -translation_of: Web/API/Node -translation_of_original: Web/API/Node/baseURIObject ---- -
- {{ApiRef}} {{Fx_minversion_header("3")}} {{Non-standard_header}}
-

概述

-

baseURIObject属性返回一个代表当前节点(通常是文档节点或元素节点)的基URL的{{Interface("nsIURI")}}对象.该属性类似与{{domxref("Node.baseURI")}},只是它返回的是一个包含更多信息的nsIURI对象,而不只是一个URL字符串.

-

该属性在所有类型的节点上都可用(HTML,XUL,SVG,MathML等),但脚本本身必须要有 UniversalXPConnect权限(XUL默认有这个权限,HTML没有).

-

查看{{domxref("Node.baseURI")}}了解基URL(base URL)是什么.

-

语法

-
uriObj = node.baseURIObject
-
-

附注

-

该属性只读,尝试为它赋值会抛出异常. 此外,这个属性只能从特权代码中访问.

-

规范

-

不属于任何规范,mozilla私有属性.

diff --git a/files/zh-cn/web/api/node/innertext/index.html b/files/zh-cn/web/api/node/innertext/index.html deleted file mode 100644 index 3062dda65f..0000000000 --- a/files/zh-cn/web/api/node/innertext/index.html +++ /dev/null @@ -1,92 +0,0 @@ ---- -title: HTMLElement.innerText -slug: Web/API/Node/innerText -tags: - - API - - DOM - - HTMLElement - - Property - - Reference - - 参考 - - 属性 -translation_of: Web/API/HTMLElement/innerText ---- -
{{APIRef("DOM")}}
- -

innerText 属性表示一个节点及其后代的“渲染”文本内容。 As a getter, it approximates the text the user would get if they highlighted the contents of the element with the cursor and then copied it to the clipboard.

- -
-

Note: innerText 很容易与{{domxref("Node.textContent")}}混淆, 但这两个属性间实际上有很重要的区别. 大体来说, innerText 可操作已被渲染的内容, 而 textContent 则不会.

-
- -

语法

- -
var renderedText = HTMLElement.innerText;
-HTMLElement.innerText = string;
- -

输出值

- -

一段 {{domxref("DOMString")}} 表示一个元素中已被渲染的内容. 如果元素自身没有 被渲染 (e.g 被从文档中删除或没有在视图中显示), 这时返回值与 {{domxref("Node.textContent")}} 属性相同.

- -

例子

- -

这个示例对比了 innerText 和 {{domxref("Node.textContent")}}. 这时 innerText 代表的含义就像 {{htmlElement("br")}} 标签, 并且忽略了隐藏的元素.

- -

HTML

- -
<h3>Source element:</h3>
-<p id="source">
-  <style>#source { color: red; }</style>
-Take a look at<br>how this text<br>is interpreted
-       below.
-  <span style="display:none">HIDDEN TEXT</span>
-</p>
-<h3>Result of textContent:</h3>
-<textarea id="textContentOutput" rows="6" cols="30" readonly>...</textarea>
-<h3>Result of innerText:</h3>
-<textarea id="innerTextOutput" rows="6" cols="30" readonly>...</textarea>
- -

JavaScript

- -
const source = document.getElementById('source');
-const textContentOutput = document.getElementById('textContentOutput');
-const innerTextOutput = document.getElementById('innerTextOutput');
-
-textContentOutput.innerHTML = source.textContent;
-innerTextOutput.innerHTML = source.innerText;
- -

结果

- -

{{EmbedLiveSample("Example", 700, 450)}}

- -

规范

- - - - - - - - - - - - - - -
规范状态备注
{{SpecName('HTML WHATWG', 'dom.html#the-innertext-idl-attribute', 'innerText')}}{{Spec2('HTML WHATWG')}}Introduced, based on the draft of the innerText specification. See whatwg/html#465 and whatwg/compat#5 for history.
- -

浏览器兼容

- - - -

{{Compat("api.HTMLElement.innerText")}}

- -

此特性最初由 Internet Explorer 引入。 被所有主要的浏览器供应商(vendor)采用后,它于 2016 年正式进入 HTML 标准。

- -

参见

- - diff --git a/files/zh-cn/web/api/node/nodeprincipal/index.html b/files/zh-cn/web/api/node/nodeprincipal/index.html deleted file mode 100644 index 58844aef2e..0000000000 --- a/files/zh-cn/web/api/node/nodeprincipal/index.html +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: Node.nodePrincipal -slug: Web/API/Node/nodePrincipal -translation_of: Web/API/Node -translation_of_original: Web/API/Node/nodePrincipal ---- -
- {{APIRef}}{{Fx_minversion_header(3)}}{{Non-standard_header}} -

The Node.nodePrincipal read-only property returns the {{Interface("nsIPrincipal")}} object representing current security context of the node.

-

{{Note("This property exists on all nodes (HTML, XUL, SVG, MathML, etc.), but only if the script trying to use it has chrome privileges.")}}

-

Syntax

-
principalObj = element.nodePrincipal
-
-

Notes

-

This property is read-only; attempting to write to it will throw an exception. In addition, this property may only be accessed from privileged code.

-

Specification

-

Not in any specification.

-
-

 

diff --git a/files/zh-cn/web/api/node/outertext/index.html b/files/zh-cn/web/api/node/outertext/index.html deleted file mode 100644 index 01de770af7..0000000000 --- a/files/zh-cn/web/api/node/outertext/index.html +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: Node.outerText -slug: Web/API/Node/outerText -tags: - - Node.outerText -translation_of: Web/API/HTMLElement/outerText -translation_of_original: Web/API/Node/outerText ---- -

请参阅 {{domxref("HTMLElement.outerText")}}

diff --git a/files/zh-cn/web/api/node/rootnode/index.html b/files/zh-cn/web/api/node/rootnode/index.html deleted file mode 100644 index 6291ef7fd6..0000000000 --- a/files/zh-cn/web/api/node/rootnode/index.html +++ /dev/null @@ -1,115 +0,0 @@ ---- -title: Node.rootNode -slug: Web/API/Node/rootNode -tags: - - API - - DOM - - Node - - Property - - Reference - - rootNode -translation_of: Web/API/Node/getRootNode -translation_of_original: Web/API/Node/rootNode ---- -

{{deprecated_header}}{{APIRef("DOM")}}{{SeeCompatTable}}

- -

Node.rootNode 是 {{domxref("Node")}} 的一个只读属性, 返回该节点所在 DOM 数的根节点(最高节点). 此属性是通过 {{domxref("Node.parentNode")}} 属性循环查找直到找到根节点.

- -
-

注意: 由于某种原因, 此属性已经被 {{domxref("Node.getRootNode()")}} 方法替代.

-
- -

语法

- -
rootNode = node.rootNode;
-
- -

 返回值

- -

返回 {{domxref("Node")}} 对象.

- -

样例

- -

下面是输出body的根节点样例:

- -
console.log(document.body.rootNode);
- -

参考

- -

Gecko内核的浏览器会在源代码中标签内部有空白符的地方插入一个文本结点到文档中.因此,使用诸如 - Node.firstChildNode.previousSibling 之类的方法可能会引用到一个空白符文本节点, - 而不是使用者所预期得到的节点.

- -

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

- -

浏览器兼容性

- -

{{CompatibilityTable}}

- -
- - - - - - - - - - - - - - - - - - - -
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support{{CompatNo}}[1]{{CompatNo}}[1]{{CompatUnknown}}{{CompatNo}}{{CompatUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - -
FeatureAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support{{CompatUnknown}}{{CompatNo}}[1]{{CompatUnknown}}{{CompatNo}}[1]{{CompatUnknown}}
-
- -

[1] 此属性已经废弃, 使用{{domxref("Node.getRootNode()")}} 方法替代.

- -

规范

- - - - - - - - - - - - - - - - -
规范样式备注
{{SpecName('DOM WHATWG', '#dom-node-rootnode', 'Node.rootNode')}}{{Spec2('DOM WHATWG')}}初始定义
-- cgit v1.2.3-54-g00ecf