aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/node/isdefaultnamespace
diff options
context:
space:
mode:
authorAtsuto Yamashita <atyamash@yahoo-corp.jp>2022-03-15 19:47:35 +0900
committerGitHub <noreply@github.com>2022-03-15 19:47:35 +0900
commit9bf38df91fadd199a5ea45ad79d5e111ddfb3fe0 (patch)
tree71952407ea41c86feabef4214610d59e15aae55d /files/ja/web/api/node/isdefaultnamespace
parentc2678137db5f97ad1fe39e872529159a1afafec1 (diff)
parent9e7fbb013772ebab9b35185f0d0836995acbe6db (diff)
downloadtranslated-content-9bf38df91fadd199a5ea45ad79d5e111ddfb3fe0.tar.gz
translated-content-9bf38df91fadd199a5ea45ad79d5e111ddfb3fe0.tar.bz2
translated-content-9bf38df91fadd199a5ea45ad79d5e111ddfb3fe0.zip
Merge branch 'main' into fix-typo-client-side-web-apis-intro-ja
Diffstat (limited to 'files/ja/web/api/node/isdefaultnamespace')
-rw-r--r--files/ja/web/api/node/isdefaultnamespace/index.html35
-rw-r--r--files/ja/web/api/node/isdefaultnamespace/index.md71
2 files changed, 71 insertions, 35 deletions
diff --git a/files/ja/web/api/node/isdefaultnamespace/index.html b/files/ja/web/api/node/isdefaultnamespace/index.html
deleted file mode 100644
index 018e6562cc..0000000000
--- a/files/ja/web/api/node/isdefaultnamespace/index.html
+++ /dev/null
@@ -1,35 +0,0 @@
----
-title: Node.isDefaultNamespace
-slug: Web/API/Node/isDefaultNamespace
-tags:
- - DOM
- - Gecko DOM Reference
- - Namespaces
- - Node
-translation_of: Web/API/Node/isDefaultNamespace
----
-<div>
- {{ApiRef}}</div>
-<h2 id="Summary" name="Summary">概要</h2>
-<p><code>isDefaultNamespace</code> は、引数としてネームスペース URI を受け取り、ネームスペースが指定されたノードのデフォルトのネームスペースである場合に <code>true</code> を返します。そうでない場合は <code>false</code> を返します。</p>
-<h2 id="Syntax" name="Syntax">構文</h2>
-<pre class="syntaxbox"><var>result</var> = <var>node</var>.isDefaultNamespace(<var>namespaceURI</var>)
-</pre>
-<ul>
- <li><var>result</var> : 戻り値は真偽値 (<code>true</code> / <code>false</code>) となる</li>
- <li><var>namespaceURI</var> : 要素に対してチェックする、名前空間を表す文字列</li>
-</ul>
-<h2 id="Example" name="Example">例</h2>
-<pre class="brush:js">var XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
-var el = document.getElementsByTagNameNS(XULNS, 'textbox')[0];
-
-alert(el.isDefaultNamespace(XULNS)); // true</pre>
-<h2 id="Specification" name="Specification">仕様書</h2>
-<ul>
- <li><a href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-isDefaultNamespace">DOM Level 3 Core: isDefaultNamespace</a></li>
- <li><a href="/ja/docs/Code_snippets/IsDefaultNamespace" title="Code_snippets/IsDefaultNamespace">Code snippets: isDefaultNamespace</a></li>
-</ul>
-<h2 id="See_also" name="See_also">関連情報</h2>
-<ul>
- <li><a href="/ja/docs/Code_snippets/IsDefaultNamespace" title="Code_snippets/IsDefaultNamespace">Code snippets: isDefaultNamespace</a></li>
-</ul>
diff --git a/files/ja/web/api/node/isdefaultnamespace/index.md b/files/ja/web/api/node/isdefaultnamespace/index.md
new file mode 100644
index 0000000000..44f1b3acec
--- /dev/null
+++ b/files/ja/web/api/node/isdefaultnamespace/index.md
@@ -0,0 +1,71 @@
+---
+title: Node.isDefaultNamespace()
+slug: Web/API/Node/isDefaultNamespace
+tags:
+ - メソッド
+ - リファレンス
+browser-compat: api.Node.isDefaultNamespace
+translation_of: Web/API/Node/isDefaultNamespace
+---
+{{APIRef("DOM")}}
+
+**`isDefaultNamespace()`** は {{domxref("Node")}} インターフェイスのメソッドで、名前空間 URI を引数として受け取ります。
+その名前空間がこのノードの既定の名前空間である場合は `true` を返し、そうでない場合は `false` を返します。
+
+> **Note:** 既定の名前空間は、 HTML 要素では常に `""` です。 SVG 要素では、 `xmlns` 属性で設定されます。
+
+## 構文
+
+```js
+isDefaultNamespace(namespaceURI);
+```
+
+### 引数
+
+- `namespaceURI`
+ - : 要素の検査対象となる名前空間を表す文字列です。
+ > **Note:** `namespaceURI` は省略可能ではありませんが、 `null` に設定することはできます。
+
+### 返値
+
+`true` または `false` の値を持つ論理値で、引数が既定の名前空間であるかどうかを示します。
+
+## 例
+
+```html
+"" が &lt;output&gt; の既定の名前空間であるか: <output>未検査</output><br/>
+"http://www.w3.org/2000/svg" が &lt;output&gt; の既定の名前空間であるか: <output>未検査</output><br/>
+"" が &lt;svg&gt; の既定の名前空間であるか: <output>未検査</output><br/>
+"http://www.w3.org/2000/svg" が &lt;svg&gt; の既定の名前空間であるか: <output>未検査</output><br/>
+<svg xmlns="http://www.w3.org/2000/svg" height="1"></svg>
+<button>結果を見るにはクリック</button>
+```
+
+```js
+const button = document.getElementsByTagName('button')[0];
+button.addEventListener("click", function () {
+ const aHtmlElt = document.getElementsByTagName('output')[0];
+ const aSvgElt = document.getElementsByTagName('svg')[0];
+
+ const result = document.getElementsByTagName('output');
+ result[0].value = aHtmlElt.isDefaultNamespace(""); // true
+ result[1].value = aHtmlElt.isDefaultNamespace("http://www.w3.org/2000/svg"); // false
+ result[2].value = aSvgElt.isDefaultNamespace(""); // true
+ result[3].value = aSvgElt.isDefaultNamespace("http://www.w3.org/2000/svg"); // false
+});
+```
+
+{{ EmbedLiveSample('Example','100%',130) }}
+
+## 仕様書
+
+{{Specifications}}
+
+## ブラウザーの互換性
+
+{{Compat}}
+
+## 関連情報
+
+- {{domxref("Node.lookupNamespaceURI")}}
+- {{domxref("Node.lookupPrefix")}}