diff options
author | Masahiro Fujimoto <mfujimot@gmail.com> | 2022-02-04 16:47:14 +0900 |
---|---|---|
committer | Masahiro FUJIMOTO <mfujimot@gmail.com> | 2022-02-18 09:23:54 +0900 |
commit | 2e4c6c5892cd21091393887b1895162f85023fc8 (patch) | |
tree | b8323f90af3512b66dd9010969c78f7e81b0c6b7 /files/ja/web/api/element/queryselector/index.html | |
parent | f184d259ec05c1d1122e5ebddf059671eb3799a2 (diff) | |
download | translated-content-2e4c6c5892cd21091393887b1895162f85023fc8.tar.gz translated-content-2e4c6c5892cd21091393887b1895162f85023fc8.tar.bz2 translated-content-2e4c6c5892cd21091393887b1895162f85023fc8.zip |
Element.querySelector 系の記事を移行
Diffstat (limited to 'files/ja/web/api/element/queryselector/index.html')
-rw-r--r-- | files/ja/web/api/element/queryselector/index.html | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/files/ja/web/api/element/queryselector/index.html b/files/ja/web/api/element/queryselector/index.html deleted file mode 100644 index 1aec9dde2d..0000000000 --- a/files/ja/web/api/element/queryselector/index.html +++ /dev/null @@ -1,91 +0,0 @@ ---- -title: Element.querySelector() -slug: Web/API/Element/querySelector -translation_of: Web/API/Element/querySelector ---- -<div>{{APIRef}}</div> - -<p>対象要素の子孫の内、引数に指定したCSSセレクタにマッチする最初の要素を返します。</p> - -<h2 id="Syntax" name="Syntax">構文</h2> - -<pre class="syntaxbox"><var>element</var> = baseElement.querySelector(<em>selector</em>s); -</pre> - -<ul> - <li><code>element</code>と<code>baseElement</code>は{{domxref("element")}}オブジェクトを表します。</li> - <li><code>selectors</code>はマッチさせたい1つ以上の<a href="/ja/docs/Web/Guide/CSS/Getting_Started/Selectors">セレクタ</a>を表します。</li> -</ul> - -<h2 id="Example" name="Example">例</h2> - -<p>次の例では、type属性を持たないか、<span style="font-family: Consolas, Monaco, 'Andale Mono', monospace;"><code>text/css</code>を<code>type</code>属性として持つ、ドキュメントボディーの中で</span>最初の<code style="font-style: normal;">style</code>要素が返却されます。</p> - -<pre class="brush:js">var el = document.body.querySelector("style[type='text/css'], style:not([type])"); -</pre> - -<h2 id="Notes" name="Notes">注記</h2> - -<p>マッチする要素が無い場合は<code>nullを返します</code>。その他の場合は、最初にマッチした要素を返します。</p> - -<p>指定されたセレクタが不正である場合、例外「<code>SYNTAX_ERR</code>」がスローされます。</p> - -<p>Throws a <code>SYNTAX_ERR</code> exception if the specified group of selectors is invalid.</p> - -<p><span style="font-family: Courier New;"><span>querySelector()</span></span>はWebApps API仕様で定義されました。</p> - -<p><code>querySelector</code>に渡す文字列はCSSの文法に則る必要があります。{{domxref("document.querySelector")}}で実例を見て下さい。</p> - -<h2 id="ブラウザ実装状況">ブラウザ実装状況</h2> - -<table class="standard-table"> - <tbody> - <tr> - <th>Browser</th> - <th>Support</th> - <th>Notes</th> - </tr> - <tr> - <td>Internet Explorer</td> - <td>8</td> - <td>CSS 2.1 selectors only (IE8)</td> - </tr> - <tr> - <td>Firefox (Gecko)</td> - <td><strong>3.5</strong> (1.9.1)</td> - <td> </td> - </tr> - <tr> - <td>Opera</td> - <td>10</td> - <td> </td> - </tr> - <tr> - <td>Chrome</td> - <td>1</td> - <td> </td> - </tr> - <tr> - <td>Safari (webkit)</td> - <td>3.2 (525.3)</td> - <td><a class="link-https" href="https://bugs.webkit.org/show_bug.cgi?id=16587">webk.it/16587</a></td> - </tr> - </tbody> -</table> - -<h2 id="Specification" name="Specification">仕様書</h2> - -<ul> - <li>{{spec("http://www.w3.org/TR/selectors-api/","Selectors API Level 1","rec")}}</li> - <li>{{spec("http://www.w3.org/TR/selectors-api2/","Selectors API Level 2","wd")}}</li> - <li>{{spec("http://dev.w3.org/2006/webapi/selectors-api2/","Selectors API Level 2","ed")}}</li> -</ul> - -<h2 id="See_also" name="See_also">関連情報</h2> - -<ul> - <li><a dir="ltr" href="/ja/docs/DOM/Element.querySelectorAll"><code>element.querySelectorAll</code></a></li> - <li><a href="/ja/docs/DOM/Document.querySelector"><code>document.querySelector</code></a></li> - <li><a href="/ja/docs/DOM/Document.querySelectorAll"><code>document.querySelectorAll</code></a></li> - <li><a href="/ja/docs/Code_snippets/QuerySelector">querySelectorのコードスニペット</a></li> -</ul> |