aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/document/selectionchange_event/index.html
blob: c255bf8328cb0fcb225796bb12cf84f286bf042f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
---
title: 'Document: selectionchange イベント'
slug: Web/API/Document/selectionchange_event
tags:
  - Event
  - Reference
  - Selection
  - Selection API
  - selectionchange
translation_of: Web/API/Document/selectionchange_event
---
<p>{{APIRef}}</p>

<div>
<p><code><strong>selectionchange</strong></code> イベントは <a href="/ja/docs/Web/API/Selection_API">Selection API</a> の一部で、文書における現在のテキストの選択が変更された際に発生します。</p>
</div>

<table class="properties">
 <tbody>
  <tr>
   <th scope="row">バブリング</th>
   <td>なし</td>
  </tr>
  <tr>
   <th scope="row">キャンセル</th>
   <td>不可</td>
  </tr>
  <tr>
   <th scope="row">インターフェイス</th>
   <td>{{domxref("Event")}}</td>
  </tr>
  <tr>
   <th scope="row">イベントハンドラープロパティ</th>
   <td>{{domxref("GlobalEventHandlers.onselectionchange", "onselectionchange")}}</td>
  </tr>
 </tbody>
</table>

<h2 id="Examples" name="Examples"></h2>

<pre class="brush: js notranslate">// addEventListener version
document.addEventListener('selectionchange', () =&gt; {
  console.log(document.getSelection());
});

// onselectionchange version
document.onselectionchange = () =&gt; {
  console.log(document.getSelection());
};
</pre>

<h2 id="Specifications" name="Specifications">仕様書</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">仕様書</th>
   <th scope="col">状態</th>
   <th scope="col">備考</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('Selection API', '#selectionchange-event', 'selectionchange')}}</td>
   <td>{{Spec2('Selection API')}}</td>
   <td>初回定義</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>

<p>{{Compat("api.Document.selectionchange_event")}}</p>

<h2 id="See_also" name="See_also">関連情報</h2>

<ul>
 <li>{{domxref("Document/selectstart_event", "selectstart")}}</li>
 <li>{{domxref("Document/getSelection", "Document.getSelection")}}</li>
 <li>{{domxref("Selection", "Selection")}}</li>
</ul>