/
820.txt
59 lines (46 loc) · 2.39 KB
/
820.txt
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
[5] [[コレクション]]などが [DFN[[[live]]]] あるいは[DFN[[RUBYB[[[静的]]]@en[static]]]]とは、
[[コレクション]]に含まれるデータが [[DOM]] の変化に伴い随時変化すること、
あるいはしないことをいいます。
* 仕様書
[REFS[
- [3] [CITE@en-US[DOM Standard]] ([TIME[2014-06-23 14:49:32 +09:00]] 版) <http://dom.spec.whatwg.org/#concept-collection-live>
- [4] [CITE@en-US[DOM Standard]] ([TIME[2014-06-23 14:49:32 +09:00]] 版) <http://dom.spec.whatwg.org/#concept-collection-static>
- [9] [CITE@en-US[DOM Standard]] ([TIME[2014-06-23 14:49:32 +09:00]] 版) <http://dom.spec.whatwg.org/#dom-element-attributes>
]REFS]
* 定義
[6] [[コレクション]]は、 [[live]] または[[静的]]のいずれかです [SRC[>>3, >>4]]。
仕様上明記されていない限り [[live]] です [SRC[>>3]]。
[7] [[コレクション]]が [[live]] であるなら、ある時点での[[スナップショット]]ではなく、
実際の裏のデータを操作しなければ[['''なりません''']] [SRC[>>3]]。
[10] [[read only array]] が [[live]] の時も、同様に実際のデータを反映させなければ[['''なりません''']]
[SRC[>>9]]。
[EG[
[8] 例えば、
[PRE(JS code)[
list = document.getElementsByTagName ('p');
console.log (list.length);
document.body.appendChild (document.createElement ('p'));
console.log (list.length);
]PRE]
... で表示される [CODE(DOMa)@en[[[length]]]] は、1回目より2回目の方が1大きな値となります。
]EG]
[12] 定義上は [[live]] とはされていませんが、 [CODE(DOMi)@en[[[Range]]]]
も対象となる[[木]]への変更がリアルタイムで反映されます。
* live なオブジェクトの一覧
[11] [[live]] なオブジェクトには次のものがあります。
[FIG(list)[
- [CODE(DOMi)@en[[[NodeList]]]] (一部を除く)
- [CODE(DOMi)@en[[[HTMLCollection]]]]
- [CODE(DOMi)@en[[[NamedNodeMap]]]]
- [CODE(DOMi)@en[[[NodeIterator]]]]
- [CODE(DOMi)@en[[[Element]]]] [CODE(DOMa)@en[[[attributes]]]] ([[read only array]])
]FIG]
* 歴史
[REFS[
- [1] [CITE@en[HTML5 Revision Tracker]]
([TIME[2010-03-18 21:24:19 +09:00]] 版)
<http://html5.org/tools/web-apps-tracker?from=4856&to=4857>
- [2] [CITE[IRC logs: freenode / #whatwg / 20140204]]
( ([TIME[2014-02-05 20:30:59 +09:00]] 版))
<http://krijnhoetmer.nl/irc-logs/whatwg/20140204>
]REFS]