From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/ja/web/api/attr/namespaceuri/index.html | 126 ++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 files/ja/web/api/attr/namespaceuri/index.html (limited to 'files/ja/web/api/attr/namespaceuri') diff --git a/files/ja/web/api/attr/namespaceuri/index.html b/files/ja/web/api/attr/namespaceuri/index.html new file mode 100644 index 0000000000..c294fa3633 --- /dev/null +++ b/files/ja/web/api/attr/namespaceuri/index.html @@ -0,0 +1,126 @@ +--- +title: Attr.namespaceURI +slug: Web/API/Attr/namespaceURI +tags: + - API + - DOM + - NeedsBrowserCompatibility + - NeedsMobileBrowserCompatibility + - Property + - Reference +translation_of: Web/API/Attr/namespaceURI +--- +
{{APIRef("DOM")}}
+Attr.namespaceURI 読み取り専用プロパティは、属性の名前空間 URI を返し、要素が名前空間にない場合は null を返します。
+ +
+

DOM4 以前では、この API は {{domxref("Node")}} インターフェイス内で定義されていました。

+
+ +

構文

+ +
namespace = attribute.namespaceURI
+ +

+ +

このスニペットでは、{{domxref("localName")}} とその namespaceURI について属性を調べています。
+ namespaceURI がXUL名前空間を返し、localName が "browser" を返した場合、ノードは XUL <browser/> と解釈されます。

+ +
if (attribute.localName == "value" &&
+    attribute.namespaceURI == "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul") {
+  // this is a XUL value
+}
+ +

注記

+ +

これは、スコープ内の名前空間宣言の検査に基づいた名前空間探索の結果である計算値ではありません。属性の名前空間 URI は、属性作成時に固定されます。

+ +

Firefox 3.5 以前では、HTML 文書の HTML 属性の名前空間 URI は null です。
+ それ以降のバージョンでは、HTML5 に準拠して、XHTML と同様に https://www.w3.org/1999/xhtml になります。{{gecko_minversion_inline("1.9.2")}}

+ +

DOM Level 2 メソッドの {{domxref("Element.setAttributeNS")}} を使用して、指定された namespaceURI で属性を作成できます。

+ +

XML の名前空間仕様では、属性は名前空間がアタッチされている要素からその名前空間を継承しません。
+ 属性に明示的に名前空間が与えられていない場合、名前空間はありません。

+ +

DOM は、名前空間の検証自体を処理したり、実行したりしません。必要な検証を行うのは DOM アプリケーションの責任です。名前空間の接頭辞は、いったん特定のノードに関連付けられると変更できません。

+ +

仕様

+ + + + + + + + + + + + + + + + +
仕様書ステータスコメント
{{SpecName("DOM4", "#dom-element-namespaceuri", "Element.namespaceuri")}}{{Spec2("DOM4")}}初版
+ +

ブラウザー互換性

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
基本サポート46.0[1]{{CompatGeckoDesktop("48.0")}}[1]{{CompatUnknown}}{{CompatVersionUnknown}}{{CompatUnknown}}
+
+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureAndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
基本サポート{{CompatUnknown}}{{CompatGeckoMobile("48.0")}}[1]{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
+
+ +

[1] この API は、以前は {{domxref("Node")}} API で利用できました。

+ +

関連情報

+ + -- cgit v1.2.3-54-g00ecf