-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathHTML-infrastructure-ja.html
2888 lines (2655 loc) · 96.3 KB
/
HTML-infrastructure-ja.html
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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html><html lang="ja"><head><meta charset="utf-8">
<title>HTML Standard — Common infrastructure(日本語訳)</title>
<link rel="stylesheet" href="common.css" type="text/css" />
<link rel="stylesheet" href="common-whatwg.css" type="text/css" />
<script src="common0.js" ></script>
<script src="common1.js" async></script>
<script>
Util.ready = function(){
const source_data = {
toc_main: 'infrastructure',
generate: expand,
};
Util.switchWordsInit(source_data);
}
function expand(){
const class_map = this.class_map;
const tag_map = this.tag_map;
const link_map = this.link_map;
return this.html.replace(
/%[\w\-~一-鿆あ-ん]+|`(.+?)([$@\^])(\w*)/g,
create_html
);
function create_html(match, key, indicator, klass){
if(!key) {//%
return `<var>${match.slice(1)}</var>`;
}
let href = '';
let href1 = '';
{
const n = key.indexOf('@');
if(n > 0) {
href1 = key.slice(n + 1);
key = key.slice(0, n);
}
}
let text = key;
switch(klass){
case 'r':
text = `[${key}]`;
href = `HTML-references.html#refs${key}`;
break;
case 'l':
text = `"<code class="literal">${text}</code>"`;
break;
case 'I':
break;
case 'U':
text = `U+${key}`;
break;
case 'en':
return `<span lang="en">${key}</span>`;
break;
}
let tag = tag_map[klass];
if(tag) {
let classname = class_map[klass];
classname = classname ? ` class="${classname}"` : '';
text = `<${tag}${classname}>${text}</${tag}>`;
}
if(indicator !== '^'){
href = href1 || link_map[ klass ? `${klass}.${key}` : key ] || href;
if(!href){
console.log(match); // check error
return match;
}
switch(indicator){
case '$':
text = `<a href="${href}">${text}</a>`;
break;
case '@':
text = `<dfn id="${href.slice(1)}">${text}</dfn>`;
break;
}
}
return text;
}
}
</script>
<script type="text/plain" id="_source_data">
●●options
spec_date:2024-12-17
trans_update:2025-03-15
source_checked:240619
page_state_key:HTML
spec_status:LS
original_url:https://html.spec.whatwg.org/multipage/infrastructure.html
abbr_url:HTMLINFRA
nav_prev:HTML-introduction-ja.html
nav_next:HTMLcms
trans_1st_pub:2016-01-28
●●class_map
e:element
a:attr
p:property
v:value
P:production
E:error
jv:js-value
et:event-type
st:attr-state
U:code-point
cn:cp-name
css:css
●●tag_map
I:code
m:code
E:code
c:code
e:code
a:code
p:code
v:code
jv:code
et:code
st:i
P:code
dfn:dfn
i:i
U:span
cn:span
css:code
em:em
cite:cite
●●original_urls
●●original_id_map
●●link_map
●idl
E.TypeError:~TC39#sec-native-error-types-used-in-this-standard-typeerror
I.Node:~DOM4#node
I.Text:~DOM4#text
I.HTMLScriptElement:~HEscripting#htmlscriptelement
I.Document:~HTMLdom#document
文書:~HTMLdom#the-document-object
I.Screen:~CSSOMVIEW#the-screen-interface
m.elements:~HEforms#dom-form-elements
●element
e.article:~HEsections#the-article-element
e.body:~HEsections#the-body-element
e.button:~HEforms#the-button-element
e.script:~HEscripting#the-script-element
e.blockquote:~HEgrouping#the-blockquote-element
e.address:~HEsections#the-address-element
e.div:~HEgrouping#the-div-element
e.b:~HEtextlevel#the-b-element
e.i:~HEtextlevel#the-i-element
e.span:~HEtextlevel#the-span-element
●attr
a.style:~HTMLdom#attr-style
a.popover:~HTMLpopover#attr-popover
●keywords, etc.
et.blur:~HTMLindex#event-blur
et.change:~HTMLindex#event-change
l.autoplay:#autoplay-feature
l.cross-origin-isolated:#cross-origin-isolated-feature
l.focus-without-user-activation:#focus-without-user-activation-feature
c.text/plain:~RFCx/rfc2046#section-4.1.3
c.application/octet-stream:~RFCx/rfc2046#section-4.5.1
P.Name:~TR/xml/#NT-Name
P.QName:~TR/REC-xml-names#NT-QName
展開名:~XPATH10#dt-expanded-name
P.expanded-name:~TR/1999/REC-xpath-19991116/#dt-expanded-name
●
内容~属性:#_content-attribute
~IDL属性:#_idl-attribute
資源:#_resource
並列的:#in-parallel
即時:#immediately
並列~queue:#parallel-queue
新たな並列~queueを開始する:#starting-a-new-parallel-queue
新たな並列~queueを開始-:#starting-a-new-parallel-queue
手続きを~enqueueする:#enqueue-the-following-steps
~algo~queue:#algorithm-queue
必須な下位資源:#critical-subresources
~HTML要素:#html-elements
要素~型:#element-type
~XML互換:#xml-compatible
無視される:#ignore
文書の中へ挿入された:#insert-an-element-into-a-document
文書から除去された:#remove-an-element-from-a-document
~HTML要素~挿入-時の手続き:#html-element-insertion-steps
~HTML要素~除去-時の手続き:#html-element-removing-steps
~HTML要素~接続~後の手続き:#html-element-post-connection-steps
~HTML要素~移動-時の手続き:#html-element-moving-steps
~liveである:#live
接続された:#becomes-connected
切断された:#becomes-disconnected
閲覧~文脈に接続されて:#browsing-context-connected
閲覧~文脈に接続された:#becomes-browsing-context-connected
閲覧~文脈から切断された:#becomes-browsing-context-disconnected
~plugin:#plugin
文字~符号化法:#encoding
符号化法:#encoding
符号化法~名:#encoding-name
符号化法~label:#encoding-label
適用-可能な仕様:#other-applicable-specifications
適合~文書:#conforming-documents
:#non-interactive
:#renderingUA
:#non-scripted
:#conformance-checkers
:#data-mining
:#editors
●用語(HTML
~flow内容:~HTMLdom#flow-content-2
内部~資源~link群を処理する:~HTMLlinks#process-internal-resource-links
子~navigable:~HTMLds#child-navigable
~navigable:~HTMLds#navigable
閲覧~文脈:~HTMLds#browsing-context
属する閲覧~文脈:~HTMLds#concept-document-bc
~XML構文:~HTMLxml#the-xhtml-syntax
~HTML構文:~HTMLwriting#syntax
~custom形式:~HTMLwriting#writing
~scripting~flag:~HTMLparsing#scripting-flag
~HTML構文解析器:~HTMLparsing#html-parser
~open要素~stack:~HTMLparsing#stack-of-open-elements
構文解析を停止する:~HTMLparsing#stop-parsing
~open要素~stack:~HTMLparsing#stack-of-open-elements
~HTML構文解析器:~HTMLparsing#html-parser
~event~loop:~WAPI#event-loop
関連な大域~obj:~WAPI#concept-relevant-global
関連な~realm:~WAPI#concept-relevant-realm
大域~taskを~queueする:~WAPI#queue-a-global-task
~DOM操作~task~source:~WAPI#dom-manipulation-task-source
~form所有者:~HTMLforms#form-owner
~formに所有され得る要素:~HEforms#form-associated-element
~form所有者を設定し直す:~HTMLforms#reset-the-form-owner
構文解析器が挿入したか:~HTMLforms#parser-inserted-flag
doc.指名する被focus区画:~HTMLinteraction#focused-area-of-the-document
~objを~unfocusする:~HTMLinteraction#unfocusing-steps
~objを~focusする:~HTMLinteraction#focusing-steps
~focusを更新する:~HTMLinteraction#focus-update-steps
~popover要素:~HTMLpopover#_popover-element
st.~popoverなし:~HTMLpopover#attr-popover-none-state
~popoverを隠す:~HTMLpopover#hide-popover-algorithm
文書の~outline:~HEsections#outline
文書の現在の準備度を更新する:~HTMLdom#update-the-current-document-readiness
~navi~algo:~HTMLnav#navigate
~navi~API:~HTMLnavAPI#window-navigation-api
進行中な~naviの間に~focusは変化したか:~HTMLnavAPI#focus-changed-during-ongoing-navigation
●用語(他
新たな~promise:~WEBIDLjs#a-new-promise
~node文書:~DOM4#concept-node-document
挿入-時の手続き:~DOM4#concept-node-insert-ext
除去-時の手続き:~DOM4#concept-node-remove-ext
接続~後の手続き:~DOM4#concept-node-post-connection-ext
移動-時の手続き:~DOM4#concept-node-move-ext
~HTML文書:~DOM4#html-document
~XML文書:~DOM4#xml-document
文書~tree内:~DOM4#in-a-document-tree
接続されて:~DOM4#connected
~shadowも含めた根:~DOM4#concept-shadow-including-root
~tree:~DOM4#concept-tree
広義-子孫:~DOM4#concept-tree-inclusive-descendant
el.局所~名:~DOM4#concept-element-local-name
el.名前空間:~DOM4#concept-element-namespace
●他
故意的な違反:~INFRA#willful-violation
~list:~INFRA#list
付加する:~INFRA#list-append
~queue:~INFRA#queue
~dequeueする:~INFRA#queue-dequeue
~enqueueする:~INFRA#queue-enqueue
~HTML名前空間:~INFRA#html-namespace
制御~文字:~INFRA#control
~ASCII小文字~化する:~INFRA#ascii-lowercase
長さ:~INFRA#string-length
~XML~MIME型:~MIMESNIFF#xml-mime-type
~HTML~MIME型:~MIMESNIFF#html-mime-type
実装定義:~INFRA#implementation-defined
施策により制御される特能:~PERMISSIONS-POLICY#policy-controlled-feature
既定の許容list:~PERMISSIONS-POLICY#policy-controlled-feature-default-allowlist
~CSS~stylesheet:~CSSOM1#css-style-sheet
表示域:~CSS2J#viewport
●●words_table1
XPATH10:XML/xpath10-ja.html
●●words_table
●IDL/データ/構造
open:
切断-:disconnect::~
渡-:pass
●処理
並列:parallel::~
並列処理:parallelism::~
競争:race condition::~
競争:the race
立上げる:launchする:立ち上げる
準備度:readiness::~
協力的:cooperative:~
~~同時並行的:, at the same time
error含みの:erroneous
instance化:instantiate
同時に:simultaneous
^en:multitasking, fibers, threads, processes
^en:hyperthread, core, CPU, machine
%挿入される~node:insertedNode
%挿入された~node:insertedNode
%除去される~node:removedNode
%移動された~node:movedNode
%旧-親:oldParent
%大域~obj:global
●構文/形式
展開-:expand::~
展開:expansion::~
展開名:expanded-name::~
式:expression::~
MARK
UTF-16
UTF-8
圧縮:compression::~
形式変換-:transform::~
形式変換:transformation::~
変換器:converter::~
文字大小比較:case sensitivity::文字大小の区別
符号:sign
●UI/呈示/資源/媒体/CSS
PDF:
XPath:
DTD:
SGML:
XSLT:
WYSIWYG:
PNG:
MPEG-4:
multimedia::::マルチメディア
動画:movie
viewer::::ビューア
contrast::::コントラスト
印刷機:printer:~:::プリンタ
italic:
被focus:focused::被 focus:被フォーカス
unfocus::::未フォーカスに
部品:component:~
本格的な:fully-fledged:~
小論:essay:~
報告書:report:~
ranging from short static documents to long essays or reports with rich multimedia, as well as to fully-fledged interactive applications
頭上display:overhead display:頭上 display::頭上ディスプレイ
取込まれ:importされ::取り込まれ
取込む:importする::取り込む
popover:
隠す:hideする:~
●仕様/適合
proprietary::::プロプライエタリ
集析:mining::~::マイニング
junk::::ジャンク
危険:dangerous:~
特権:privilege::~
必須:critical:~
不可欠:integral:~
皆:everyone:~
正当:legitimate:~
正当でないわけではない:legitimate
区別:distinguish:~
類別:class:~
選択肢:option::~::オプション
中立的:neutral:~
-compatible
多彩:rich:~
措置:measure:~
本当に:realに:~
機械的に:machineで:~
活動:activity:~
素材:material:~
緊急:emergency:~
範囲t:extent:範囲
極端:extreme:~
能力を有する:capable of
解消-:solve:~
理想的:ideal:~
移行:migration:~
合意-:agree:~
矛盾-:contradict:~
句され:phraseされ:記され
免除-:exempt:~
指名-:designate:~
behavior
推定-:infer:~
準拠-:comply:~
証明-:prove:~
誤用-:misuse:~
欠く:lackする:~
収まる:fitする:~
判定:judgement:~
問われる:matter
動機にある:motivated
足らない:insufficient
適合するかどうか:conformity
特段の注意を払う:take extreme care:
その限りにおいて:As far as conformance goes
別の仕方で記すなら、:To put it another way
好きに:please
例えば:say
:retrieve
-:accurate
に関して言えば:In terms of
つつ:still
に~~識別され:label
様々な:wide variety
ことになる:ends up
〜易く:easy
重きを置く:great for
したとする:imagine
策定:solution
難が生じる:suffers from
とりあえず:tentatively
-:on that front
自由はない:not free to
成し得ない:cannot constitute
に依存しない:-independent
適合しない:non-conforming/non-conformant
適合しなくなる:causes the non-conformance
既定~法:defaulting
知れない:unbeknownst
称され:refer
前述の:aforementioned
opt to
選ぶ際の判断材料:make informed choices
最大限に活用する:making liberal use of
活用-:leverage
~~悪化-:reduce
利用者~層の細分化を招くfragments the user base
互いに重なり合う:overlapping
~~分類される:category/fall into
種類に分けられる:fall into 〜 categories
大別され:come in two broad varieties
:left off
:opt to
-:meant
できなく:prevent
:said
:say
~~扱い方:Dealing with
外す:omit
●privacy/保安
許容list:allowlist::許容 list:許容リスト
●未分類
増やす:increaseする:~
出現-:appear:~
引用-:quote:~
引用:quote:~
編集-:edit:~
編集:editing:~
選択-:select:~
見出し:heading:~
editor::::エディタ
outline::::アウトライン
battery-life:battery life:::バッテリ寿命
増分的:incremental:~
連絡先:contact::~
広義-:inclusive:~
登録-済み:registered
-:past
-:informed
追い:follow
書-:write
置く:put
:having
指す:refer する
数え:count
置いた:put
-:track
-:basis
part
time
:place
時間を共有する:time-sharing
きちんと構造~化された:well-structured
●指示語
一定の:certain:~
現在:currently:~
一時的:transient:~
-:second
-:themselves
2 回:twice
:respectively
もある:sometimes
:using
oldParent
qualified
~~選択的に組み込む:opt
およそ:likely
何ら:whatsoever
まったく:quite/at all
以前の:previous
~~元の:new
旧:old
短い:short
片:fragment
一員:a member
逆に:as opposed to
順番に:in series
何も〜ない:nothing
最も近い:nearest
さらに:furthermore
●●trans_metadata
<p>
~THIS_PAGEは、~WHATWGによる HTML 仕様の
<a href="~SPEC_URL">§ Common infrastructure</a>
の一部を成す
§ Terminology,
§ Policy-controlled features
を日本語に翻訳したものです。
~PUB
</p>
</script>
</head>
<body>
<header>
<hgroup>
<h1>HTML — 共通基盤</h1>
</hgroup>
</header>
<main id="MAIN" hidden>
<section id="infrastructure">
<h2 title="Common infrastructure">2. 共通~基盤</h2>
<p>
この仕様は
`Infra^cite `INFRA$r
に依存する。
◎
This specification depends on Infra. [INFRA]
</p>
<section id="terminology">
<h3 title="Terminology">2.1. 各種用語</h3>
<p>
この仕様は、
同じ文脈~内で[[
~HTML/~XML
]属性,
~IDL属性(~IDL~interfaceに定義される属性)
]どちらも指すことが多い。
どちらを指すか明瞭でない所では、[
~HTML/~XML
]属性を指す所では
`内容~属性@
と称され,
~IDL属性を指す所では
`~IDL属性@
と称される。
類似に、
用語 “~prop” も,[
~JS~obj~prop, ~CSS~prop
]どちらにも利用される
— 多義的になる所では、
順に[
`~obj~prop^dfn,
`~CSS~prop^dfn
]と称される。
◎
This specification refers to both HTML and XML attributes and IDL attributes, often in the same context. When it is not clear which is being referred to, they are referred to as content attributes for HTML and XML attributes, and IDL attributes for those defined on IDL interfaces. Similarly, the term "properties" is used for both JavaScript object properties and CSS properties. When these are ambiguous they are qualified as object properties and CSS properties respectively.
</p>
<p>
仕様にて,ある特能を[
`~HTML構文$, `~XML構文$
]のいずれかに適用するよう言明される所では、
一般に,他方も含まれる。
ある特能を,この 2 つの言語の片方に限り特定的に適用する所では、
次のように,他方の形式には適用されないものと言明される
⇒
“~HTML に対しては、 ... (これは~XMLには適用されない)”。
◎
Generally, when the specification states that a feature applies to the HTML syntax or the XML syntax, it also includes the other. When a feature specifically only applies to one of the two languages, it is called out by explicitly stating that it does not apply to the other format, as in "for HTML, ... (this does not apply to XML)".
</p>
<p>
この仕様においては、
~HTMLのどの利用を指すときも,用語
`文書^dfn
を利用する
— 短い静的な文書から,多彩な~multimediaを伴う長い小論や報告書,更には本格的な対話的~appに至るまで。
この用語は、
文脈に依存して[
`Document$I ~objと その子孫~DOM~tree
], [[
`~HTML構文$ / `~XML構文$
]を利用して直列化された~byte~stream
]いずれかを指す:
◎
This specification uses the term document to refer to any use of HTML, ranging from short static documents to long essays or reports with rich multimedia, as well as to fully-fledged interactive applications. The term is used to refer both to Document objects and their descendant DOM trees, and to serialized byte streams using the HTML syntax or the XML syntax, depending on context.
</p>
<ul>
<li>
~DOM構造の文脈における用語[
`~HTML文書$ / `~XML文書$
]は、
`DOM^cite `DOM$r にて定義される, 2 つの異なる~modeを特定的に指す。
`文書$は、
このいずれかの~mode下に属する。
(そのような利用は、
常にその定義に~hyperlinkされる。)
◎
In the context of the DOM structures, the terms HTML document and XML document are used as defined in DOM, and refer specifically to two different modes that Document objects can find themselves in. [DOM] (Such uses are always hyperlinked to their definition.)
</li>
<li>
~byte~streamの文脈における用語[
~HTML文書 / ~XML文書
]は、[
`~HTML~MIME型$ / `~XML~MIME型$
]の資源を指す。
◎
In the context of byte streams, the term HTML document refers to resources labeled as text/html, and the term XML document refers to resources labeled with an XML MIME type.
</li>
</ul>
<hr>
<p>
~~記述を単純にするため、
利用者~向けに文書を具現化する仕方を指す所では,[
“示される( `shown^en )” /
“表示される( `displayed^en )” /
“可視( `visible^en )”
]などの用語が利用されることもある。
これらの用語は、
視覚-媒体のみを含意するものではなく,[
他の媒体にも等価な仕方で適用される
]と見なすモノトスル。
◎
For simplicity, terms such as shown, displayed, and visible might sometimes be used when referring to the way a document is rendered to the user. These terms are not meant to imply a visual medium; they must be considered to apply to other media in equivalent ways.
</p>
<section id="parallelism">
<h4 title="Parallelism">2.1.1. 並列処理</h4>
<p>
所与の手続きを
`並列的@
( `parallel^en )に走らすとは、
その手続きを,この標準~内の他の~logicと~~同時並行的に走らすことを意味する
(例: `~event~loop$と~~同時並行的に)。
この標準は、
これが達成される精確な仕組みは定義しない
— 例えば、
時間を協力的に共有する[
`multitasking, fibers, threads, processes^en
], あるいは異なる[
`hyperthread, core, CPU, machine^en
]の利用, 等々。
対照的に,
`即時@
( `immediate^en )に走らす演算は、
現在~走っている~taskを中断して,
当の演算を走らせ終えてから, 中断した~taskを再開するモノトスル。
◎
To run steps in parallel means those steps are to be run, one after another, at the same time as other logic in the standard (e.g., at the same time as the event loop). This standard does not define the precise mechanism by which this is achieved, be it time-sharing cooperative multitasking, fibers, threads, processes, using different hyperthreads, cores, CPUs, machines, etc. By contrast, an operation that is to run immediately must interrupt the currently running task, run itself, and then resume the previously running task.
</p>
<p class="note">注記:
並列処理を活用して仕様を書く指導については、
`§ 他の仕様における~event~loopの~~扱い方@~WAPI#event-loop-for-spec-authors$を見よ。
◎
For guidance on writing specifications that leverage parallelism, see Dealing with the event loop from other specifications.
</p>
<p>
`並列的$に走る複数の~algoが同じ~dataに対し演算するときの競争を避けるためには、
`並列~queue$を利用できる。
◎
To avoid race conditions between different in parallel algorithms that operate on the same data, a parallel queue can be used.
</p>
<p>
`並列~queue@
は、[
順番に走らすモノトスル,~algo手続きたち
]からなる~queueを表現する。
◎
A parallel queue represents a queue of algorithm steps that must be run in series.
</p>
<p>
各`並列~queue$は、
`~algo~queue@
を持つ
— それは、
`~queue$であり,初期~時は空とする。
◎
A parallel queue has an algorithm queue (a queue), initially empty.
</p>
<div class="algo">
<p>
`並列~queue$ %並列~queue に所与の
`手続きを~enqueueする@
~algoは
⇒
%並列~queue の`~algo~queue$に,その手続きを`~enqueueする$
◎
To enqueue steps to a parallel queue, enqueue the algorithm steps to the parallel queue's algorithm queue.
</p>
</div>
<div class="algo">
<p>
`新たな並列~queueを開始する@
~algoは:
◎
To start a new parallel queue, run the following steps:
</p>
<ol>
<li>
%並列~queue ~LET 新たな`並列~queue$
◎
Let parallelQueue be a new parallel queue.
</li>
<li class="algo">
<p>
この段は、
`並列的$に走らす:
◎
Run the following steps in parallel:
</p>
<ol>
<li>
<p>
~WHILE 無条件:
◎
While true:
</p>
<ol>
<li>
%手続き ~LET %並列~queue の`~algo~queue$から`~dequeueする$
◎
Let steps be the result of dequeueing from parallelQueue's algorithm queue.
</li>
<li>
%手続き を走らす
( %手続き が空なら何もしないことになる)
◎
If steps is not nothing, then run steps.
</li>
<li>
~Assert:
%手続き を走らせても例外は投出されない
— `並列的$に走っている手続きには、
投出することは許容されないので。
◎
Assert: running steps did not throw an exception, as steps running in parallel are not allowed to throw.
</li>
</ol>
<p class="note">注記:
これは、
継続的に走らす~loopとして実装することを実装に期待するものではない。
標準における~algoには、
理解し易くなるよう,~battery-lifeや処理能に重きを置くことは必要yでないので。
◎
Implementations are not expected to implement this as a continuously running loop. Algorithms in standards are to be easy to understand and are not necessarily great for battery life or performance.
</p>
</li>
</ol>
</li>
<li>
~RET %並列~queue
◎
Return parallelQueue.
</li>
</ol>
</div>
<p class="note">注記:
`並列的$に走っている手続き自身も,他の手続きを`並列的$に走らすことができる。
例:
`並列~queue$の内側で、
一連の段を,当の~queueにて並列的に走らすことも有用になり得る。
◎
Steps running in parallel can themselves run other steps in in parallel. E.g., inside a parallel queue it can be useful to run a series of steps in parallel with the queue.
</p>
<div class="example">
<p>
ある標準が[
`~list$ %名前~list と,
%名前 を %名前~list に追加する~method
]を定義しようとしているとする
— この~methodは、[
%名前 ~IN %名前~list
]のときは却下するとする。
◎
Imagine a standard defined nameList (a list), along with a method to add a name to nameList, unless nameList already contains name, in which case it rejects.
</p>
<p>
次のように策定した場合、
競争の難が生じる:
◎
The following solution suffers from race conditions:
</p>
<ol>
<li>
%p ~LET `新たな~promise$( コレに`関連な~realm$ )
◎
Let p be a new promise created in this's relevant realm.
</li>
<li>
%大域~obj ~LET コレに`関連な大域~obj$
◎
Let global be this's relevant global object.
</li>
<li class="algo">
<p>
この段は、
`並列的$に走らす:
◎
Run the following steps in parallel:
</p>
<ol>
<li>
<p>
~IF[
%名前 ~IN %名前~list
]:
◎
If nameList contains name,\
</p>
<ol>
<li>
<p>
`大域~taskを~queueする$( `~DOM操作~task~source$, %大域~obj, 次の手続き )
◎
then queue a global task on the DOM manipulation task source given global\
</p>
<div class="algo">
手続きは
⇒
`TypeError$E で %p を却下する;
◎
to reject p with a TypeError,\
</div>
</li>
<li>
~RET
◎
and abort these steps.
</li>
</ol>
</li>
<li>
(何らかの長くかかり得る作業を行う)
◎
Do some potentially lengthy work.
</li>
<li>
%名前~list に %名前 を`付加する$
◎
Append name to nameList.
</li>
<li>
<p>
`大域~taskを~queueする$( `~DOM操作~task~source$, %大域~obj, 次の手続き )
◎
Queue a global task on the DOM manipulation task source given global\
</p>
<div class="algo">
手続きは
⇒
`undefined^jv で %p を解決する
◎
to resolve p with undefined.
</div>
</li>
</ol>
</li>
<li>
~RET %p
◎
Return p.
</li>
</ol>
<p>
上の手続きを 2 回~呼出した場合,
2 つが同時に走っている間、
段 2.1 の時点では %名前 は %名前~list 内に無い場合でも,
段 2.3 が走る前に他方により`追加されるかもしれない^em
— その結果、
%名前~list 内に %名前 が 2 回~現れることになる。
◎
Two invocations of the above could run simultaneously, meaning name isn't in nameList during step 2.1, but it might be added before step 2.3 runs, meaning name ends up in nameList twice.
</p>
<p>
並列~queueは、
これを解消する。
当の標準は、[
`新たな並列~queueを開始-$した結果の`並列~queue$ %名前~list~queue
]を得ておいた上で:
◎
Parallel queues solve this. The standard would let nameListQueue be the result of starting a new parallel queue, then:
</p>
<ol>
<li>
%p ~LET `新たな~promise$( コレに`関連な~realm$ )
◎
Let p be a new promise created in this's relevant realm.
</li>
<li>
%大域~obj ~LET コレに`関連な大域~obj$
◎
Let global be this's relevant global object.