From d44f5032d0f53256b2d5aef505d6b593fd3cd158 Mon Sep 17 00:00:00 2001 From: Irvin Date: Wed, 16 Feb 2022 02:14:18 +0800 Subject: fix yari h2m dry run errors (zh-CN) --- .../web/javascript/reference/operators/instanceof/index.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'files/zh-cn/web/javascript/reference/operators/instanceof') diff --git a/files/zh-cn/web/javascript/reference/operators/instanceof/index.html b/files/zh-cn/web/javascript/reference/operators/instanceof/index.html index f6f1f188f8..bb93a7028e 100644 --- a/files/zh-cn/web/javascript/reference/operators/instanceof/index.html +++ b/files/zh-cn/web/javascript/reference/operators/instanceof/index.html @@ -73,8 +73,12 @@ o3 instanceof C; // true 因为 C.prototype 现在在 o3 的原型链上

比如检测一个 Nodes 在另一个窗口中是不是 SVGElement,你可以使用myNode instanceof myNode.ownerDocument.defaultView.SVGElement

-
Mozilla开发者注意:
-在代码中使用 XPCOM instanceof 有特殊影响: 如果查询接口成功执行后,obj instanceof xpcomInterface (e.g. Components.interfaces.nsIFile) 调用obj.QueryInterface(xpcomInterface) 并且返回 true 。这种调用的副作用是在一次成功的 instanceof 测试后,你可以在 obj 上使用xpcomInterface 的属性。这与标准的 JavaScript 全局变量不同,即使 obj 来自不同的作用域,obj instanceof xpcomInterface 也可以按预期产生作用。
+
+

+ 备注: + 在代码中使用 XPCOM instanceof 有特殊影响: 如果查询接口成功执行后,obj instanceof xpcomInterface (e.g. Components.interfaces.nsIFile) 调用obj.QueryInterface(xpcomInterface) 并且返回 true 。这种调用的副作用是在一次成功的 instanceof 测试后,你可以在 obj 上使用xpcomInterface 的属性。这与标准的 JavaScript 全局变量不同,即使 obj 来自不同的作用域,obj instanceof xpcomInterface 也可以按预期产生作用。 +

+

示例

-- cgit v1.2.3-54-g00ecf