Skip to content

Commit 2466bcb

Browse files
[HTML] Add runScripts to SetHTMLUnsafeOptions whatwg/html@da0830e
+ Remove superfluous canonicalization of Sanitizer config whatwg/html@15ce0d1 (和訳には織り込み済み)
1 parent d79a65a commit 2466bcb

2 files changed

Lines changed: 76 additions & 13 deletions

File tree

HTML-dom-ja.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@
139139

140140
●●options
141141

142-
spec_date:2026-06-03
143-
trans_update:2026-06-10
142+
spec_date:2026-06-10
143+
trans_update:2026-06-11
144144
source_checked:260312
145145
page_state_key:HTML
146146
spec_status:LS
@@ -278,7 +278,7 @@
278278
I.HTMLOrSVGOrMathMLElement:#htmlorsvgelement
279279
I.ShowPopoverOptions:#showpopoveroptions
280280
I.TogglePopoverOptions:#togglepopoveroptions
281-
I.SetHTMLUnsafeOptions:~HTMLdynamic#sethtmlunsafeoptions
281+
I.ParseHTMLUnsafeOptions:~HTMLdynamic#parsehtmlunsafeoptions
282282
I.SetHTMLOptions:~HTMLdynamic#sethtmloptions
283283

284284
I.HTMLUnknownElement:#htmlunknownelement
@@ -2225,7 +2225,7 @@ <h4 title="The Document object">3.1.1. `Document^I ~obj</h4>
22252225

22262226
[`LegacyOverrideBuiltIns$]
22272227
partial interface `Document@I {
2228-
static `Document$I `parseHTMLUnsafe$m((`TrustedHTML$ or DOMString) %html, optional `SetHTMLUnsafeOptions$I %options = {});
2228+
static `Document$I `parseHTMLUnsafe$m((`TrustedHTML$ or DOMString) %html, optional `ParseHTMLUnsafeOptions$I %options = {});
22292229
static `Document$I `parseHTML$m(DOMString %html, optional `SetHTMLOptions$I %options = {});
22302230

