-
Notifications
You must be signed in to change notification settings - Fork 4
/
304.txt
255 lines (188 loc) · 11.9 KB
/
304.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
[45] [DFN[[RUBYB[カスタム要素]@en[custom element]]]]は、
[[著者]]がその挙動を定義する[[要素]]です。
[46] 予め[[スクリプト]]から[[カスタム要素定義]]を作成しておき、
その定義を使って[[要素]]を作成することで、
以後その[[要素]]の状態が変化した時に [[JavaScript]]
[[コールバック関数]]を実行させることができます。
* 仕様書
[REFS[
- [35] '''[CITE@en-GB-x-hixie[HTML Standard]] ([TIME[2016-04-26 20:56:11 +09:00]] 版) <https://html.spec.whatwg.org/#custom-elements>'''
-- [40] [CITE@en-GB-x-hixie[HTML Standard]] ([TIME[2016-05-14 09:55:50 +09:00]]) <https://html.spec.whatwg.org/#custom-element>
- [33] [CITE@en[DOM Standard]] ([TIME[2016-04-26 17:13:41 +09:00]] 版) <https://dom.spec.whatwg.org/#concept-element-custom-element-state>
- [44] [CITE@en[DOM Standard]] ([TIME[2016-05-12 18:40:36 +09:00]]) <https://dom.spec.whatwg.org/#concept-node-insert>
]REFS]
[HISTORY[
[32] [[Web Components]] の一部として単独の[[仕様書]]で開発が進められてきましたが、
基本的な部分が整い合意に達したとして、2016年4月、
[[HTML Standard]] に統合されました。(一部は [[DOM Standard]] に移されました。)
]HISTORY]
* 概念とプロトコル要素
[43] [[カスタム要素]]には、次の種別があります。
[FIG(middle list)[
- [[自律カスタム要素]]
- [[カスタム化組み込み要素]]
]FIG]
[[自律カスタム要素]]は、独立した[[要素]]であり、その挙動を[[著者]]が完全に実装する必要があります。
[[カスタム化組み込み要素]]は、既存の [[HTML要素]]を拡張し、
その元々の[[意味][要素の意味]]や挙動は維持したまま、
独自の拡張した動作を実装することができます。
[36] その他次のような概念があります。
[FIG(short list)[
- [[妥当なカスタム要素名]]
- [[要素の作成]]
- [[要素の格上げ]]
- [F[カスタム要素状態]]
- [[カスタム要素定義]]
- [[カスタム要素構築子]]
- [[カスタム要素反応]]
- [[カスタム要素反応群スタック]]
]FIG]
* 文書の適合性
[47] [[自律カスタム要素]]の適合性は、[[自律カスタム要素]]を参照。
[48] [[カスタム化組み込み要素]]の適合性は、拡張した元の[[HTML要素]]と変わりありません。
* 構文解析との関係
[49] [[カスタム要素]]が使われている場合、
[[構文解析器]]の動作中に[[スクリプト]]が動作することがあります。
[50] [CODE(JS)@en[document.write]] を呼び出せるという意味では[[カスタム要素]]から[[スクリプト]]を通じて[[構文解析器]]に介入できます。
しかしそれ以外に、例えば[[構文解析器]]の動作モードを直接変化させたりすることはできません。
すべての[[カスタム要素]]は、それ自体は[[スクリプト]]の動作の有無に関わらず同じように[[構文解析]]されます。
* 要素の[F[カスタム]]性
[34] [[要素]]は、[F[カスタム要素状態]]が [CODE[custom]] のとき、
[DFN[[F[[RUBYB[[[カスタム]]]@en[custom]]]]]]であるといいます [SRC[>>33]]。
[41] [DFN[[RUBYB[カスタム要素]@en[custom element]]]]は、
[F[カスタム]]である[[要素]]です。 [SRC[>>40]]
[42] 通常の[[要素]]とは違って、[[カスタム要素]]は、[[構築子][カスタム要素構築子]]や[[プロトタイプ]]を
([[利用者エージェント]]ではなく) [[著者]]が定義します。 [SRC[>>40]]
* 挿入手順群、削除手順群、属性変更手順群
[52] [[カスタム要素反応]]を参照。
* 歴史
[38] [[XBL]] 時代には、[[カスタム要素]]はありませんでした。
[[XHTML]] の世界観では、 [[XHTML]] の標準の[[語彙]]に対し、
独自の拡張は他の[[名前空間]]の[[要素]]や[[属性]]で指定することになっていましたから、
[[XML]] での利用を当初想定していた [[XBL]] も、
任意の[[名前空間]]の[[要素]]で事実上の[[カスタム要素]]を実現することを想定していたものと思われます。
;; この意味で、[[カスタム要素]]は [[XML名前空間]]の代替と言えるかもしれません。
[39] [[Web Components]] では、[[カスタム要素]]機能は、 [CITE[Custom Elements]]
[[仕様書]]として開発が進められました。いくつかの [[JavaScript]]
[[ライブラリー]]で本仕様に従ったもの、またはそれに近いものが実装された他、
[[Chrome]] でも実装が進められました。
;; [[Web Components]] も参照。
[1] [CITE@en[Custom Elements]]
( ([TIME[2013-02-16 19:33:10 +09:00]] 版))
<https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/custom/index.html#monkeypatch-create-element>
[2] [CITE@en[Custom Elements]]
( ([TIME[2013-05-13 23:16:10 +09:00]] 版))
<http://www.w3.org/TR/2013/WD-custom-elements-20130514/>
[3] [CITE@en[Custom Elements]]
( ([TIME[2013-10-24 05:57:19 +09:00]] 版))
<http://www.w3.org/TR/2013/WD-custom-elements-20131024/>
[4] [CITE@en[Re: ''''''[''''''webcomponents'''''']'''''' Seeking status and plans]]
( ([[Dimitri Glazkov]] 著, [TIME[2013-10-03 02:58:19 +09:00]] 版))
<http://lists.w3.org/Archives/Public/public-webapps/2013OctDec/0042.html>
[5] [CITE@en[MathML and dashes in element names]]
( ([[Dimitri Glazkov]] 著, [TIME[2013-11-09 06:07:14 +09:00]] 版))
<http://lists.w3.org/Archives/Public/www-math/2013Nov/0019.html>
[6] [CITE[dglazkov/html-as-custom-elements]]
( ([TIME[2014-05-07 06:06:32 +09:00]] 版))
<https://github.com/dglazkov/html-as-custom-elements>
[7] [CITE@en[Introduction to Web Components]]
( ([TIME[2013-06-05 15:53:16 +09:00]] 版))
<http://www.w3.org/TR/2013/WD-components-intro-20130606/#custom-element-section>
[8] [CITE@en[Custom Elements]]
( ([TIME[2014-12-12 22:31:56 +09:00]] 版))
<http://www.w3.org/TR/2014/WD-custom-elements-20141216/>
[9] [CITE@en[Custom Elements - WHATWG Wiki]]
([TIME[2015-02-02 21:54:23 +09:00]] 版)
<https://wiki.whatwg.org/wiki/Custom_Elements>
[10] [CITE[IRC logs: freenode / #whatwg / 20150225]]
([TIME[2015-02-26 11:33:23 +09:00]] 版)
<http://krijnhoetmer.nl/irc-logs/whatwg/20150225#l-280>
[FIG(quote)[
[FIGCAPTION[
[11] [CITE@en[Official Google Webmaster Central Blog: Easier website development with Web Components and JSON-LD]]
([TIME[2015-04-01 01:09:39 +09:00]] 版)
<http://googlewebmastercentral.blogspot.jp/2015/03/easier-website-development-with-web.html>
]FIGCAPTION]
> JSON-LD and Web Components work really well together. The Custom Element functions as the presentation layer and the JSON-LD functions as the data layer that the custom element and search engines consume. This means you can build custom elements for any schema.org type, such as schema.org/Event and schema.org/LocalBusiness.
]FIG]
[12] [CITE@en[Bug 28547 – Remove the support for inherting from builtin subclasses of HTMLElement and SVGElement]]
([TIME[2015-04-24 12:47:43 +09:00]] 版)
<https://www.w3.org/Bugs/Public/show_bug.cgi?id=28547>
[13] [CITE@en[Custom Elements: "createdCallback" & cloning]]
([[Anne van Kesteren]] 著, [TIME[2015-07-02 16:05:47 +09:00]] 版)
<https://lists.w3.org/Archives/Public/public-webapps/2015JulSep/0012.html>
[14] [CITE[Will any new features be tied to constructors?]]
([TIME[2015-07-03 11:56:41 +09:00]] 版)
<https://esdiscuss.org/topic/will-any-new-features-be-tied-to-constructors>
[15] [CITE@en[The key custom elements question: custom constructors?]]
([[Domenic Denicola]] 著, [TIME[2015-07-16 09:45:29 +09:00]] 版)
<https://lists.w3.org/Archives/Public/public-webapps/2015JulSep/0159.html>
[16] [CITE@en[Custom Elements: insert/remove callbacks]]
([[Anne van Kesteren]] 著, [TIME[2015-05-06 22:45:24 +09:00]] 版)
<https://lists.w3.org/Archives/Public/public-webapps/2015AprJun/0517.html>
[17] [CITE@en[Apple's updated feedback on Custom Elements and Shadow DOM]]
([[Maciej Stachowiak]] 著, [TIME[2015-07-21 10:17:24 +09:00]] 版)
<https://lists.w3.org/Archives/Public/public-webapps/2015JulSep/0204.html>
[18] [CITE[Update on standardizing shadow DOM and custom elements — Anne’s Blog]]
([TIME[2015-07-29 12:37:42 +09:00]] 版)
<https://annevankesteren.nl/2015/07/shadow-dom-custom-elements-update>
[19] [CITE@en[Custom elements "Constructor-Dmitry" baseline proposal]]
([[Domenic Denicola]] 著, [TIME[2015-08-18 07:19:58 +09:00]] 版)
<https://lists.w3.org/Archives/Public/public-webapps/2015JulSep/0304.html>
[20] [CITE@en[Apple's feedback for custom elements]]
([[Ryosuke Niwa]] 著, [TIME[2016-01-24 17:01:38 +09:00]] 版)
<https://lists.w3.org/Archives/Public/public-webapps/2016JanMar/0059.html>
[21] [CITE@en[''''''[''''''custom-elements'''''']'''''' Steps inside HTMLElement's constructor]]
([[Ryosuke Niwa]] 著, [TIME[2016-02-23 15:46:47 +09:00]] 版)
<https://lists.w3.org/Archives/Public/public-webapps/2016JanMar/0113.html>
[22] [CITE@en[Custom Elements]]
([TIME[2016-02-27 00:19:47 +09:00]] 版)
<https://www.w3.org/TR/2016/WD-custom-elements-20160226/>
[23] [CITE@en[Large custom element spec rewrite to implement some F2F decisions · w3c/webcomponents@d95392f]]
([TIME[2016-03-04 15:53:57 +09:00]] 版)
<https://github.com/w3c/webcomponents/commit/d95392f734895b2c72e1822f464dd70a22b322a4>
[24] [CITE@en[Decouple Custom Elements from HTML Imports · w3c/webcomponents@6953f9f]]
([TIME[2016-03-08 18:49:01 +09:00]] 版)
<https://github.com/w3c/webcomponents/commit/6953f9f5a36d3221407b4c6735e6ff927f8cb45f>
[30] [CITE@en[Custom Elements]] ([TIME[2016-04-08 20:17:59 +09:00]] 版) <https://w3c.github.io/webcomponents/spec/custom/>
[25] [CITE@en[Add support for custom elements · whatwg/dom@7f63535]]
([TIME[2016-04-13 22:16:46 +09:00]] 版)
<https://github.com/whatwg/dom/commit/7f63535da39a1cbf7f8f68563abc6f05f760990a>
[26] [CITE@en[Home · whatwg/dom Wiki]]
([TIME[2016-04-13 22:29:55 +09:00]] 版)
<https://github.com/whatwg/dom/wiki>
[27] [CITE@en[Editorial: update custom element cross-spec references · whatwg/dom@3536dd9]]
([TIME[2016-04-20 15:28:47 +09:00]] 版)
<https://github.com/whatwg/dom/commit/3536dd95dbc6bad216f414d34de6c6805db67e6f>
[28] [CITE@en[Add custom elements to HTML · whatwg/html@6e7eaa4]]
([TIME[2016-04-26 18:03:28 +09:00]] 版)
<https://github.com/whatwg/html/commit/6e7eaa4bd2912965fd83766f99f984f249531f3a>
[29] [CITE@en[Upstream Custom Elements by domenic · Pull Request #204 · whatwg/dom]]
([TIME[2016-04-26 18:27:38 +09:00]] 版)
<https://github.com/whatwg/dom/pull/204>
[FIG(quote)[
[FIGCAPTION[
[31] [CITE@en[Custom Elements]]
([TIME[2016-04-08 20:17:59 +09:00]] 版)
<https://w3c.github.io/webcomponents/spec/custom/>
]FIGCAPTION]
> Sections which explicitly modify existing parts of these specifications are denoted with "DOM+", "HTML+", or "Web IDL+" in their titles.
]FIG]
[37] [CITE@en[New Web Components editor]]
([[Léonie Watson]] 著, [TIME[2016-04-27 03:00:20 +09:00]] 版)
<https://lists.w3.org/Archives/Public/public-webapps/2016AprJun/0068.html>
[51] [CITE@en[Custom Elements]]
( ([TIME[2016-05-18 06:12:39 +09:00]]))
<https://www.w3.org/TR/2016/WD-custom-elements-20160517/>
[53] [CITE@en[Sync custom elements with upstream]]
( ([[domenic]]著, [TIME[2016-05-21 05:56:12 +09:00]]))
<https://github.com/w3c/webcomponents/commit/37eb6275e9d214530973d26ff5a36dff2b55b819>
[54] [CITE@en[Custom Elements]]
( ([TIME[2016-05-24 00:44:27 +09:00]]))
<https://www.w3.org/TR/2016/WD-custom-elements-20160523/>
[55] [CITE@en[Bug 150225 – Prototype custom element API]]
( ([TIME[2016-06-01 12:40:58 +09:00]]))
<https://bugs.webkit.org/show_bug.cgi?id=150225>
[56] [CITE@en[20653 – need a way for Web Components to cause new interface objects to exist dynamically]]
( ([TIME[2016-06-03 18:04:15 +09:00]]))
<https://www.w3.org/Bugs/Public/show_bug.cgi?id=20653>