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/window/content/index.html | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 files/ja/web/api/window/content/index.html (limited to 'files/ja/web/api/window/content/index.html') diff --git a/files/ja/web/api/window/content/index.html b/files/ja/web/api/window/content/index.html new file mode 100644 index 0000000000..ab3098dd36 --- /dev/null +++ b/files/ja/web/api/window/content/index.html @@ -0,0 +1,33 @@ +--- +title: window.content +slug: Web/API/Window/content +tags: + - DOM + - Gecko + - Gecko DOM Reference + - 要更新 +translation_of: Web/API/Window/content +--- +

{{ ApiRef() }} {{ 英語版章題("Summary") }}

+

概要

+

主となるコンテンツウィンドウを表す Window オブジェクトを返します。これは、type="content-primary" 属性を持つ <browser> (もしくは tabbrowser<iframe>) 要素のある XUL ウィンドウにおいて役立ちます。最も有名な例は、Firefox のメインウィンドウである browser.xul です。このような場合、content はブラウザに現在表示されているドキュメントを表す Window オブジェクトへの参照を返します。これは、browserRef.contentWindow のショートカットです。

+

特権のないコンテンツ (Web ページ) では、content は通常 top と同じです。ただし、Web ページがサイドバーに読み込まれた場合を除きます。このときの content は、現在選択しているタブの Window を参照しています。

+

いくつかの例では、content の代わりに _content を使用しています。しかし、後者は長い間非推奨とされています。ですから、新しいコードでは content を使うべきです。

+

{{ 英語版章題("Syntax") }}

+

構文

+
var windowObject = window.content;
+
+

{{ 英語版章題("Example") }}

+

+

以下のコードを <browser type="content-primary"/> 要素を持つ chrome XUL ウィンドウで実行すると、ブラウザで現在表示されているページの最初の div 要素の周囲に赤い枠が描画されます。

+
content.document.getElementsByTagName("div")[0].style.border = "solid red 1px";
+
+

{{ 英語版章題("Specification") }}

+

仕様

+

W3C の仕様の一部ではありません。

+

{{ 英語版章題("See also") }}

+

参照

+ -- cgit v1.2.3-54-g00ecf