22312231
// <span class="comment">
@@ -5796,7 +5796,7 @@ <h4 title="Element definitions">3.2.4. 要素~定義</h4>
57965796
( `Sanitization^en )
57975797
</dt>
57985798
<dd>
5799-
<p>
5799+
<p>
58005800
各~要素~用の無毒化~情報は、
58015801
`無毒化~分類$を定義する
58025802
— それは:

HTML-dynamic-markup-insertion-ja.html

Lines changed: 71 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@
116116

117117
●●options
118118

119-
spec_date:2026-06-03
120-
trans_update:2026-06-10
119+
spec_date:2026-06-10
120+
trans_update:2026-06-11
121121
source_checked:240415
122122
page_state_key:HTML
123123
spec_status:LS
@@ -144,6 +144,7 @@
144144
m1:code
145145
mb:code
146146
mbU:code
147+
mbP:code
147148
mbA:code
148149
mbE:code
149150
c:code
@@ -205,6 +206,7 @@
205206
I.SanitizerPresets:#sanitizerpresets
206207
I.SetHTMLOptions:#sethtmloptions
207208
I.SetHTMLUnsafeOptions:#sethtmlunsafeoptions
209+
I.ParseHTMLUnsafeOptions:#parsehtmlunsafeoptions
208210
I.SanitizerElementNamespace:#sanitizerelementnamespace
209211
I.SanitizerElementNamespaceWithAttributes:#sanitizerelementnamespacewithattributes
210212
I.SanitizerAttributeNamespace:#sanitizerattributenamespace
@@ -285,6 +287,9 @@
285287
mbE.removeAttributes:#dom-sanitizerelementnamespacewithattributes-removeattributes
286288

287289
mbU.sanitizer:#dom-sethtmlunsafeoptions-sanitizer
290+
mbU.runScripts:#dom-sethtmlunsafeoptions-runscripts
291+
292+
mbP.sanitizer:#dom-parsehtmlunsafeoptions-sanitizer
288293

289294
document.write 手続き:#document-write-steps
290295
document.open 手続き:#document-open-steps
@@ -489,6 +494,7 @@
489494
未満の符号単位~列:~INFRA#code-unit-less-than
490495
符号単位~接頭辞:~INFRA#code-unit-prefix
491496

497+
~Assert:~INFRA#assert
492498
~EACH:~INFRA#list-iterate
493499
map.~DF:~INFRA#map-with-default
494500
~SET ε:~INFRA#map-remove
@@ -659,6 +665,7 @@
659665
%名前空間~A:namespaceA
660666
%名前空間~B:namespaceB
661667
%置換される要素~:-
668+
%~scripting~mode:scriptingMode
662669

663670
●データ/型/構造/操作
664671
消去-:erase:~
@@ -803,6 +810,7 @@
803810

804811
変わる:varies
805812
重ねて:twice
813+
直後:immediately after
806814
に加え
807815
808816
在る
@@ -1749,6 +1757,10 @@ <h3 title="DOM parsing and serialization APIs">8.5. ~DOMの構文解析~APIと
17491757
};
17501758
dictionary `SetHTMLUnsafeOptions@I {
17511759
(`Sanitizer$I or `SanitizerConfig$I or `SanitizerPresets$I) `sanitizer@mbU = {};
1760+
boolean `runScripts@mbU = false;
1761+
};
1762+
dictionary `ParseHTMLUnsafeOptions@I {
1763+
(`Sanitizer$I or `SanitizerConfig$I or `SanitizerPresets$I) `sanitizer@mbP = {};
17521764
};
17531765

17541766
dictionary `GetHTMLOptions@I {
@@ -2091,8 +2103,10 @@ <h4 title="HTML parsing methods">8.5.2. ~HTML構文解析~method</h4>
20912103
%element の中へ挿入される前に,
20922104
%options の `sanitizer$mbU ~memberに基づいて`無毒化-$される。
20932105
【!If the options dictionary contains】
2106+
%options の `runScripts$mbU ~memberが ~T をとる場合、
2107+
%html 内に包含される各~scriptは,~node~treeが更新された直後に実行されることになる。
20942108
2095-
Parses html using the HTML parser with options options, and replaces the children of element with the result. element provides context for the HTML parser. If the options dictionary contains a "sanitizer" member, it is used to sanitize the parsed fragment before it is inserted into element.
2109+
Parses html using the HTML parser with options options, and replaces the children of element with the result. element provides context for the HTML parser. If the options dictionary contains a "sanitizer" member, it is used to sanitize the parsed fragment before it is inserted into element. If the options dictionary's "runScripts" member is true, scripts contained in html will be executed immediately after the node tree is updated.
20962110
</dd>
20972111

20982112
<dt>%shadowRoot.`setHTMLUnsafe(html, options)$m1</dt>
@@ -2104,8 +2118,10 @@ <h4 title="HTML parsing methods">8.5.2. ~HTML構文解析~method</h4>
21042118
%shadowRoot の中へ挿入される前に,
21052119
%options の `sanitizer$mbU ~memberに基づいて`無毒化-$される。
21062120
【!If the options dictionary contains】
2121+
%options の `runScripts$mbU ~memberが ~T をとる場合、
2122+
%html 内に包含される各~scriptは,~node~treeが更新された直後に実行されることになる。
21072123
2108-
Parses html using the HTML parser with options options, and replaces the children of shadowRoot with the result. shadowRoot's host provides context for the HTML parser. If the options dictionary contains a "sanitizer" member, it is used to sanitize the parsed fragment before it is inserted into shadowRoot.
2124+
Parses html using the HTML parser with options options, and replaces the children of shadowRoot with the result. shadowRoot's host provides context for the HTML parser. If the options dictionary contains a "sanitizer" member, it is used to sanitize the parsed fragment before it is inserted into shadowRoot. If the options dictionary's "runScripts" member is true, scripts contained in html will be executed immediately after the node tree is updated.
21092125
</dd>
21102126

21112127
<dt>%doc = `Document$I.`parseHTML(html, options)$m</dt>
@@ -2133,7 +2149,7 @@ <h4 title="HTML parsing methods">8.5.2. ~HTML構文解析~method</h4>
21332149
]ことに注意。
21342150
文書の`~URL$docは `~about_blank$sc になる。
21352151
結果の~DOMは、
2136-
%options の `sanitizer$mbU ~memberに基づいて`無毒化-$される。
2152+
%options の `sanitizer$mbP ~memberに基づいて`無毒化-$される。
21372153
【!If the options dictionary contains】
21382154
21392155
Note that script elements are not evaluated during parsing, and the resulting document's encoding will always be UTF-8. The document's URL will be about:blank. If the options dictionary contains a "sanitizer" member, it is used to sanitize the resulting DOM.
@@ -3425,6 +3441,14 @@ <h4 title="The XMLSerializer interface">8.5.8. `XMLSerializer^I ~interface</h4>
34253441
<section id="html-sanitization">
34263442
<h3 title="HTML sanitization">8.6. ~HTMLの無毒化</h3>
34273443

3444+
<p class="trans-note">
3445+
この節に現れる( `Sanitizer$I を~~構成するものとして利用される)語 “要素”, “属性” は、
3446+
ほとんどが,それらの型を識別する名前
3447+
— ( 名前, 名前空間 ) が成す組 —
3448+
を意味することに注意
3449+
(個々の~nodeではなく)。
3450+
</p>
3451+
34283452
<section id="introduction-12">
34293453
<h4 title="Introduction">8.6.1. 序論</h4>
34303454

@@ -3715,8 +3739,6 @@ <h4 title="The Sanitizer interface">8.6.2. `Sanitizer^I ~interface</h4>
37153739
に対し:
37163740
37173741
To canonicalize the configuration SanitizerConfig configuration with a boolean allowCommentsPIsAndDataAttributes:
3718-
• For each member of configuration that is a list of strings:(冗長な段)
3719-
•• Replace each string in member with the result of canonicalizing it.
37203742
</p>
37213743
<ol>
37223744
<li>
@@ -4389,7 +4411,7 @@ <h4 title="The Sanitizer interface">8.6.2. `Sanitizer^I ~interface</h4>
43894411
43904412
43914413
%element[ "`removeAttributes$mbE" ] ~SET
4392-
`交差集合$`名前$sub【!`正準-化された交差集合$( `~listから集合を作成する$`名前$sub( %element[ "`removeAttributes$mbE" ] ), %環境設定[ "`attributes$mb" ] )
4414+
`交差集合$`名前$sub【!`正準-化された交差集合$( `~listから集合を作成する$`名前$sub( %element[ "`removeAttributes$mbE" ] ), %環境設定[ "`attributes$mb" ] )
43934415
43944416
If element["removeAttributes"] exists:
43954417
• Set element["removeAttributes"] to the result of creating a set from element["removeAttributes"].
@@ -5759,6 +5781,47 @@ <h4 title="Sanitization algorithms">8.6.4. 無毒化~algo</h4>
57595781
Let sanitizer be the result of calling getting a sanitizer from options given safe.
57605782
</li>
57615783
<li>
5784+
%~scripting~mode ~LET `不活$i
5785+
5786+
Let scriptingMode be Inert.
5787+
</li>
5788+
<li>
5789+
<p>
5790+
~IF[
5791+
%~option群[ "`runScripts$mbU" ] ~EQ ~T
5792+
]:
5793+
5794+
If options["runScripts"] is true:
5795+
</p>
5796+
<ol>
5797+
<li>
5798+
~Assert:
5799+
%安全か ~EQ ~F
5800+
5801+
Assert: safe is false.
5802+
</li>
5803+
<li>
5804+
%~scripting~mode ~SET `素片$i
5805+
5806+
Set scriptingMode to Fragment.
5807+
</li>
5808+
</ol>
5809+
</li>
5810+
<li>
5811+
<p>
5812+
%新たな子~群 ~LET `~HTML素片の構文解析~algo$( %文脈~要素, %~HTML, ~T, %~scripting~mode )
5813+
5814+
Let newChildren be the result of parsing a fragment given contextElement, html, true, and scriptingMode.
5815+
</p>
5816+
5817+
<p class="note">注記:
5818+
%新たな子~群 内の~scriptは、
5819+
%~target の中へ挿入されたときに限り,実行されることになる。
5820+
5821+
Scripts in newChildren will only execute once inserted into target.
5822+
</p>
5823+
</li>
5824+
<li>
57625825
%新たな子~群 ~LET `~HTML素片の構文解析~algo$( %文脈~要素, %~HTML, ~T )
57635826
57645827
Let newChildren be the result of parsing a fragment given contextElement, html, and true.

0 commit comments

Comments
 (0)