Skip to main content

atmos/os_lib/web_apis/
selftest.rs

1//! JS エンジン自己テスト(mod.rs から分割。2026-07-16 リファクタ フェーズ4)。
2//! ロジック不変。`super::*` で mod.rs の JsRuntime/eval/Value 等を取り込む。
3use super::*;
4
5/// JS エンジンの自己テスト。各ケースを評価し、最後の式の文字列化が期待値と一致するか確認。
6/// 起動時に呼ばれ `JS_SELFTEST: PASS n/n` をシリアルへ出す(CI スモークの判定マーカー)。
7pub fn selftest() -> (usize, usize) {
8    let cases: &[(&str, &str)] = &[
9        // 演算子・優先順位
10        ("1 + 2 * 3", "7"),
11        ("(1 + 2) * 3", "9"),
12        ("2 ** 10", "1024"),
13        ("7 % 3", "1"),
14        ("10 / 4", "2.5"),
15        ("true && false || true", "true"),
16        ("null ?? 'x'", "x"),
17        ("1 < 2 ? 'a' : 'b'", "a"),
18        // テンプレートリテラル `${}` 補間(ES2015)。以前はレキサーが `${...}` を
19        // 単なる生文字列として保持するだけで実際の補間評価が行われず(Phase 4 として
20        // 未実装のまま放置されていた)、自己テストも一件も存在しない状態だった。
21        ("var name='World'; `Hello, ${name}!`", "Hello, World!"),
22        ("`1+2=${1+2}`", "1+2=3"),
23        ("var a=1,b=2; `${a}-${b}-${a+b}`", "1-2-3"),
24        ("`no interpolation here`", "no interpolation here"),
25        ("``", ""),
26        ("`${'a'+'b'}${'c'}`", "abc"),
27        // 補間式の中に文字列リテラル(波括弧に見える文字を含む可能性がある)や
28        // オブジェクトリテラル(ネストした `{}`)があっても深さ計算が壊れないこと。
29        ("`x=${'{not a brace}'}`", "x={not a brace}"),
30        ("`obj=${JSON.stringify({a:1})}`", "obj={\"a\":1}"),
31        // 補間式内でのネストしたテンプレートリテラル(二重ネストではない単純な形)。
32        ("`outer ${`inner`}`", "outer inner"),
33        // 文字列
34        ("'a' + 'b' + 'c'", "abc"),
35        ("'Hello'.toUpperCase()", "HELLO"),
36        ("'a,b,c'.split(',').length", "3"),
37        ("'  hi  '.trim()", "hi"),
38        ("'abc'.slice(1)", "bc"),
39        // 変数・制御構文
40        ("var s = 0; for (var i = 1; i <= 5; i++) s += i; s", "15"),
41        // `name += 文字列` を変数の文字列の末尾へ足す近道(`bytecode.rs` の `AddAssignIdent`)。関数の本体(バイトコード)で 2 回呼ぶ。
42        ("function f(){var s='';for(var i=0;i<5;i++){s+=i;} var t=s; s+='x'; return t+'|'+s} f(); f()", "01234|01234x"),
43        ("function g(){var a='ab'; a+=a; a+=1; return a} g(); g()", "abab1"),
44        ("function h(){var s='a'; s+=(s='b','c'); return s} h(); h()", "ac"),
45        ("function k(){var s='x'; var q=function(){return s}; s+='y'; return q()+s} k(); k()", "xyxy"),
46        ("function m(){var n=1; n+='2'; n+=3; return n} m(); m()", "123"),
47        ("function p(){var a=['u']; var s=a[0]; s+='v'; return a[0]+s} p(); p()", "uuv"),
48        // 【2026-10-16】`var` の巻き上げ。宣言より前の代入は関数ローカルへ入り、外側の
49        // 同名変数を書き換えない(Cloudflare beacon.min.js の `bi:(a=st,...)...; var a;` が
50        // 外側の関数 `a` を上書きして `a is not a function` になっていた)。
51        ("var x=1; function f(){ x=2; var x; return x; } f() + ',' + x", "2,1"),
52        ("function a(){ return 'fn'; } function g(){ var o={b:(a={}, 1)}; var a; return o.b; } g(); a()", "fn"),
53        ("function f(){ return typeof v; var v = 1; } f()", "undefined"),
54        ("function h(p){ var p; return p; } h(5)", "5"),
55        ("var q='outer'; function k(){ q=3; if (false) { var q; } return q; } k() + ',' + q", "3,outer"),
56        ("var r='outer'; function m(){ r=1; try { var r; } finally {} return r; } m() + ',' + r", "1,outer"),
57        ("var t='outer'; function n(){ t=1; for (var t in {}) {} return t; } n() + ',' + t", "1,outer"),
58        ("var u='outer'; function w(){ u=1; switch (0) { case 0: var u; } return u; } w() + ',' + u", "1,outer"),
59        // 入れ子の関数の中の var は外側の関数へ巻き上げない。
60        ("var z='outer'; function y(){ z=1; function inner(){ var z; } return z; } y(); z", "1"),
61        // window のプロパティはグローバル変数として typeof でも見える(`window.$ = jQuery`)。
62        ("window.zzTypeofProbe = 5; typeof zzTypeofProbe", "number"),
63        ("typeof zzNeverDefinedAnywhere", "undefined"),
64        // 初期値の無い var の再宣言は既存の値を変えない。
65        ("var vvRedecl = 3; var vvRedecl; vvRedecl", "3"),
66        // 巻き上げは let/const に影響しない(ブロック外では見えない)。
67        ("function lc(){ { let k2 = 1; } return typeof k2; } lc()", "undefined"),
68        ("let n = 0; while (n < 3) n++; n", "3"),
69        ("let x = 10; if (x > 5) { x = 1 } else { x = 2 } x", "1"),
70        // ラベル付き break/continue(ES3以降の基礎機能。以前は AST に Label 相当の
71        // variant 自体が存在せず完全に未サポートだった)。
72        (
73            "var out=''; outer: for(var i=0;i<3;i++){ for(var j=0;j<3;j++){ if(j===1) continue outer; out+=i+''+j; } } out",
74            "001020",
75        ),
76        (
77            "var found=null; outer: for(var i=0;i<3;i++){ for(var j=0;j<3;j++){ if(i===1&&j===1){ found=i+''+j; break outer; } } } found",
78            "11",
79        ),
80        // 関数内(バイトコード実行)でのラベル付きループ・ネストした for-of・ラベル付きブロック・クロージャ生成
81        (
82            "function bcLabeled(){ var out=''; outer: for(let i=0;i<3;i++){ for(const x of ['a','b','c']){ if(x==='b') continue outer; if(i===2 && x==='a') break outer; out+=i+x; } } blk: { out+='!'; break blk; out+='?'; } return out; } bcLabeled()",
83            "0a1a!",
84        ),
85        (
86            "function bcNestedForOf(){ var s=0; for(const a of [1,2,3]){ for(const b of [10,20]){ if(b===20 && a===2) break; s += a*b; } } return s; } bcNestedForOf()",
87            "140",
88        ),
89        // ラベル無しの break/continue は従来通り最も内側のループのみに作用する
90        // (ラベル対応追加による回帰が無いことの確認)。
91        (
92            "var out=''; for(var i=0;i<3;i++){ for(var j=0;j<3;j++){ if(j===1) break; out+=i+''+j; } } out",
93            "001020",
94        ),
95        // 三項演算子の `:` とラベル構文の衝突が無いこと(`x ? 1 : 2` の `:` は
96        // ラベル判定の対象にならない)。
97        ("var x=5; x > 0 ? 1 : 2", "1"),
98        // `**` の右結合性(`2**3**2` は `2**(3**2)`=512。左結合だと `(2**3)**2`=64になり誤り)。
99        ("2 ** 3 ** 2", "512"),
100        // 論理代入演算子(ES2021): 値としての結果。
101        ("var a=0; a ||= 5; a", "5"),
102        ("var a=1; a ||= 5; a", "1"),
103        ("var a=1; a &&= 5; a", "5"),
104        ("var a=0; a &&= 5; a", "0"),
105        ("var a=null; a ??= 5; a", "5"),
106        ("var a=0; a ??= 5; a", "0"),
107        // 論理代入演算子は仕様上の短絡評価が必須: 条件を満たさない場合、右辺の副作用は
108        // 一切実行されてはならない(以前は関数の先頭で右辺を無条件に評価してから分岐して
109        // いたため、代入されない場合でも副作用が毎回発生してしまう仕様違反バグがあった)。
110        (
111            "var calls=0; function rhs(){calls++; return 9;} var a=1; a ||= rhs(); calls",
112            "0",
113        ),
114        (
115            "var calls=0; function rhs(){calls++; return 9;} var a=0; a &&= rhs(); calls",
116            "0",
117        ),
118        (
119            "var calls=0; function rhs(){calls++; return 9;} var a=5; a ??= rhs(); calls",
120            "0",
121        ),
122        // 条件を満たす場合は右辺が(1回だけ)評価される。
123        (
124            "var calls=0; function rhs(){calls++; return 9;} var a=0; a ||= rhs(); calls+','+a",
125            "1,9",
126        ),
127        // 関数・クロージャ・再帰
128        ("function add(a, b) { return a + b } add(3, 4)", "7"),
129        ("let f = (a, b) => a + b; f(5, 6)", "11"),
130        ("function fib(n){ return n < 2 ? n : fib(n-1) + fib(n-2) } fib(10)", "55"),
131        ("let mk = () => { let c = 0; return () => ++c }; let g = mk(); g(); g(); g()", "3"),
132        // 配列
133        ("[1,2,3].map(x => x * 2).join(',')", "2,4,6"),
134        ("[1,2,3,4].filter(x => x % 2 === 0).join(',')", "2,4"),
135        ("[1,2,3,4].reduce((s, x) => s + x, 0)", "10"),
136        ("[3,1,2].sort((a,b) => a - b).join('')", "123"),
137        ("let a = [1]; a.push(2); a.push(3); a.length", "3"),
138        // オブジェクト
139        ("var o = {a:1, b:2}; o.a + o.b", "3"),
140        ("var o = {}; o['k'] = 9; o.k", "9"),
141        ("Object.keys({x:1, y:2, z:3}).length", "3"),
142        // typeof / 例外
143        ("typeof undefinedVar", "undefined"),
144        ("typeof 42", "number"),
145        ("try { throw 'boom' } catch (e) { e }", "boom"),
146        // JSON
147        ("JSON.stringify({x:[1,2], y:'z'})", "{\"x\":[1,2],\"y\":\"z\"}"),
148        ("JSON.parse('{\"n\":5}').n", "5"),
149        // Math
150        ("Math.max(3, 7, 2)", "7"),
151        ("Math.floor(3.9)", "3"),
152        ("Math.abs(-5)", "5"),
153        // switch(フォールスルー・default 含む)
154        ("function f(x){ switch(x){ case 1: return 'one'; case 2: return 'two'; default: return 'other' } } f(2)", "two"),
155        ("function f(x){ switch(x){ case 1: return 'one'; default: return 'd' } } f(9)", "d"),
156        ("var r=''; switch(1){ case 1: r+='a'; case 2: r+='b'; break; case 3: r+='c' } r", "ab"),
157        // スプレッド/レスト
158        ("var a=[1,2]; var b=[...a,3,4]; b.join(',')", "1,2,3,4"),
159        ("function sum(...xs){ return xs.reduce((s,x)=>s+x,0) } sum(1,2,3,4)", "10"),
160        ("function add(a,b,c){ return a+b+c } add(...[1,2,3])", "6"),
161        ("var o={a:1}; var p={...o, b:2}; p.a + p.b", "3"),
162        ("Math.max(...[5,2,9,1])", "9"),
163        ("function tail(first, ...rest){ return rest.join('-') } tail(1,2,3,4)", "2-3-4"),
164        // Map
165        ("var m=new Map(); m.set('a',1).set('b',2); m.get('a') + m.size", "3"),
166        ("var m=new Map([['x',10],['y',20]]); m.has('y') + ',' + m.get('y')", "true,20"),
167        ("var m=new Map(); m.set(1,'one'); m.delete(1); m.has(1)", "false"),
168        // `new Map(iterable)` の各要素が非オブジェクト(ペアでない)場合は仕様どおり
169        // TypeError を投げる必要があるが、以前は黙って {undefined: undefined} という
170        // 意味のない1エントリだけの Map が静かに作られていた。
171        (
172            "try { new Map([1,2,3]); 'no throw'; } catch(e) { 'threw'; }",
173            "threw",
174        ),
175        (
176            "try { new Map(['ab']); 'no throw'; } catch(e) { 'threw'; }",
177            "threw",
178        ),
179        // Set
180        ("var s=new Set([1,2,2,3,3,3]); s.size", "3"),
181        ("var s=new Set(); s.add(5).add(5).add(6); s.has(5) + ',' + s.size", "true,2"),
182        ("var s=new Set([1,2,3]); var t=0; s.forEach(v=>t+=v); t", "6"),
183        ("[...new Set([1,1,2,3,3])].join(',')", "1,2,3"),
184        // 分割代入(オブジェクト)
185        ("var {a, b} = {a:1, b:2}; a + b", "3"),
186        ("var {a: x, b: y} = {a:10, b:20}; x + y", "30"),
187        ("var {a, c = 9} = {a:1}; a + c", "10"),
188        ("var {a, ...rest} = {a:1, b:2, c:3}; rest.b + rest.c", "5"),
189        ("var {p: {q}} = {p:{q:42}}; q", "42"),
190        // 分割代入(配列)
191        ("var [a, b] = [1, 2]; a + b", "3"),
192        ("var [a, , c] = [1, 2, 3]; a + c", "4"),
193        ("var [a, ...rest] = [1, 2, 3, 4]; rest.join('-')", "2-3-4"),
194        ("var [a = 5, b = 6] = [1]; a + b", "7"),
195        ("var [[a], [b]] = [[1],[2]]; a + b", "3"),
196        ("var t=0; for (const [k,v] of [['a',1],['b',2]]) t += v; t", "3"),
197        // デフォルト引数
198        ("function f(a, b = 10) { return a + b } f(5)", "15"),
199        ("function f(a, b = 10) { return a + b } f(5, 7)", "12"),
200        // 引数の分割代入
201        ("function f({x, y}) { return x * y } f({x:3, y:4})", "12"),
202        ("function f([a, b]) { return a - b } f([9, 2])", "7"),
203        // 算出キー
204        ("var k = 'dyn'; var o = {[k]: 99}; o.dyn", "99"),
205        ("var o = {['a' + 'b']: 1}; o.ab", "1"),
206        // class(基本)
207        ("class A { constructor(x){ this.x = x } get(){ return this.x } } new A(7).get()", "7"),
208        ("class A { constructor(){ this.n = 0 } inc(){ this.n++; return this.n } } var a=new A(); a.inc(); a.inc()", "2"),
209        ("class P { area(){ return 0 } } class C extends P { area(){ return 5 } } new C().area()", "5"),
210        // class(継承・super)
211        ("class A { constructor(x){ this.x = x } } class B extends A { constructor(x,y){ super(x); this.y = y } sum(){ return this.x + this.y } } new B(3,4).sum()", "7"),
212        ("class A { greet(){ return 'A' } } class B extends A { greet(){ return super.greet() + 'B' } } new B().greet()", "AB"),
213        ("class A { constructor(){ this.v = 1 } } class B extends A {} new B().v", "1"),
214        // class field 宣言(ES2022。コンストラクタ本体の先頭で this.x = init される)
215        ("class C { x = 5; } new C().x", "5"),
216        ("class C { x; } typeof new C().x", "undefined"),
217        ("class C { x = 1; y = this.x + 1; } var c = new C(); c.x + ',' + c.y", "1,2"),
218        (
219            "class C { x = 1; constructor(){ this.x = this.x + 10 } } new C().x",
220            "11",
221        ),
222        (
223            "class A { x = 1; } class B extends A { y = 2; } var b = new B(); b.x + ',' + b.y",
224            "1,2",
225        ),
226        // private field(#x)。'#' が識別子の一部として扱われ、通常のプロパティアクセス
227        // 経路をそのまま通る(真の隠蔽ではないが、構文としては正しく動作する)。
228        (
229            "class Counter { #n = 0; inc(){ this.#n++; return this.#n } } var c = new Counter(); c.inc(); c.inc()",
230            "2",
231        ),
232        (
233            "class C { #secret = 'hidden'; reveal(){ return this.#secret } } new C().reveal()",
234            "hidden",
235        ),
236        // private メソッド(#method())
237        (
238            "class C { #double(n){ return n * 2 } calc(n){ return this.#double(n) } } new C().calc(21)",
239            "42",
240        ),
241        // プライベートフィールドのブランドチェック `#x in obj`(ES2022)が丸ごと
242        // 未対応で、`#x is not defined` の例外に必ずなっていた。
243        (
244            "class C { #x = 1; static has(o){ return #x in o; } } C.has(new C()) + ',' + C.has({})",
245            "true,false",
246        ),
247        // static field
248        ("class C { static count = 7; } C.count", "7"),
249        // static メソッド
250        ("class M { static twice(n){ return n * 2 } } M.twice(21)", "42"),
251        // メソッドからメソッド呼び出し
252        ("class C { a(){ return 2 } b(){ return this.a() * 10 } } new C().b()", "20"),
253        // Promise / async / await(await はマイクロタスクを駆動して同期解決)
254        ("await Promise.resolve(42)", "42"),
255        // **重要**: 汎用 thenable(本物の Promise ではないが呼び出し可能な `.then` を
256        // 持つオブジェクト。古いライブラリの独自 Promise 実装等でよく使われる)の
257        // 同化が丸ごと未対応で、`await`/`Promise.resolve` がオブジェクト自体を
258        // 履行値にしてしまうバグだった。
259        (
260            "await Promise.resolve({ then(resolve){ resolve(99); } })",
261            "99",
262        ),
263        (
264            "await { then(resolve){ resolve(7); } }",
265            "7",
266        ),
267        (
268            "try { await { then(resolve, reject){ reject('bad'); } } } catch(e) { e }",
269            "bad",
270        ),
271        // thenable の連鎖(thenable の then が別の thenable で resolve する)も
272        // 再帰的に同化されること。
273        (
274            "await { then(resolve){ resolve({ then(r){ r(5); } }); } }",
275            "5",
276        ),
277        // **重要**: thenable 検出が own プロパティしか見ていなかったため、
278        // `then` メソッドが `.prototype` 側にある class インスタンスの thenable
279        // を取りこぼすバグだった(自己検証で発見)。
280        (
281            "class MyThenable { then(resolve){ resolve(42); } } await new MyThenable()",
282            "42",
283        ),
284        (
285            "class MyThenable { then(_, reject){ reject('bad'); } } try { await new MyThenable() } catch(e) { e }",
286            "bad",
287        ),
288        ("await Promise.resolve(1).then(v => v + 1)", "2"),
289        ("await Promise.resolve(1).then(v => v + 1).then(v => v * 10)", "20"),
290        ("await Promise.reject('e').catch(e => 'caught:' + e)", "caught:e"),
291        ("async function f(){ return 7 } await f()", "7"),
292        ("async function f(){ let x = await Promise.resolve(10); return x * 2 } await f()", "20"),
293        ("async function f(){ try { await Promise.reject('x') } catch(e){ return 'C' + e } } await f()", "Cx"),
294        ("await (async () => 5)()", "5"),
295        ("await new Promise((res) => res(99))", "99"),
296        ("await new Promise((res, rej) => rej('bad')).catch(e => 'got:' + e)", "got:bad"),
297        ("await Promise.all([Promise.resolve(1), Promise.resolve(2), 3]).then(a => a.join(','))", "1,2,3"),
298        // **重要**: `Promise.all` の配列要素に汎用 thenable(本物の Promise ではないが
299        // 呼び出し可能な `.then` を持つオブジェクト)が混ざっていると、`Promise.resolve`/
300        // `await` 単体では既に同化対応済みだったのに、要素がそのままオブジェクトとして
301        // 混入してしまう非対称なバグだった。
302        (
303            "await Promise.all([1, { then(r){ r(2); } }, Promise.resolve(3)]).then(a => a.join(','))",
304            "1,2,3",
305        ),
306        (
307            "await Promise.all([{ then(resolve, reject){ reject('bad'); } }]).catch(e => 'caught:' + e)",
308            "caught:bad",
309        ),
310        ("typeof Promise.resolve(1)", "object"),
311        ("var log=''; await Promise.resolve(1).finally(() => log = 'F'); log", "F"),
312        // `finally` は元の値/理由をそのまま次へ渡す(コールバックの戻り値は無視)。
313        ("await Promise.resolve(1).finally(() => 2)", "1"),
314        // `finally` のコールバックが例外を投げた場合、それが settle を上書きすべき
315        // (以前は副作用としてだけ実行し戻り値/例外を完全に無視していたバグ)。
316        (
317            "await Promise.resolve(1).finally(() => { throw 'x'; }).catch(e => 'caught:' + e)",
318            "caught:x",
319        ),
320        // `finally` のコールバックが reject する Promise を返した場合も同様。
321        (
322            "await Promise.resolve(1).finally(() => Promise.reject('y')).catch(e => 'caught:' + e)",
323            "caught:y",
324        ),
325        // reject 経路でも `finally` はコールバック実行後、元の reason で reject し続ける。
326        (
327            "await Promise.reject('orig').finally(() => 'ignored').catch(e => 'caught:' + e)",
328            "caught:orig",
329        ),
330        ("async function sq(n){ return n*n } var s=0; for (const n of [1,2,3]) s += await sq(n); s", "14"),
331        // generator(遅延評価 / replay 駆動)
332        ("function* g(){ yield 1; yield 2; yield 3 } [...g()].join(',')", "1,2,3"),
333        ("function* g(){ yield* [1,2]; yield 3 } [...g()].join(',')", "1,2,3"),
334        ("function* g(){ for (let i=0;i<3;i++) yield i*i } [...g()].join(',')", "0,1,4"),
335        // ループのスコープ再利用とクロージャ捕捉(A2: strong_count == 1 での再利用とクロージャ捕捉時の独立束縛)
336        ("var arr=[]; for (let i=0; i<3; i++) arr.push(() => i); [arr[0](), arr[1](), arr[2]()].join(',')", "0,1,2"),
337        ("var s=0; for (let i=0; i<100; i++) s += i; s", "4950"),
338        ("var arr=[]; for (const x of ['alpha', 'beta', 'gamma']) arr.push(() => x); [arr[0](), arr[1](), arr[2]()].join(',')", "alpha,beta,gamma"),
339        ("function* g(){ yield 1; yield 2; yield 3 } var s=0; for (const v of g()) s += v; s", "6"),
340        ("function* g(){ yield 'a'; yield 'b' } var it=g(); it.next().value + it.next().value + it.next().done", "abtrue"),
341        ("function* g(){ yield 1; return 99; } var it=g(); it.next(); it.next().done", "true"),
342        // 無限 generator を有限個だけ消費(真の遅延評価。eager だと無限ループ)
343        ("function* nat(){ let i=0; while(true) yield i++; } var it=nat(); it.next().value + ',' + it.next().value + ',' + it.next().value", "0,1,2"),
344        ("function* nat(){ let i=1; while(true) yield i++; } var it=nat(); var s=0; for(let k=0;k<5;k++) s += it.next().value; s", "15"),
345        // .next(v) による双方向の値受け渡し
346        ("function* g(){ var a = yield 1; var b = yield a + 10; return a + b; } var it=g(); it.next(); var r1=it.next(5); var r2=it.next(100); r1.value + ',' + r2.value", "15,105"),
347        ("function* g(){ var x = yield 'first'; yield 'got:' + x; } var it=g(); it.next(); it.next('hello').value", "got:hello"),
348        // yield* で別の generator へ委譲(generator 同士のネスト)
349        ("function* inner(){ yield 1; yield 2; } function* outer(){ yield 0; yield* inner(); yield 3; } [...outer()].join(',')", "0,1,2,3"),
350        // **重要**: `async function*`(非同期 generator。ES2018)の `.next()` が
351        // 仕様上必ず Promise を返すべきところ、`is_generator` の分岐が `is_async` を
352        // 完全に無視しており、普通の同期 generator と同じ `{value,done}` プレーン
353        // オブジェクトを直接返してしまっていたバグ。
354        (
355            "async function* g(){ yield 1; yield 2; } typeof g().next().then",
356            "function",
357        ),
358        (
359            "async function* g(){ yield 1; yield 2; } var it = g(); await it.next().then(r => r.value + ',' + r.done)",
360            "1,false",
361        ),
362        (
363            "async function* g(){ yield await Promise.resolve(42); } var it = g(); await it.next().then(r => r.value)",
364            "42",
365        ),
366        ("function* g(){ yield* 'abc'; } [...g()].join('-')", "a-b-c"),
367        // return() で早期終了
368        ("function* g(){ yield 1; yield 2; yield 3; } var it=g(); it.next(); var r=it.return(99); r.value + ',' + r.done + ',' + it.next().done", "99,true,true"),
369        // return() と try...finally の連携(return() 時に finally が実行される)
370        ("var log=''; function* g(){ try { yield 1; } finally { log+='f'; } } var it=g(); it.next(); var r=it.return(99); r.value + ',' + r.done + ',' + log", "99,true,f"),
371        // finally の中で return がある場合はそちらが優先される
372        ("function* g(){ try { yield 1; } finally { return 42; } } var it=g(); it.next(); it.return(99).value", "42"),
373        // finally の中で yield がある場合はそこで一時停止し、次の再開で強制Return値で完了する。
374        // value/done は正しいが、下の replay 特性(368行目)どおり finally 冒頭の
375        // `log+='f'` は forced-return 契機の replay と次の .next() の replay の
376        // 計2回実行されるため 'f' が2つになる(2026-07-14、期待値の計算ミスを
377        // QEMU JS_SELFTEST FAIL で発見・修正。本体側の finally 実行ロジックは正しい)。
378        ("var log=''; function* g(){ try { yield 1; } finally { log+='f'; yield 2; log+='end'; } } var it=g(); it.next(); var r1=it.return(99); var r2=it.next(); r1.value+','+r1.done+','+r2.value+','+r2.done+','+log", "2,false,99,true,ffend"),
379        // replay 方式の帰結: resume のたびに本体を先頭から再実行するため、外部副作用は
380        // 複数回発生する(yield される値・.next(v) の受け渡しは正しい)。この再実行特性を
381        // 明示的に検証する(2 回目の next で log+='a' が再実行され 'aab' になる)。
382        ("var log=''; function* g(){ log+='a'; yield 1; log+='b'; yield 2; } var it=g(); it.next(); it.next(); log", "aab"),
383        // Array.from が generator を消費できる(+ mapFn)
384        ("function* g(){ yield 1; yield 2; yield 3; } Array.from(g()).join(',')", "1,2,3"),
385        ("function* g(){ yield 1; yield 2; yield 3; } Array.from(g(), x => x * 10).join(',')", "10,20,30"),
386        // try/finally を跨ぐ yield(中断中は finally を実行せず、resume で継続)
387        ("function* g(){ try { yield 1; yield 2; } finally { } yield 3; } [...g()].join(',')", "1,2,3"),
388        // 【2026-11-19】`el.style = 文字列` は cssText への代入(独自プロパティにしない。YouTube の rotationChanged)
389        ("var e=document.createElement('div'); e.style='color: red'; var a=e.style.color; e.style=null; var b=typeof e.style; e.style.opacity='0.5'; a+','+b+','+e.style.opacity+','+(e.style.color==='')", "red,object,0.5,true"),
390        // 【2026-11-19】document.contains(ShadyDOM の `__shady_native_contains` が document を受ける)
391        ("var o=[]; document.createElement('i'); var e=document.createElement('div'); o.push(Node.prototype.contains.call(document, document)); o.push(document.contains(e)); o.push(document.contains(null)); o.push(Node.prototype.contains.call(e, e)); o.join(',')", "true,false,false,true"),
392        // 【2026-10-19】EventTarget.prototype の native メソッド(ShadyDOM が __shady_native_* として写す)
393        ("typeof EventTarget.prototype.addEventListener + ',' + typeof EventTarget.prototype.removeEventListener + ',' + typeof EventTarget.prototype.dispatchEvent + ',' + !!Object.getOwnPropertyDescriptor(EventTarget.prototype, 'addEventListener')", "function,function,function,true"),
394        // 要素に付けたアクセサはハンドルが変わっても残り、自身のプロパティとして見える(2026-10-24)。
395        ("var e=document.createElement('div'); var par=document.createElement('div'); par.appendChild(e); var st=0; Object.defineProperty(e,'foo',{get:function(){return 'g'+st;},set:function(v){st=v;},configurable:true}); var h=par.firstChild; h.foo=5; h.foo+','+h.hasOwnProperty('foo')+','+typeof Object.getOwnPropertyDescriptor(h,'foo').get+','+par.hasOwnProperty('foo')", "g5,true,function,false"),
396        // getComputedStyle の font-size は常に px(レイアウト前の % でも。YouTube の回転数字の行の高さ。2026-10-25)。
397        ("var de=document.createElement('div'); var ch=document.createElement('span'); de.appendChild(ch); de.style.fontSize='62.5%'; ch.style.fontSize='2em'; getComputedStyle(de).fontSize+','+getComputedStyle(ch).fontSize", "10px,20px"),
398        ("Object.defineProperty(EventTarget.prototype, '__x7', {value: function(){ return 7; }, configurable: true}); var d = document.createElement('div'); (typeof d.__x7) + ',' + (typeof window.__x7) + ',' + (typeof document.__x7)", "function,function,function"),
399        ("var d = document.createElement('div'); var hit = 0; EventTarget.prototype.addEventListener.call(d, 'foo', function(){ hit++; }); EventTarget.prototype.dispatchEvent.call(d, new Event('foo')); hit", "1"),
400        ("var hit = 0; var f = function(){ hit++; }; EventTarget.prototype.addEventListener.call(window, 'foo2', f); window.dispatchEvent(new Event('foo2')); EventTarget.prototype.removeEventListener.call(window, 'foo2', f); window.dispatchEvent(new Event('foo2')); hit", "1"),
401        ("(Object.getPrototypeOf(Node.prototype) === EventTarget.prototype) + ',' + (Object.getPrototypeOf(Window.prototype) === EventTarget.prototype) + ',' + (document.createElement('div') instanceof EventTarget)", "true,true,true"),
402        // 【2026-10-19】RegExp.prototype から直接読むメソッド(XRegExp)
403        ("var Yb = {exec: RegExp.prototype.exec, test: RegExp.prototype.test}; Yb.exec.call(/\\/([a-z]*)$/i, RegExp.prototype.toString.call(/x/gi))[1] + ',' + Yb.test.call(/b/, 'abc') + ',' + (RegExp.prototype.constructor === RegExp)", "gi,true,true"),
404        // 【2026-10-20】ラベル付きブロックの break(入れ子のループから抜ける)と、ループのラベル
405        ("var r; a:{ for(var q=3;q>=1;q--) for(var c=[1];c.length;){ c.shift(); r='found'; break a } r='after' } var n = 0; outer: for (var i = 0; i < 3; i++) { for (var j = 0; j < 3; j++) { if (j == 1) continue outer; n++; } } r + ',' + n", "found,3"),
406        // 【2026-10-20】代入は左辺の参照を右辺より先に 1 回だけ評価する(Node で確認: LRAKV,1,2,1,1)
407        ("var log = []; ((log.push('L'), {})).x = (log.push('R'), 1); var o = {}; (log.push('A'), o)[(log.push('K'), 'k')] = (log.push('V'), 2); var a = [0, 0, 0], i = 0; a[i++] += 1; var j = 0; a[j++]++; var n = 0; var f = function(){ n++; return {}; }; f().z = 1; log.join('') + ',' + i + ',' + a[0] + ',' + j + ',' + n", "LRAKV,1,2,1,1"),
408        // 【2026-10-20】BotGuard(www.google.com/js/th)の状態機械。ul(true,24,S1) が S1.kR を作る
409        ("var ul=function(m,K,a,J,b,F,R){for(F=49;F!=34;)if(F==30)F=(K+7&16)<10&&K-5>=-36?20:21;else{if(F==45)return R;if(F==80)F=K-7&6?30:99;else if(F==21)F=(K|48)==K?56:45;else if(F==99)a.YR=void 0,a.kR=function(){return a.YR?a.YR:a.YR=new a},F=30;else if(F==20){F=21}else F==56?(R=7,F=45):F==49&&(F=80)}}; var S1=function(){}; ul(true,24,S1); typeof S1.kR", "function"),
410        // 【2026-10-19】sort はマージソート(安定・O(n log n))
411        ("var a = []; for (var i = 0; i < 300; i++) a.push((i * 7919) % 300); a.sort(function(x, y){ return x - y; }); var ok = true; for (var i = 0; i < 300; i++) if (a[i] !== i) ok = false; ok", "true"),
412        ("[{k:1,v:'a'},{k:0,v:'b'},{k:1,v:'c'},{k:0,v:'d'}].sort(function(x, y){ return x.k - y.k; }).map(function(o){ return o.v; }).join('') + ',' + [10, 9, 1, undefined, 2].sort().join(',') + ',' + ['b','a','c'].sort(function(x, y){ return x < y ? 1 : -1; }).join('')", "bdac,1,10,2,9,,cba"),
413        // 【2026-10-19】正規表現の自前プロパティと差し替えた原型(XRegExp)
414        ("var re = /a/g; re.xregexp = re.xregexp || {}; re.xregexp.gy = 5; var P = function(){}; P.prototype = {hello: function(){ return 'hi'; }}; re.__proto__ = P.prototype; re.xregexp.gy + ',' + re.hello() + ',' + re.global + ',' + re.test('cat')", "5,hi,true,true"),
415        // 【2026-10-19】配列の穴: Array(n) の要素は穴で、map/forEach/filter/reduce 等は飛ばす(D3 の配色表)
416        ("var n = 0; Array(3).concat('a', 'b').map(function(x){ n++; return x + '!'; }).join(',') + '|' + n", ",,,a!,b!|2"),
417        ("var a = Array(3); a[1] = 'x'; var n = 0; a.forEach(function(){ n++; }); n + ',' + (0 in a) + ',' + (1 in a) + ',' + a.length", "1,false,true,3"),
418        ("Array(3).filter(function(){ return true; }).length + ',' + Array(2).reduce(function(a, b){ return a + b; }, 5) + ',' + Array(3).indexOf(undefined) + ',' + [undefined].indexOf(undefined) + ',' + Array(3).some(function(){ return true; }) + ',' + Array(3).every(function(){ return false; })", "0,5,-1,0,false,true"),
419        ("var m = 0; new Array(2).forEach(function(){ m++; }); var b = Array(2); b.fill(1); var k = 0; b.forEach(function(){ k++; }); m + ',' + k", "0,2"),
420        // 【2026-10-19】Window(大域オブジェクトの型)
421        ("typeof Window + ',' + (window instanceof Window) + ',' + (typeof window.setTimeout)", "function,true,function"),
422        // 【2026-10-18】onclick ハンドラの currentTarget は自分(子で起きたクリックの泡立ちでも)
423        ("var p = document.createElement('div'); var c = document.createElement('span'); p.appendChild(c); var r = 'none'; p.onclick = function(e){ r = (e.currentTarget && e.currentTarget.tagName) + ',' + (e.target && e.target.tagName) + ',' + e.eventPhase; }; c.click(); r", "DIV,SPAN,3"),
424        // 【2026-10-18】YouTube のレンダラが古い中身を外す操作(外れずに操作部が二重になっていた)
425        ("var p = document.createElement('ytm-x'); var a = document.createElement('div'); var b = document.createElement('span'); p.appendChild(a); p.replaceChild(b, a); p.childNodes.length + ',' + p.firstChild.tagName + ',' + (a.parentNode === null) + ',' + a.isConnected", "1,SPAN,true,false"),
426        ("var p = document.createElement('div'); p.appendChild(document.createElement('i')); p.appendChild(document.createElement('b')); p.textContent = ''; p.appendChild(document.createElement('u')); p.childNodes.length + ',' + p.firstChild.tagName", "1,U"),
427        ("var p = document.createElement('div'); var a = document.createElement('i'); p.appendChild(a); (a.parentElement === p) + ',' + (document.createElement('ytm-y').appendChild(a), a.parentElement.tagName) + ',' + p.childNodes.length", "true,YTM-Y,0"),
428        ("var p = document.createElement('div'); var c = document.createComment('x'); var a = document.createElement('i'); p.appendChild(c); p.appendChild(a); p.removeChild(c); p.insertBefore(document.createElement('b'), a); p.childNodes.length + ',' + p.firstChild.tagName", "2,B"),
429        ("var f = document.createDocumentFragment(); var a = document.createElement('i'); f.appendChild(a); var p = document.createElement('div'); p.appendChild(f); (a.parentElement === p) + ',' + f.childNodes.length", "true,0"),
430        // 【2026-10-18】DOM 要素の組み込みメソッドを自前のプロパティで上書きできる(YouTube の player API は
431        // 要素に addEventListener 等を代入する)
432        ("var d = document.createElement('div'); d.addEventListener = function(){ return 42; }; d.addEventListener('x', null)", "42"),
433        ("var d = document.createElement('div'); d.focus = function(){ return 'mine'; }; d.focus()", "mine"),
434        // 【2026-10-18】生テキスト要素の中身は outerHTML でエスケープしない
435        ("var s = document.createElement('style'); s.textContent = 'a>b{color:red}'; var t = document.createElement('p'); t.textContent = 'a>b'; s.outerHTML + '|' + t.outerHTML", "<style>a>b{color:red}</style>|<p>a&gt;b</p>"),
436        // 【2026-10-18】Symbol をキーにしたプロパティ(YouTube の Wiz の文脈トークン `d[_.nla]=!0` → Object.assign → `_.nla in a`)
437        ("var S = Symbol('Hb'); var d = {}; d[S] = true; (S in d) + ',' + d[S]", "true,true"),
438        ("var S = Symbol('Hb'); var d = {}; d[S] = true; var o = Object.assign({}, {x: 1}, d); (S in o) + ',' + o[S]", "true,true"),
439        ("var S = Symbol('a'), T = Symbol('a'); var o = {}; o[S] = 1; (T in o) + ',' + (S in o)", "false,true"),
440        ("var S = Symbol('Hb'); var d = {}; d[S] = true; var o = {...d, y: 2}; (S in o) + ',' + o.y", "true,2"),
441        ("var t = Symbol('t'); var m = new Map(); m.set(t, 5); m.get(t) + ',' + m.get(Symbol('t'))", "5,undefined"),
442        ("var S = Symbol('k'); var o = {}; o[S] = 1; Object.hasOwn(o, S) + ',' + o.hasOwnProperty(S)", "true,true"),
443        // Symbol.match/replace/search/split のオブジェクト委譲
444        ("var custom = { [Symbol.match](s) { return s === 'hello' ? 'yes' : 'no'; } }; 'hello'.match(custom) + ',' + 'world'.match(custom)", "yes,no"),
445        ("var custom = { [Symbol.replace](s, r) { return s + '-' + r; } }; 'abc'.replace(custom, '123')", "abc-123"),
446        ("var custom = { [Symbol.search](s) { return s.length; } }; 'abc'.search(custom)", "3"),
447        ("var custom = { [Symbol.split](s, lim) { return [s.length, lim]; } }; 'abc'.split(custom, 5).join(',')", "3,5"),
448        // RegExp.prototype[Symbol.*] 直接呼び出し & RegExp 委譲動作
449        ("typeof /a/[Symbol.match]", "function"),
450        ("/b/[Symbol.match]('abc').join(',')", "b"),
451        ("/b/[Symbol.replace]('abc', 'X')", "aXc"),
452        ("/b/[Symbol.search]('abc')", "1"),
453        ("/b/[Symbol.split]('abc').join(',')", "a,c"),
454        // Symbol.species 静的アクセサ
455        ("Array[Symbol.species] === Array", "true"),
456        ("RegExp[Symbol.species] === RegExp", "true"),
457        ("Promise[Symbol.species] === Promise", "true"),
458        // ArraySpeciesCreate (Symbol.species による派生生成)
459        ("class SubArr extends Array {}; const sa = new SubArr(1, 2, 3); sa.map(x => x*2) instanceof SubArr", "true"),
460        ("class SubArr extends Array {}; const sa = new SubArr(1, 2, 3); sa.filter(x => x > 1) instanceof SubArr", "true"),
461        ("class SubArr extends Array {}; const sa = new SubArr(1, 2, 3); sa.slice(1) instanceof SubArr", "true"),
462        ("class SubArr extends Array {}; const sa = new SubArr(1, 2, 3); sa.concat([4]) instanceof SubArr", "true"),
463        ("class SubArr extends Array {}; const sa = new SubArr(1, 2, 3); sa.splice(1, 1) instanceof SubArr", "true"),
464        ("class SubArr extends Array {}; const sa = new SubArr(1, 2, 3); sa.flatMap(x => [x]) instanceof SubArr", "true"),
465        ("class CustomArr extends Array { static get [Symbol.species]() { return Array; } }; const ca = new CustomArr(1, 2); !(ca.map(x => x) instanceof CustomArr) && ca.map(x => x) instanceof Array", "true"),
466        // Array.prototype[Symbol.unscopables]
467        ("Array.prototype[Symbol.unscopables].includes", "true"),
468        ("Array.prototype[Symbol.unscopables].at", "true"),
469        // setTimeout(マクロタスク。Promise を介して await で駆動)
470        ("var x=0; await new Promise(r => setTimeout(() => { x = 5; r(); }, 0)); x", "5"),
471        ("var done=false; await new Promise(r => setTimeout(() => { done = true; r(); }, 0)); done", "true"),
472        ("await new Promise(res => setTimeout(() => res(7), 0))", "7"),
473        // requestAnimationFrame(マクロタスク。timestamp 引数 + cancelAnimationFrame)
474        ("typeof requestAnimationFrame", "function"),
475        ("var x=0; await new Promise(r => requestAnimationFrame(() => { x = 5; r(); })); x", "5"),
476        ("var ty=''; await new Promise(r => requestAnimationFrame(t => { ty = typeof t; r(); })); ty", "number"),
477        ("var L=''; requestAnimationFrame(() => L+='a'); var id=requestAnimationFrame(() => L+='b'); cancelAnimationFrame(id); await new Promise(r => requestAnimationFrame(() => r())); L", "a"),
478        // localStorage / sessionStorage(静的マップ共有のため各テスト先頭で clear)
479        ("localStorage.clear(); localStorage.setItem('a','1'); localStorage.getItem('a')", "1"),
480        ("localStorage.clear(); localStorage.getItem('missing')", "null"),
481        ("localStorage.clear(); localStorage.setItem('x','9'); localStorage.length", "1"),
482        ("localStorage.clear(); localStorage.setItem('a','1'); localStorage.removeItem('a'); localStorage.getItem('a')", "null"),
483        ("localStorage.clear(); localStorage.foo='bar'; localStorage.getItem('foo')", "bar"),
484        ("sessionStorage.clear(); sessionStorage.setItem('s','2'); sessionStorage.getItem('s')", "2"),
485        // `delete localStorage.foo` も同じ種類の黙殺バグだった(`removeItem` と同義のはずが
486        // Host プロキシが `.props` を持たないため何も起きていなかった)。
487        (
488            "localStorage.clear(); localStorage.foo='bar'; delete localStorage.foo; localStorage.getItem('foo')",
489            "null",
490        ),
491        // `Object.keys/values/entries(localStorage)` と `for...in localStorage` が実データ
492        // (専用マップ側にある) を一切見ておらず常に空になっていたバグの修正確認。
493        (
494            "localStorage.clear(); localStorage.setItem('a','1'); localStorage.setItem('b','2'); Object.keys(localStorage).sort().join(',')",
495            "a,b",
496        ),
497        (
498            "localStorage.clear(); localStorage.setItem('a','1'); localStorage.setItem('b','2'); Object.values(localStorage).sort().join(',')",
499            "1,2",
500        ),
501        (
502            "localStorage.clear(); localStorage.setItem('a','1'); Object.entries(localStorage)[0].join(':')",
503            "a:1",
504        ),
505        (
506            "localStorage.clear(); localStorage.setItem('a','1'); localStorage.setItem('b','2'); var out=[]; for (var k in localStorage) out.push(k); out.sort().join(',')",
507            "a,b",
508        ),
509        (
510            "localStorage.clear(); localStorage.setItem('a','1'); Object.assign({}, localStorage).a",
511            "1",
512        ),
513        // `Object.keys/values/entries(el.dataset)` と `for...in el.dataset` も同種の
514        // バグで実データ(DOM 要素側の `data-*` 属性)を一切見ておらず常に空になって
515        // いた(`localStorage`/`sessionStorage` で修正済みのバグと同型)。
516        (
517            "var e=document.createElement('div'); e.dataset.userId='42'; e.dataset.fooBar='x'; Object.keys(e.dataset).sort().join(',')",
518            "fooBar,userId",
519        ),
520        (
521            "var e=document.createElement('div'); e.dataset.a='1'; e.dataset.b='2'; Object.values(e.dataset).sort().join(',')",
522            "1,2",
523        ),
524        (
525            "var e=document.createElement('div'); e.dataset.a='1'; Object.entries(e.dataset)[0].join(':')",
526            "a:1",
527        ),
528        (
529            "var e=document.createElement('div'); e.dataset.a='1'; e.dataset.b='2'; var out=[]; for (var k in e.dataset) out.push(k); out.sort().join(',')",
530            "a,b",
531        ),
532        (
533            "var e=document.createElement('div'); e.dataset.a='1'; Object.assign({}, e.dataset).a",
534            "1",
535        ),
536        // タグ付きテンプレート `` tag`...${e}...` ``(ES2015)が丸ごと未対応で、`Template`
537        // トークンが式の直後に来ると静かにパースが崩れるバグだった。基本形・複数補間・
538        // `this` 束縛(メソッド呼出形)・組込み `String.raw` を確認。
539        (
540            "function tag(s, ...v){ return s.join('|') + '::' + v.join(','); } tag`a${1}b${2}c`",
541            "a|b|c::1,2",
542        ),
543        (
544            "var o={ tag(s){ return this===o ? s[0] : 'bad'; } }; o.tag`hi`",
545            "hi",
546        ),
547        ("String.raw`a\\nb`", "a\\nb"),
548        ("String.raw`x${1+1}y`", "x2y"),
549        // `strings.raw` はエスケープ未解決のまま渡る(cooked とは別)ことの確認。
550        (
551            "function tag(s){ return s[0] + '|' + s.raw[0]; } tag`a\\nb`",
552            "a\nb|a\\nb",
553        ),
554        // `Object.is(a, b)`(ES2015、SameValue)が丸ごと欠落していた。`===` と違い
555        // `NaN` 同士は等しく、`+0`/`-0` は区別する。
556        ("Object.is(NaN, NaN)", "true"),
557        ("NaN === NaN", "false"),
558        ("Object.is(0, -0)", "false"),
559        ("0 === -0", "true"),
560        ("Object.is(1, 1)", "true"),
561        ("Object.is('a', 'a')", "true"),
562        ("Object.is({}, {})", "false"),
563        // `Reflect.setPrototypeOf`/`isExtensible`/`preventExtensions`/
564        // `getOwnPropertyDescriptor` が丸ごと欠落していた。
565        (
566            "var o={}; var p={x:1}; Reflect.setPrototypeOf(o,p); o.x",
567            "1",
568        ),
569        ("var o={}; Reflect.isExtensible(o)", "true"),
570        (
571            "var o={}; Reflect.preventExtensions(o); Reflect.isExtensible(o)",
572            "false",
573        ),
574        (
575            "Reflect.getOwnPropertyDescriptor({x:1}, 'x').value",
576            "1",
577        ),
578        // `Array.prototype.fill(value, start, end)` が第2/第3引数を完全に無視し、
579        // 常に配列全体を上書きしていた。
580        ("[1,2,3,4,5].fill(0,1,3).join(',')", "1,0,0,4,5"),
581        ("[1,2,3,4,5].fill(9).join(',')", "9,9,9,9,9"),
582        ("[1,2,3,4,5].fill(0,-2).join(',')", "1,2,3,0,0"),
583        ("[1,2,3].fill(0,1).join(',')", "1,0,0"),
584        // `Array.prototype.indexOf`/`includes` の `fromIndex`(第2引数)が完全に無視され、
585        // 常に先頭から探索していた。
586        ("[1,2,3,2,1].indexOf(2, 2)", "3"),
587        ("[1,2,3].indexOf(1, 1)", "-1"),
588        ("[1,2,3].indexOf(2, -2)", "1"),
589        ("[1,2,3].includes(1, 1)", "false"),
590        ("[1,2,3].includes(2, 1)", "true"),
591        // `lastIndexOf` にも同じ `fromIndex` 無視バグがあった。
592        ("[1,2,1,2,1].lastIndexOf(2, 2)", "1"),
593        ("[1,2,3].lastIndexOf(3, 1)", "-1"),
594        ("[1,2,3].lastIndexOf(1, -1)", "0"),
595        ("[1,2,3,2].lastIndexOf(2)", "3"),
596        // `fromIndex` に NaN を渡すと仕様上 `ToIntegerOrInfinity(NaN)=0` として扱われ
597        // index 0 のみを見るはずだが、以前は無条件に -1 を返していた。
598        ("[5,1,2].lastIndexOf(5, NaN)", "0"),
599        ("[5,1,2].lastIndexOf(1, NaN)", "-1"),
600        // URLSearchParams
601        ("new URLSearchParams('a=1&b=2').get('a')", "1"),
602        ("new URLSearchParams('?a=1&b=2').get('b')", "2"),
603        ("new URLSearchParams('a=1&a=2').getAll('a').join(',')", "1,2"),
604        ("new URLSearchParams('a=1').has('a') + ',' + new URLSearchParams('a=1').has('z')", "true,false"),
605        ("var p=new URLSearchParams('a=1'); p.append('b','2'); p.toString()", "a=1&b=2"),
606        ("var p=new URLSearchParams('a=1&b=2'); p.delete('a'); p.toString()", "b=2"),
607        ("var p=new URLSearchParams('a=1'); p.set('a','9'); p.get('a')", "9"),
608        // `new URLSearchParams(init)` の init がオブジェクトの場合(sequence of
609        // pairs / record / 既存インスタンス)が丸ごと壊れていたバグ(`to_js_string`
610        // 丸投げで常に `"[object Object]"` 相当に落ちていた)。
611        ("new URLSearchParams([['a','1'],['b','2']]).toString()", "a=1&b=2"),
612        ("new URLSearchParams({a:'1',b:'2'}).toString()", "a=1&b=2"),
613        (
614            "var p1=new URLSearchParams('a=1&b=2'); new URLSearchParams(p1).toString()",
615            "a=1&b=2",
616        ),
617        // URLSearchParams: %XX / + デコード(form-urlencoded)
618        ("new URLSearchParams('a=hello%20world').get('a')", "hello world"),
619        ("new URLSearchParams('a=hello+world').get('a')", "hello world"),
620        ("var p=new URLSearchParams(); p.set('a','hello world'); p.toString()", "a=hello+world"),
621        ("var p=new URLSearchParams(); p.set('a','a&b=c'); p.get('a')", "a&b=c"),
622        // `entries`/`keys`/`values`/`forEach` が `URLSearchParams` に丸ごと欠落していた
623        // (`FormData` は既にあったが、内部表現が同じなのに移植されていなかった)。
624        (
625            "[...new URLSearchParams('a=1&b=2').entries()].map(e=>e[0]+':'+e[1]).join(',')",
626            "a:1,b:2",
627        ),
628        ("new URLSearchParams('a=1&b=2').keys().join(',')", "a,b"),
629        ("new URLSearchParams('a=1&b=2').values().join(',')", "1,2"),
630        (
631            "var s=''; new URLSearchParams('a=1&b=2').forEach(function(v,k){ s+=k+'='+v+';'; }); s",
632            "a=1;b=2;",
633        ),
634        // `Symbol.iterator` 未登録で `for (const [k,v] of params)`(`entries()` と同義の
635        // 既定イテレーション)が丸ごと非対応だったバグ。`FormData` にも同じ修正を適用。
636        (
637            "var out=[]; for (const [k,v] of new URLSearchParams('a=1&b=2')) out.push(k+':'+v); out.join(',')",
638            "a:1,b:2",
639        ),
640        (
641            "var fd=new FormData(); fd.set('x','9'); var out=[]; for (const [k,v] of fd) out.push(k+':'+v); out.join(',')",
642            "x:9",
643        ),
644        // URLPattern API (HTML Standard)
645        ("new URLPattern('/users/:id').test('/users/123')", "true"),
646        ("new URLPattern({ pathname: '/about' }).test('/about')", "true"),
647        ("new URLPattern('/users/:id').exec('/users/123').pathname.input", "/users/123"),
648        ("new URLPattern('/admin/*').test('/users/123')", "false"),
649        // encodeURIComponent / decodeURIComponent
650        ("encodeURIComponent('hello world')", "hello%20world"),
651        ("encodeURIComponent('a=1&b=2')", "a%3D1%26b%3D2"),
652        ("decodeURIComponent('hello%20world')", "hello world"),
653        ("decodeURIComponent(encodeURIComponent('日本語'))", "日本語"),
654        ("encodeURIComponent(\"!'()*\")", "!'()*"),
655        // encodeURI / decodeURI(予約文字は残す)
656        ("encodeURI('https://example.com/a b?x=1&y=2')", "https://example.com/a%20b?x=1&y=2"),
657        ("decodeURI('https://example.com/a%20b')", "https://example.com/a b"),
658        // `escape`/`unescape`(Annex B.2.1)が丸ごと未対応だった。
659        ("escape('a b?c')", "a%20b%3Fc"),
660        ("unescape(escape('a b?c'))", "a b?c"),
661        // ASCII 範囲外は `%uXXXX` 形式になる。
662        ("escape('日')", "%u65E5"),
663        ("unescape('%u65E5')", "日"),
664        // Annex B.2.3 の `String.prototype` HTML ラッパーメソッド群が丸ごと未対応だった。
665        ("'hi'.bold()", "<b>hi</b>"),
666        ("'hi'.italics()", "<i>hi</i>"),
667        ("'hi'.big()", "<big>hi</big>"),
668        ("'hi'.small()", "<small>hi</small>"),
669        ("'hi'.strike()", "<strike>hi</strike>"),
670        ("'hi'.sub()", "<sub>hi</sub>"),
671        ("'hi'.sup()", "<sup>hi</sup>"),
672        ("'hi'.fixed()", "<tt>hi</tt>"),
673        ("'hi'.blink()", "<blink>hi</blink>"),
674        ("'hi'.anchor('top')", "<a name=\"top\">hi</a>"),
675        ("'hi'.link('x.html')", "<a href=\"x.html\">hi</a>"),
676        ("'hi'.fontcolor('red')", "<font color=\"red\">hi</font>"),
677        ("'hi'.fontsize(3)", "<font size=\"3\">hi</font>"),
678        // 属性値の `\"` は `&quot;` へエスケープする(仕様どおり)。
679        ("'hi'.anchor('a\"b')", "<a name=\"a&quot;b\">hi</a>"),
680        // `trimLeft`/`trimRight`(Annex B.2.2。`trimStart`/`trimEnd` の別名)が
681        // 丸ごと未対応だった。
682        ("'  hi  '.trimLeft()", "hi  "),
683        ("'  hi  '.trimRight()", "  hi"),
684        // FormData (空生成 + API)
685        ("var f=new FormData(); f.append('a','1'); f.append('b','2'); f.get('a')", "1"),
686        ("var f=new FormData(); f.append('a','1'); f.append('a','2'); f.getAll('a').join(',')", "1,2"),
687        ("var f=new FormData(); f.append('a','1'); f.append('b','2'); f.toString()", "a=1&b=2"),
688        ("var f=new FormData(); f.append('a','1'); f.set('a','9'); f.get('a')", "9"),
689        ("var f=new FormData(); f.append('a','1'); f.has('a')+','+f.has('z')", "true,false"),
690        ("var f=new FormData(); f.append('a','1'); f.append('b','2'); f.entries().map(function(e){return e[0]+'='+e[1]}).join('&')", "a=1&b=2"),
691        ("var f=new FormData(); f.append('a','1'); f.append('b','2'); f.keys().join(',')", "a,b"),
692        ("var f=new FormData(); f.append('a','1'); f.append('b','2'); var s=''; f.forEach(function(v,k){s+=k+':'+v+';'}); s", "a:1;b:2;"),
693        // URL
694        ("new URL('https://e.com/p?x=1#h').pathname", "/p"),
695        ("new URL('https://e.com/p?x=1').searchParams.get('x')", "1"),
696        // `new URL(url, base)` の第2引数 base が丸ごと無視され、相対URL解決という
697        // URL API 最も基本的な使い方が機能しなかったバグ(既存の `resolve_url`
698        // ヘルパは `fetch`/XHR では既に使われていたが `URL` コンストラクタには
699        // 配線されていなかった。`.`/`..` セグメントの解決は非対応の簡略実装
700        // という既存の制約はそのまま)。
701        ("new URL('/a/b', 'https://e.com/x/y').href", "https://e.com/a/b"),
702        ("new URL('c', 'https://e.com/a/b').href", "https://e.com/a/c"),
703        // `user:pass@host` 形式のユーザー情報(userinfo)が丸ごと未対応で、
704        // `hostname`(引いては `host`/`port`/`origin`)にそのまま混入し
705        // 壊れた値になるバグだった(`user` が `hostname` の一部に化ける)。
706        ("new URL('https://user:pass@example.com/p').hostname", "example.com"),
707        ("new URL('https://user:pass@example.com/p').username", "user"),
708        ("new URL('https://user:pass@example.com/p').password", "pass"),
709        ("new URL('https://user:pass@example.com/p').origin", "https://example.com"),
710        // ユーザー情報無しの通常URLでは既定値が空文字列のまま(回帰確認)。
711        ("new URL('https://example.com/p').username", ""),
712        // `url.href = '...'`(URL全体を再パースして全コンポーネントを書き換える
713        // 定番の再代入パターン)が丸ごと未対応で、セッターが無いため代入が
714        // 黙って無視されていた。
715        (
716            "var u=new URL('https://a.com/x'); u.href='https://b.com/y?z=1'; u.hostname",
717            "b.com",
718        ),
719        (
720            "var u=new URL('https://a.com/x'); u.href='https://b.com/y?z=1'; u.pathname",
721            "/y",
722        ),
723        (
724            "var u=new URL('https://a.com/x'); u.href='https://b.com/y?z=1'; u.searchParams.get('z')",
725            "1",
726        ),
727        (
728            // オブジェクト自体は再代入せず同じインスタンスを書き換えるため、
729            // 元の変数参照からも新しい値が見える。
730            "var u=new URL('https://a.com/x'); var u2=u; u.href='https://b.com/y'; u2.href",
731            "https://b.com/y",
732        ),
733        // `url.pathname`/`.search`/`.hash`の個別再代入が丸ごと未対応だった。
734        // 特に`.search`は`url.toString()`/`.href`が`searchParams`だけを見て
735        // `search`プロパティ自体は読まないため、代入しても何も反映されない
736        // という`.href`丸ごと差し替えとは別種の静かな不整合があった。
737        (
738            "var u=new URL('https://a.com/x'); u.pathname='y'; u.href",
739            "https://a.com/y",
740        ),
741        (
742            "var u=new URL('https://a.com/x'); u.search='z=1'; u.href",
743            "https://a.com/x?z=1",
744        ),
745        (
746            "var u=new URL('https://a.com/x'); u.search='z=1'; u.searchParams.get('z')",
747            "1",
748        ),
749        (
750            "var u=new URL('https://a.com/x?old=1'); u.search='new=2'; u.href",
751            "https://a.com/x?new=2",
752        ),
753        (
754            "var u=new URL('https://a.com/x'); u.hash='frag'; u.href",
755            "https://a.com/x#frag",
756        ),
757        (
758            // 空文字列への代入はコンポーネントを除去する(クエリ/フラグメント無しに戻る)。
759            "var u=new URL('https://a.com/x?y=1#z'); u.search=''; u.hash=''; u.href",
760            "https://a.com/x",
761        ),
762        // `url.protocol`/`.host`/`.hostname`/`.port`の個別再代入も丸ごと
763        // 未対応だった。これら4つは互いに依存する派生値(`host`=`hostname`+
764        // `:`+`port`、`origin`=`protocol`+`//`+`host`)を持つため、どれを
765        // 代入しても`host`/`origin`を再計算し直す必要がある。
766        (
767            "var u=new URL('https://a.com:8080/x'); u.hostname='b.com'; u.href",
768            "https://b.com:8080/x",
769        ),
770        (
771            "var u=new URL('https://a.com:8080/x'); u.hostname='b.com'; u.origin",
772            "https://b.com:8080",
773        ),
774        (
775            "var u=new URL('https://a.com/x'); u.port='9090'; u.host",
776            "a.com:9090",
777        ),
778        (
779            "var u=new URL('https://a.com:8080/x'); u.host='c.com:7070'; u.hostname + ',' + u.port",
780            "c.com,7070",
781        ),
782        (
783            "var u=new URL('http://a.com/x'); u.protocol='https'; u.href",
784            "https://a.com/x",
785        ),
786        // クエリのみ/フラグメントのみの相対参照(`?x=2`/`#frag`)が、他の
787        // 相対パス解決と同じ「ディレクトリ相対」ロジックに落ちてベースの
788        // パスの最後のセグメントごと消えるバグだった。
789        ("new URL('?x=2', 'https://e.com/a/b?x=1').href", "https://e.com/a/b?x=2"),
790        ("new URL('#frag', 'https://e.com/a/b?x=1').href", "https://e.com/a/b?x=1#frag"),
791        // プロトコル相対URL(`//host/path`)が、ベースのホスト配下の相対パスと
792        // して誤解決されるバグだった(`//cdn.example.com/x.js` は別ホストへの
793        // 参照であり、ベースホスト配下のパスにしてはいけない)。
794        ("new URL('//cdn.example.com/x.js', 'https://e.com/a/b').href", "https://cdn.example.com/x.js"),
795        // `URL.canParse(url, base?)`(ES2023/WHATWG)が丸ごと未対応だった。
796        ("URL.canParse('https://example.com')", "true"),
797        ("URL.canParse('not a url')", "false"),
798        ("URL.canParse('/path', 'https://example.com')", "true"),
799        ("URL.canParse('/path')", "false"),
800        // `URL.parse(url, base?)`(ES2024/WHATWG)が丸ごと未対応だった。
801        // `try { new URL(x) } catch { null }` の1メソッド版。
802        ("URL.parse('https://example.com/p').pathname", "/p"),
803        ("URL.parse('not a url') === null", "true"),
804        ("URL.parse('/path', 'https://example.com').host", "example.com"),
805        ("URL.parse('/path') === null", "true"),
806        // `URL.createObjectURL(blob)`/`.revokeObjectURL(url)` が丸ごと未対応だった。
807        ("URL.createObjectURL(new Blob(['x'])).startsWith('blob:')", "true"),
808        // 呼び出す毎に一意な URL を発行する。
809        (
810            "URL.createObjectURL(new Blob(['x'])) === URL.createObjectURL(new Blob(['x']))",
811            "false",
812        ),
813        ("typeof URL.revokeObjectURL('blob:x')", "undefined"),
814        // `URLSearchParams.prototype.size`(ES2023)が丸ごと未対応だった。
815        ("new URLSearchParams('a=1&b=2').size", "2"),
816        (
817            "var p=new URLSearchParams('a=1'); p.append('b','2'); p.size",
818            "2",
819        ),
820        (
821            "var p=new URLSearchParams('a=1&b=2'); p.delete('a'); p.size",
822            "1",
823        ),
824        ("new URLSearchParams('').size", "0"),
825        // `has(name, value)`/`delete(name, value)`(ES2023 の第2引数)が丸ごと
826        // 無視され、値を問わず同名エントリを判定/削除してしまうバグだった。
827        ("new URLSearchParams('a=1&a=2').has('a', '1')", "true"),
828        ("new URLSearchParams('a=1&a=2').has('a', '9')", "false"),
829        (
830            "var p=new URLSearchParams('a=1&a=2'); p.delete('a','1'); p.getAll('a').join(',')",
831            "2",
832        ),
833        (
834            "var p=new URLSearchParams('a=1&a=2'); p.delete('a'); p.getAll('a').join(',')",
835            "",
836        ),
837        // `URLSearchParams.prototype.sort()`(ES2020)が丸ごと未対応だった。
838        (
839            "var p=new URLSearchParams('c=3&a=1&b=2'); p.sort(); p.toString()",
840            "a=1&b=2&c=3",
841        ),
842        (
843            "var p=new URLSearchParams('b=2&a=1&a=0'); p.sort(); p.getAll('a').join(',')",
844            "1,0",
845        ),
846        // `url.toString()`(暗黙の文字列化 `fetch(url)` 等でも使われる)が `href` の
847        // 構築時点スナップショットのままで、`searchParams` の変更を反映しないバグ。
848        (
849            "var u=new URL('https://e.com/p?x=1'); u.searchParams.set('x','9'); u.toString()",
850            "https://e.com/p?x=9",
851        ),
852        (
853            "var u=new URL('https://e.com/p'); u.searchParams.append('a','1'); u.searchParams.append('b','2'); u.toString()",
854            "https://e.com/p?a=1&b=2",
855        ),
856        (
857            "var u=new URL('https://e.com/p?x=1#h'); u.searchParams.delete('x'); u.toString()",
858            "https://e.com/p#h",
859        ),
860        // `URL.prototype.toJSON`(仕様上 `toString()` と同じ href を返すだけの
861        // エイリアス)が丸ごと未対応で、`JSON.stringify(url)` がプロパティ丸ごとの
862        // JSON になってしまうバグだった。
863        (
864            "JSON.stringify({u: new URL('https://e.com/p?x=1')})",
865            "{\"u\":\"https://e.com/p?x=1\"}",
866        ),
867        // base64
868        ("btoa('hello')", "aGVsbG8="),
869        ("atob('aGVsbG8=')", "hello"),
870        ("atob(btoa('AtmOS roundtrip'))", "AtmOS roundtrip"),
871        // WebAssembly(os_lib/wasm + prelude/wasm.js)。
872        ("var wb = new Uint8Array([0,97,115,109,1,0,0,0,1,7,1,96,2,127,127,1,127,3,2,1,0,7,7,1,3,97,100,100,0,0,10,9,1,7,0,32,0,32,1,106,11]); [typeof WebAssembly, WebAssembly.validate(wb), WebAssembly.validate(new Uint8Array([1,2,3]))].join()", "object,true,false"),
873        ("new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,7,1,96,2,127,127,1,127,3,2,1,0,7,7,1,3,97,100,100,0,0,10,9,1,7,0,32,0,32,1,106,11]))).exports.add(2, 3)", "5"),
874        ("var wr = await WebAssembly.instantiate(new Uint8Array([0,97,115,109,1,0,0,0,1,7,1,96,2,127,127,1,127,3,2,1,0,7,7,1,3,97,100,100,0,0,10,9,1,7,0,32,0,32,1,106,11])); wr.instance.exports.add(40, 2) + ',' + (wr.module instanceof WebAssembly.Module)", "42,true"),
875        ("try { new WebAssembly.Module(new Uint8Array([0, 1, 2])); 'no' } catch (e) { (e instanceof WebAssembly.CompileError) + ',' + e.name }", "true,CompileError"),
876        ("var wm = new WebAssembly.Memory({ initial: 1, maximum: 3 }); var l0 = wm.buffer.byteLength; var g0 = wm.grow(1); [l0, g0, wm.buffer.byteLength].join()", "65536,1,131072"),
877        ("var wi = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,6,1,96,1,127,1,127,2,9,1,3,101,110,118,1,102,0,0,3,2,1,0,7,5,1,1,103,0,1,10,11,1,9,0,32,0,16,0,65,1,106,11])), { env: { f: function (x) { return x * 2; } } }); wi.exports.g(5)", "11"),
878        ("try { new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,7,1,96,2,127,127,1,127,3,2,1,0,7,7,1,3,100,105,118,0,0,10,9,1,7,0,32,0,32,1,109,11]))).exports.div(1, 0); 'no' } catch (e) { (e instanceof WebAssembly.RuntimeError) + ':' + e.message }", "true:integer divide by zero"),
879        // Trusted Types(prelude/trustedtypes.js)と DOM 代入の ToString。
880        ("var tp = trustedTypes.createPolicy('atmos-t', { createHTML: function (s) { return s + '!'; } }); var th = tp.createHTML('<b>x</b>'); [typeof trustedTypes, th instanceof TrustedHTML, String(th), trustedTypes.isHTML(th), trustedTypes.isHTML('a'), tp.name, trustedTypes.emptyHTML.toString() === ''].join()", "object,true,<b>x</b>!,true,false,atmos-t,true"),
881        ("var tp2 = trustedTypes.createPolicy('atmos-u', {}); try { tp2.createScriptURL('a'); 'no' } catch (e) { e instanceof TypeError }", "true"),
882        ("try { new TrustedHTML(); 'no' } catch (e) { e.message }", "Illegal constructor"),
883        ("[trustedTypes.getPropertyType('div', 'innerHTML'), trustedTypes.getAttributeType('script', 'src'), trustedTypes.getAttributeType('div', 'onclick'), trustedTypes.getAttributeType('div', 'title')].join()", "TrustedHTML,TrustedScriptURL,TrustedScript,"),
884        ("var td = document.createElement('div'); td.innerHTML = trustedTypes.createPolicy('atmos-v', { createHTML: function (s) { return s; } }).createHTML('<i>q</i>'); td.setAttribute('title', { toString: function () { return 'tt'; } }); td.firstChild.tagName + td.getAttribute('title')", "Itt"),
885        // iframe の contentWindow にも組み込みがある。
886        ("var cf = document.createElement('iframe'); var cw = cf.contentWindow; [typeof cw.String.prototype.charAt, typeof cw.Function, typeof cw.JSON.stringify, cw.window === cw, cw.globalThis === cw, cw.parent === window].join()", "function,function,function,true,true,true"),
887        // document.all([[IsHTMLDDA]])。
888        ("var da = document.all; [typeof da, !!da, da == null, da == undefined, da === undefined, typeof da.length, (function (k) { return !k && k !== document.all; })(undefined)].join()", "undefined,false,true,true,false,number,true"),
889        // 要素の並びが同じなら同じ配列(2026-11-05 の使い回し。以前は読むたびに別の配列だった)。
890        ("String(document.all === document.all)", "true"),
891        // window のアクセサを素の識別子で読む(YouTube の window.Polymer)。
892        ("var pv = 0; Object.defineProperty(window, 'atmosAcc', { get: function () { pv++; return 41; }, set: function (v) {}, configurable: true }); [atmosAcc + 1, typeof atmosAcc, pv].join()", "42,number,2"),
893        // 長い文字列の UTF-16 の単位の表(props_methods.rs の UnitsCache)。
894        ("var ls = ''; for (var li = 0; li < 300; li++) ls += 'あa'; var lsum = 0; for (var lj = 0; lj < ls.length; lj++) lsum += ls.charCodeAt(lj); [ls.length, lsum, ls[599], ls.charAt(1), ls.slice(598), ls.substring(0, 3), ls.substr(2, 2), ls.codePointAt(0)].join()", "600,3735300,a,a,あa,あaあ,あa,12354"),
895        ("var la = new Array(400).join('x') + 'yz'; var lb = la + '!'; [la.length, lb.length, la.charCodeAt(400), lb.charAt(401), lb[401], la.slice(-2)].join()", "401,402,122,!,!,yz"),
896        // 反復中の配列の変更(仕様: 長さは最初に決め、要素は訪れたときに読む。無くなった要素は飛ばす)。
897        ("var fa = [1, 2, 3], fs = []; fa.forEach(function (x) { fs.push(x); if (x == 1) fa.pop(); }); fs.join()", "1,2"),
898        ("[1, 2].map(function (x, i, arr) { if (i == 0) arr.push(9); return x * 10; }).join()", "10,20"),
899        ("var fb = [1, 2, 3]; fb.filter(function (x, i) { if (i == 0) fb[2] = 7; return x > 1; }).join()", "2,7"),
900        // Web Audio(prelude/webaudio.js)。
901        ("var ac = new AudioContext(); [typeof AudioContext, ac.state, ac.sampleRate, ac.destination instanceof AudioNode, ac.createAnalyser().frequencyBinCount].join()", "function,suspended,48000,true,1024"),
902        ("var oc = new OfflineAudioContext(1, 4410, 44100); var os = oc.createOscillator(); os.type = 'triangle'; os.frequency.value = 10000; var cp = oc.createDynamicsCompressor(); os.connect(cp); cp.connect(oc.destination); os.start(0); var rb = await oc.startRendering(); var s = 0; var d = rb.getChannelData(0); for (var i = 0; i < d.length; i++) s += Math.abs(d[i]); [rb.length, rb.sampleRate, s > 10, cp.reduction < 0].join()", "4410,44100,true,true"),
903        // PromiseRejectionEvent(promise と reason を持つ Event)。
904        ("var pr = Promise.resolve(1); var pe = new PromiseRejectionEvent('unhandledrejection', { promise: pr, reason: 'x' }); [pe.type, pe.reason, pe.promise === pr, pe instanceof Event].join()", "unhandledrejection,x,true,true"),
905        // BigInt64Array / BigUint64Array(要素は BigInt、2^64 で丸める)。
906        ("var b = new BigInt64Array([1n, -2n, 2n ** 63n]); [typeof b[0], b[1], b[2], b.length, b.BYTES_PER_ELEMENT].join()", "bigint,-2,-9223372036854775808,3,8"),
907        ("var u = new BigUint64Array(2); u[0] = -1n; u[1] = 5n; [u[0], u[1]].join()", "18446744073709551615,5"),
908        ("var a8 = new BigInt64Array(new ArrayBuffer(16)); a8[1] = 7n; new Uint8Array(a8.buffer)[8]", "7"),
909        // SourceBuffer のインターフェース(addSourceBuffer が返すものはそのインスタンス)。
910        ("typeof SourceBuffer + ',' + (new MediaSource().addSourceBuffer('video/mp4; codecs=\"avc1.4d401e\"') instanceof SourceBuffer)", "function,true"),
911        // Navigator・Screen・Performance 等のインターフェースと、空の navigator.plugins(PDF を表示できないので仕様どおり空)。
912        ("[typeof Navigator, navigator instanceof Navigator, screen instanceof Screen, performance instanceof Performance, typeof PluginArray, typeof CSSStyleDeclaration].join()", "function,true,true,true,function,function"),
913        ("[navigator.plugins.length, navigator.mimeTypes.length, navigator.plugins.item(0), navigator.pdfViewerEnabled, navigator.plugins instanceof PluginArray].join()", "0,0,,false,true"),
914        // Function.prototype.toString は定義のソースを返す(従来は `function f() { [code] }`)。
915        ("function foo(a, b) { return a + b; } foo.toString()", "function foo(a, b) { return a + b; }"),
916        ("(function () { return 1 }).toString()", "function () { return 1 }"),
917        ("var af = async function g() { await 0; }; af.toString()", "async function g() { await 0; }"),
918        ("function lb() { var a = 0; a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++;a++; return a; } var ls = lb.toString(); (ls.indexOf('a++;a++;') > 0) + ',' + ls.slice(0, 13) + ',' + ls.slice(-11)", "true,function lb(),return a; }"),
919        // eval / new Function の構文エラーは SyntaxError(従来は読み飛ばして実行した)。
920        ("try { eval('(' + Array.prototype.push.toString() + ')'); 'no' } catch (e) { e.name }", "SyntaxError"),
921        ("try { (0, eval)('(' + Math.max.toString() + ')'); 'no' } catch (e) { e.name }", "SyntaxError"),
922        ("try { new Function('return ]'); 'no' } catch (e) { e.name }", "SyntaxError"),
923        // 関数の本体の中の構文エラーも eval の時点で投げる(遅延解析で呼ばれるまで見逃していた)。
924        ("try { var g = eval('(function B() {\\n  [native code]\\n})'); 'no:' + typeof g } catch (e) { e.name }", "SyntaxError"),
925        ("eval('1 + 2')", "3"),
926        // 直接 eval は呼び出し元のスコープで実行する(従来は常にグローバルだった)。間接 eval はグローバルのまま。
927        ("(function(){ var $x = 5; return (function(D){ return eval(D); })('$x + 1'); })()", "6"),
928        ("(function(){ var k = 1; (function(D){ eval(D); })('k = 9'); return k; })()", "9"),
929        ("(function(){ (function(D){ eval(D); })('var zz9 = 1'); return typeof zz9; })()", "undefined"),
930        ("(function(){ var f = function(D){ return eval(D); }; var s = 0; for (var i = 0; i < 12; i++) s = f('i * 2'); return s; })()", "22"),
931        ("(function(){ var q = 1; return (0, eval)('typeof q'); })()", "undefined"),
932        // 大きな整数の文字列化(従来は 2^63 以上が i64 の最大値になった)。
933        ("[String(2 ** 63 + 4096), String(1e20), String(-(2 ** 64)), String(2 ** 53)].join()", "9223372036854780000,100000000000000000000,-18446744073709552000,9007199254740992"),
934        // ToInt32 は 2^32 での剰余(従来は 2^63 以上で飽和していた)。
935        ("[(0xFFFFFFFF * 0xFFFFFFFF) | 0, 1e20 | 0, -1e20 | 0, 1e20 >>> 0, Math.imul(1e20, 3), Math.clz32(1e20)].join()", "0,1661992960,-1661992960,1661992960,691011584,1"),
936        // 配列の delete は穴を残す(in・Object.keys・for-in に出ない。値を書けば戻る)。
937        ("var a = [1, 2, 3]; delete a[1]; (1 in a) + ',' + a.length + ',' + Object.keys(a).join('|')", "false,3,0|2"),
938        ("var a = [1, 2, 3]; delete a[1]; var k = []; for (var i in a) k.push(i); k.join()", "0,2"),
939        ("var a = [1, 2, 3]; delete a[1]; a[1] = 5; (1 in a) + ',' + a.join()", "true,1,5,3"),
940        // == で null/undefined は互いにしか等しくない(従来は `false == null` が true だった)。
941        ("[false == null, 0 == null, '' == undefined, false == undefined, null == undefined, false != null].join()", "false,false,false,false,true,true"),
942        ("var c; while (true) if (false != (c = 175, null)) break; c", "175"),
943        // atob は 1 バイトを 1 文字(0〜255)にする(従来は UTF-8 として読み直して 0x80 以上が壊れていた)。
944        ("var s = atob('AID/'); s.length + ',' + s.charCodeAt(0) + ',' + s.charCodeAt(1) + ',' + s.charCodeAt(2)", "3,0,128,255"),
945        ("btoa(String.fromCharCode(0, 128, 255))", "AID/"),
946        ("atob(' AI D/\\n')", "\u{0}\u{80}\u{ff}"),
947        // 不正な入力は InvalidCharacterError(長さの余り 1・base64 以外の文字・Latin1 以外)。
948        ("try { atob('abcde'); 'no' } catch (e) { e.name }", "InvalidCharacterError"),
949        ("try { atob('ab*d'); 'no' } catch (e) { e.name }", "InvalidCharacterError"),
950        ("try { btoa('あ'); 'no' } catch (e) { e.name }", "InvalidCharacterError"),
951        // navigator / performance
952        ("navigator.platform", "AtmOS"),
953        ("typeof navigator.userAgent", "string"),
954        ("navigator.onLine", "true"),
955        // `navigator.cookieEnabled`/`.hardwareConcurrency`/`.maxTouchPoints`/
956        // `.languages`/`.webdriver`(丸ごと未対応だった)。
957        ("navigator.cookieEnabled", "true"),
958        ("navigator.hardwareConcurrency", "4"),
959        ("navigator.maxTouchPoints", "0"),
960        ("navigator.languages[0]", "ja-JP"),
961        ("navigator.webdriver", "false"),
962        // `navigator.userAgentData`(Client Hints API。丸ごと未対応だった。
963        // `navigator.userAgent`文字列パースに代わる構造化版の定番フィー
964        // チャー検出パターン。2026-07-17 発見・実装)。
965        (
966            "navigator.userAgentData.brands[0].brand + ',' + navigator.userAgentData.mobile + ',' + \
967             navigator.userAgentData.platform",
968            "AtmOSBrowser,false,AtmOS",
969        ),
970        (
971            "await navigator.userAgentData.getHighEntropyValues(['architecture','bitness']).then(v => \
972             v.architecture + ',' + v.bitness + ',' + v.platform)",
973            "arm,64,AtmOS",
974        ),
975        // `navigator.storage`(StorageManager API。`.estimate()`/`.persist()`/
976        // `.persisted()`が丸ごと未対応だった。2026-07-17 発見・実装。実際の
977        // ディスク使用量計測機構が無いため`usage:0`の誠実な簡略値、
978        // `persist`/`persisted`は常に`true`)。
979        (
980            "await navigator.storage.estimate().then(e => typeof e.usage + ',' + typeof e.quota)",
981            "number,number",
982        ),
983        ("await navigator.storage.persist()", "true"),
984        ("await navigator.storage.persisted()", "true"),
985        // `CompressionStream`(2026-10-27)。YouTube の player のログ送信と同じ使い方:
986        // 読む側の Promise を先に作り、書いて閉じると圧縮結果で解決する。
987        (
988            "var cs = new CompressionStream('gzip'); var c = new Response(cs.readable).arrayBuffer(); \
989             var w = cs.writable.getWriter(); await w.write(new TextEncoder().encode('hello hello hello')); \
990             w.close(); var u = new Uint8Array(await c); u[0] + ',' + u[1] + ',' + u[2] + ',' + (u.length > 18)",
991            "31,139,8,true",
992        ),
993        (
994            "var cs = new CompressionStream('deflate'); var c = new Response(cs.readable).arrayBuffer(); \
995             var w = cs.writable.getWriter(); w.write(new Uint8Array([1,2,3])); w.close(); \
996             var u = new Uint8Array(await c); u[0] + ',' + u[1]",
997            "120,1",
998        ),
999        ("try { new CompressionStream('br'); 'no' } catch (e) { e instanceof TypeError }", "true"),
1000        // `DecompressionStream`(2026-11-15): gzip / deflate / deflate-raw の往復検証。
1001        (
1002            "var cs = new CompressionStream('gzip'); var cw = cs.writable.getWriter(); \
1003             cw.write(new TextEncoder().encode('hello gzip stream!')); cw.close(); \
1004             var compressed = new Uint8Array(await new Response(cs.readable).arrayBuffer()); \
1005             var ds = new DecompressionStream('gzip'); var dw = ds.writable.getWriter(); \
1006             dw.write(compressed); dw.close(); \
1007             await new Response(ds.readable).text()",
1008            "hello gzip stream!",
1009        ),
1010        (
1011            "try { new DecompressionStream('br'); 'no' } catch (e) { e instanceof TypeError }",
1012            "true",
1013        ),
1014        // `new Response(readableStream)` は、ストリームの中身を本文にする。
1015        (
1016            "await new Response(new ReadableStream({ start(c) { c.enqueue(new TextEncoder().encode('ab')); c.close(); } })).text()",
1017            "ab",
1018        ),
1019        ("typeof performance.now()", "number"),
1020        // performance.now() は実時刻で進む(呼び出しの回数ではない)。
1021        ("var a=performance.now(); for(var i=0;i<20000;i++){} performance.now()-a>2", "true"),
1022        ("var a=performance.now(), b=performance.now(); b>a", "true"),
1023        // Performance Timeline / User Timing API(`mark`/`measure`/
1024        // `getEntriesByType`/`getEntriesByName`/`clearMarks`/`clearMeasures`)
1025        // が `now()` 以外丸ごと未対応だった。
1026        ("performance.mark('a').entryType", "mark"),
1027        (
1028            "performance.mark('s1'); performance.mark('e1'); \
1029             performance.measure('m1','s1','e1').entryType",
1030            "measure",
1031        ),
1032        // `performance.timeOrigin`(丸ごと未対応だった。2026-07-16 発見・
1033        // 実装)。自己テストはブート初期段階(壁時計がまだ NTP 同期前)に
1034        // 実行されるため `epoch_ms_now()` が `0` を返しうる。数値型である
1035        // ことのみ検証し、正の値は断定しない。
1036        ("typeof performance.timeOrigin", "number"),
1037        ("performance.timeOrigin >= 0", "true"),
1038        // `performance.getEntries()`(フィルタ無し全件取得。丸ごと未対応
1039        // だった。2026-07-16 発見・実装)。
1040        (
1041            "performance.mark('ge1'); performance.getEntries().some(e => e.name === 'ge1')",
1042            "true",
1043        ),
1044        ("performance.mark('a'); performance.getEntriesByType('mark').length > 0", "true"),
1045        ("performance.mark('a'); performance.getEntriesByName('a', 'mark').length", "1"),
1046        (
1047            "performance.mark('to-clear'); performance.clearMarks('to-clear'); \
1048             performance.getEntriesByName('to-clear').length",
1049            "0",
1050        ),
1051        (
1052            "performance.mark('sX'); performance.mark('eX'); \
1053             performance.measure('mX','sX','eX'); performance.clearMeasures(); \
1054             performance.getEntriesByType('measure').length",
1055            "0",
1056        ),
1057        // `PerformanceObserver`(丸ごと未対応だった。`observe({entryTypes})`
1058        // で監視中の種別に一致する `mark`/`measure` を同期通知する)。
1059        (
1060            "let got; new PerformanceObserver((list) => { got = list.getEntries()[0].name; }) \
1061             .observe({entryTypes:['mark']}); performance.mark('obs1'); got",
1062            "obs1",
1063        ),
1064        (
1065            "let n = 0; new PerformanceObserver((list) => { n += list.getEntries().length; }) \
1066             .observe({entryTypes:['measure']}); performance.mark('s2'); \
1067             performance.mark('e2'); performance.measure('m2','s2','e2'); n",
1068            "1",
1069        ),
1070        (
1071            "let hit = false; let ob = new PerformanceObserver(() => { hit = true; }); \
1072             ob.observe({entryTypes:['mark']}); ob.disconnect(); performance.mark('after-disconnect'); hit",
1073            "false",
1074        ),
1075        // `PerformanceObserver.supportedEntryTypes`(丸ごと未対応だった。
1076        // 2026-07-16 発見・実装)。
1077        (
1078            "PerformanceObserver.supportedEntryTypes.join(',')",
1079            "mark,measure",
1080        ),
1081        // `observe({type: '...', buffered: true})`(単一種別+既存エントリ
1082        // 即時配信の新形式)が丸ごと未対応だった(`entryTypes`しか読んで
1083        // おらず`type`単体では一切発火しない黙殺バグだった。2026-07-17
1084        // 発見・実装)。
1085        (
1086            "let got; new PerformanceObserver((list) => { got = list.getEntries()[0].name; }) \
1087             .observe({type:'mark'}); performance.mark('obs2'); got",
1088            "obs2",
1089        ),
1090        (
1091            "performance.mark('pre-existing'); let got=null; \
1092             new PerformanceObserver((list) => { got = list.getEntries()[0].name; }) \
1093             .observe({type:'mark', buffered:true}); got",
1094            "pre-existing",
1095        ),
1096        (
1097            "let n=0; new PerformanceObserver((list) => { n += list.getEntries().length; }) \
1098             .observe({type:'mark'}); n",
1099            "0",
1100        ),
1101        // MessageChannel/MessagePort(丸ごと未対応だった。`.port1`/`.port2` 間の
1102        // 双方向メッセージング)。
1103        (
1104            "let mc = new MessageChannel(); let got; \
1105             mc.port2.onmessage = e => { got = e.data; }; \
1106             mc.port1.postMessage('hi'); got",
1107            "hi",
1108        ),
1109        (
1110            "let mc2 = new MessageChannel(); let n = 0; \
1111             mc2.port2.addEventListener('message', e => { n += e.data; }); \
1112             mc2.port1.postMessage(1); mc2.port1.postMessage(2); n",
1113            "3",
1114        ),
1115        (
1116            "let mc3 = new MessageChannel(); let hit = false; \
1117             mc3.port2.onmessage = () => { hit = true; }; \
1118             mc3.port2.close(); mc3.port1.postMessage('x'); hit",
1119            "false",
1120        ),
1121        // BroadcastChannel(丸ごと未対応だった。同名インスタンス全体への配送、
1122        // 自分自身への配送除外、他名チャネルへの非配送を確認)。
1123        (
1124            "let a1 = new BroadcastChannel('ch'); let b1 = new BroadcastChannel('ch'); \
1125             let got; b1.onmessage = e => { got = e.data; }; \
1126             a1.postMessage('hi'); got",
1127            "hi",
1128        ),
1129        (
1130            "let a2 = new BroadcastChannel('ch2'); let selfHit = false; \
1131             a2.onmessage = () => { selfHit = true; }; \
1132             a2.postMessage('x'); selfHit",
1133            "false",
1134        ),
1135        (
1136            "let a3 = new BroadcastChannel('chX'); let b3 = new BroadcastChannel('chY'); \
1137             let hit = false; b3.onmessage = () => { hit = true; }; \
1138             a3.postMessage('x'); hit",
1139            "false",
1140        ),
1141        // `window.screen`(丸ごと未対応だった。`screen.width`/`.height`/
1142        // `.availWidth`/`.availHeight`/`.colorDepth`/`.orientation.type` という
1143        // レスポンシブ分岐の定番パターン)。
1144        ("typeof screen.width", "number"),
1145        ("screen.width === window.innerWidth", "true"),
1146        ("screen.availHeight === screen.height", "true"),
1147        ("screen.colorDepth", "24"),
1148        ("screen.orientation.type", "landscape-primary"),
1149        ("window.screen === screen", "true"),
1150        // `screen.orientation.lock()`/`.unlock()`(丸ごと未対応だった。実際に
1151        // 画面の向きを固定する機構は無いため状態のみ追跡する簡略実装)。
1152        (
1153            "typeof screen.orientation.lock('portrait-primary').then",
1154            "function",
1155        ),
1156        (
1157            "screen.orientation.lock('portrait-primary'); screen.orientation.type",
1158            "portrait-primary",
1159        ),
1160        (
1161            "screen.orientation.lock('portrait-primary'); screen.orientation.unlock(); \
1162             screen.orientation.type",
1163            "landscape-primary",
1164        ),
1165        // `reportError()`(丸ごと未対応だった。`window.onerror`/
1166        // `window.addEventListener('error', fn)` へ未捕捉例外と同じ経路で
1167        // 通知する標準グローバル関数)。
1168        (
1169            "let got; window.onerror = (msg) => { got = msg; }; \
1170             reportError(new Error('boom')); got",
1171            "boom",
1172        ),
1173        (
1174            "let ev; window.addEventListener('error', e => { ev = e; }); \
1175             reportError(new Error('e2')); ev.error.message",
1176            "e2",
1177        ),
1178        ("typeof reportError('plain string')", "undefined"),
1179        // `window.confirm`/`window.prompt`(丸ごと未対応だった。`alert`は
1180        // 既に`console_log`で代替されていたのに、対になるこの2つだけ
1181        // グローバルにも`window`にも未登録で`TypeError`になっていた。
1182        // ブロッキングUIが無いこの処理系では常に「OK」相当を返す簡略実装。
1183        // 2026-07-16 発見・実装)。
1184        ("confirm('are you sure?')", "true"),
1185        ("window.confirm('are you sure?')", "true"),
1186        ("prompt('name?', 'bob')", "bob"),
1187        ("window.prompt('name?')", "null"),
1188        // `window.open`/`.close`/`.focus`/`.blur`(丸ごと未対応だった。同じ
1189        // 監査で発見。呼び出すと`TypeError`になっていた。この処理系には
1190        // 複数ウィンドウ機構が無いため`open`はポップアップブロック相当の
1191        // `null`、他は無害なno-op。2026-07-16 発見・実装)。
1192        ("typeof open", "function"),
1193        ("open('https://example.com')", "null"),
1194        ("window.open('https://example.com', '_blank')", "null"),
1195        ("typeof close", "function"),
1196        ("close(); window.close(); 'ok'", "ok"),
1197        // `window.stop()`(丸ごと未対応だった。ページ読み込み中止ボタン
1198        // 相当の定番API。2026-07-17 発見・実装。`close`/`.print`と同じ
1199        // 無害なno-op)。
1200        ("typeof stop", "function"),
1201        ("stop(); window.stop(); 'ok'", "ok"),
1202        ("typeof focus", "function"),
1203        ("focus(); window.focus(); blur(); window.blur(); 'ok'", "ok"),
1204        // `window.getSelection()`(丸ごと未対応だった。`document.
1205        // getSelection()`は既に実装済みだったが、仕様上こちらが本来の
1206        // 正規の場所で、より一般的に使われる`window.getSelection().
1207        // toString()`等のイディオムが`TypeError`になっていた。
1208        // 2026-07-16 発見・実装。同じ実装を再利用するため戻り値も
1209        // `document.getSelection()`と同一の空文字列)。
1210        ("typeof window.getSelection", "function"),
1211        ("typeof getSelection", "function"),
1212        ("window.getSelection().toString()", ""),
1213        // `self`/`top`/`parent`/`frames`(丸ごと未対応だった。`globalThis`
1214        // は既に実装済みだったのに、同じ「windowを指す別名」仲間のこの4つ
1215        // だけ登録が漏れていた。この処理系には独立JSレルムを持つiframeが
1216        // 無く常に単一フレームのため、仕様どおり自分自身を指す。
1217        // 2026-07-16 発見・実装)。
1218        // アクセサの定義は記述子に無い側を残す(Closure の ES5 変換が getter と setter を分けて定義する)。
1219        ("var o={}; Object.defineProperty(o,'x',{configurable:true,get:function(){return 7}}); Object.defineProperty(o,'x',{configurable:true,set:function(v){}}); o.x", "7"),
1220        ("var o={},g=0; Object.defineProperty(o,'x',{configurable:true,set:function(v){g=v}}); Object.defineProperty(o,'x',{configurable:true,get:function(){return 1}}); o.x=5; g", "5"),
1221        ("var o={}; Object.defineProperty(o,'x',{configurable:true,get:function(){return 7}}); Object.defineProperty(o,'x',{configurable:true,get:undefined}); o.x", "undefined"),
1222        ("var e=document.createElement('div'); Object.defineProperty(e,'q',{configurable:true,get:function(){return 7}}); Object.defineProperty(e,'q',{configurable:true,set:function(v){}}); e.q", "7"),
1223        // タグごとの DOM クラス(ShadyDOM は `HTMLSlotElement.prototype` にメソッドを足す)。
1224        ("document.createElement('slot') instanceof HTMLSlotElement", "true"),
1225        ("HTMLSlotElement.prototype.__t=function(){return 3}; document.createElement('slot').__t()", "3"),
1226        ("document.createElement('ol') instanceof HTMLOListElement", "true"),
1227        ("document.createElement('ul') instanceof HTMLOListElement", "false"),
1228        ("document.createElement('label') instanceof HTMLLabelElement", "true"),
1229        // `Response.clone()` は本文のバイト列とヘッダも写す。
1230        ("new Response('x',{status:201,headers:{a:'b'}}).clone().headers.get('a')", "b"),
1231        ("new Response('x',{status:201}).clone().status", "201"),
1232        // JSON.parse: 深いネスト・\\u エスケープ・キーの順序・値の後の余り(YouTube の `next` の応答)。
1233        ("var s='['.repeat(100)+'7'+']'.repeat(100); var v=JSON.parse(s); for(var i=0;i<100;i++)v=v[0]; v", "7"),
1234        ("JSON.parse('\"a\\\\u0026b\"')", "a&b"),
1235        ("JSON.parse('\"\\\\ud83d\\\\ude00\"') === '😀'", "true"),
1236        ("Object.keys(JSON.parse('{\"b\":1,\"a\":2}')).join()", "b,a"),
1237        ("try{JSON.parse('[1] x');'no'}catch(e){'threw'}", "threw"),
1238        ("self === window", "true"),
1239        ("window.top === window", "true"),
1240        ("parent === window", "true"),
1241        ("window.frames === window", "true"),
1242        ("typeof window.name", "string"),
1243        // `iframe.contentWindow`/`.contentDocument`(丸ごと未対応だった。
1244        // 2026-07-17 発見・実装)。`contentWindow` は 2026-10-29 から子フレーム
1245        // 専用の WindowProxy で、親の `window` とは別物(`contentDocument` は
1246        // 今も自分自身の `document` を指す簡略実装)。
1247        (
1248            "document.createElement('iframe').contentWindow === window",
1249            "false",
1250        ),
1251        (
1252            "document.createElement('iframe').contentDocument === document",
1253            "true",
1254        ),
1255        (
1256            "document.createElement('div').contentWindow",
1257            "undefined",
1258        ),
1259        // `object.contentDocument`(丸ごと未対応だった。`HTMLObjectElement`
1260        // は`contentWindow`を持たず`contentDocument`のみが仕様上の対象。
1261        // 2026-07-17 発見・実装)。
1262        (
1263            "document.createElement('object').contentDocument === document",
1264            "true",
1265        ),
1266        (
1267            "document.createElement('object').contentWindow",
1268            "undefined",
1269        ),
1270        // `navigator.sendBeacon(url, data)`(丸ごと未対応だった。ページ離脱時の
1271        // 計測データ送信に使われる定番パターン。既存の `fetch()` POST経路を
1272        // 再利用して送信し常に `true` を返す)。
1273        ("typeof navigator.sendBeacon", "function"),
1274        ("navigator.sendBeacon('data:,x')", "true"),
1275        ("navigator.sendBeacon('data:,x', 'payload')", "true"),
1276        // `XMLSerializer`(丸ごと未対応だった。`.serializeToString(node)` は
1277        // 既存の `outerHTML` ゲッターと同じ `get_outer_html` を再利用する)。
1278        (
1279            "var e=document.createElement('div'); e.setAttribute('id','x'); \
1280             e.setAttribute('class','a b'); e.innerHTML='hi2'; \
1281             new XMLSerializer().serializeToString(e) === e.outerHTML",
1282            "true",
1283        ),
1284        (
1285            "var e=document.createElement('span'); e.textContent='z'; \
1286             new XMLSerializer().serializeToString(e) === e.outerHTML",
1287            "true",
1288        ),
1289        ("typeof new XMLSerializer().serializeToString", "function"),
1290        // `navigator.clipboard`(丸ごと未対応だった。`writeText`/`readText` という
1291        // コピー&ペースト UI の定番パターン)。実クリップボードは無いため単純な
1292        // プロセス内文字列保持で近似する。
1293        (
1294            "await navigator.clipboard.writeText('hello'); await navigator.clipboard.readText()",
1295            "hello",
1296        ),
1297        ("typeof navigator.clipboard.writeText('x')", "object"),
1298        // Array: at / flatMap / findLast / findLastIndex
1299        ("[10,20,30].at(-1)", "30"),
1300        ("[10,20,30].at(0)", "10"),
1301        ("[1,2,3].flatMap(x => [x, x*10]).join(',')", "1,10,2,20,3,30"),
1302        ("[1,2,3,4].findLast(x => x % 2 === 1)", "3"),
1303        ("[1,2,3,4].findLastIndex(x => x % 2 === 0)", "3"),
1304        // String: at
1305        ("'hello'.at(-1)", "o"),
1306        ("'hello'.at(1)", "e"),
1307        // 通常の呼び出しは影響を受けないことも確認。
1308        ("'hello world'.includes('world')", "true"),
1309        ("'hello'.startsWith('he')", "true"),
1310        ("'hello'.endsWith('lo')", "true"),
1311        // **重要**: `includes`/`startsWith`/`endsWith` は仕様上、第1引数に
1312        // `RegExp` を渡すと `TypeError` を投げる必要がある(うっかり正規表現を
1313        // 渡した誤用に対する意図的なガード)が、丸ごと未対応で常に無言で
1314        // リテラル文字列 `"/x/"` として検索してしまっていた。
1315        (
1316            "try { 'x'.includes(/x/); 'no-throw' } catch(e) { 'threw' }",
1317            "threw",
1318        ),
1319        (
1320            "try { 'x'.startsWith(/x/); 'no-throw' } catch(e) { 'threw' }",
1321            "threw",
1322        ),
1323        (
1324            "try { 'x'.endsWith(/x/); 'no-throw' } catch(e) { 'threw' }",
1325            "threw",
1326        ),
1327        // Promise: allSettled / race / any
1328        ("(await Promise.allSettled([Promise.resolve(1), Promise.reject('e')])).map(r => r.status).join(',')", "fulfilled,rejected"),
1329        ("await Promise.race([Promise.resolve('first'), Promise.resolve('second')])", "first"),
1330        ("await Promise.any([Promise.reject('x'), Promise.resolve('ok')])", "ok"),
1331        // `allSettled`/`race`/`any` も `Promise.all` と同じく配列要素の汎用 thenable を
1332        // 同化しない非対称なバグだった(共通ヘルパ `resolve_maybe_thenable` で解消)。
1333        (
1334            "(await Promise.allSettled([{ then(r){ r(1); } }, { then(_,rj){ rj('e'); } }])).map(r => r.status).join(',')",
1335            "fulfilled,rejected",
1336        ),
1337        (
1338            "await Promise.race([{ then(r){ r('first'); } }, Promise.resolve('second')])",
1339            "first",
1340        ),
1341        (
1342            "await Promise.any([{ then(_,rj){ rj('x'); } }, { then(r){ r('ok'); } }])",
1343            "ok",
1344        ),
1345        // TextEncoder / TextDecoder
1346        ("new TextEncoder().encode('Hi').join(',')", "72,105"),
1347        ("new TextDecoder().decode([72,105])", "Hi"),
1348        ("new TextDecoder().decode(new TextEncoder().encode('AtmOS'))", "AtmOS"),
1349        // `new TextDecoder(label)` が丸ごとラベル引数を無視し常に `utf-8` 決め打ち
1350        // だったバグ(`utf-16le`/`utf-16be` データを渡すと静かに文字化けしていた)。
1351        ("new TextDecoder('utf-16le').encoding", "utf-16le"),
1352        ("new TextDecoder('utf-16be').encoding", "utf-16be"),
1353        // 'H'=0x48 'i'=0x69 を UTF-16LE(下位バイト→上位バイト)で並べたバイト列。
1354        ("new TextDecoder('utf-16le').decode([0x48,0x00,0x69,0x00])", "Hi"),
1355        ("new TextDecoder('utf-16be').decode([0x00,0x48,0x00,0x69])", "Hi"),
1356        ("new TextDecoder('utf-16').encoding", "utf-16le"),
1357        // `decode(chunk, {stream: true})`(丸ごと未対応だった。チャンク境界で
1358        // マルチバイト文字が分断された場合の定番パターン。2026-07-14 発見・
1359        // 実装)。'€'(U+20AC)の UTF-8 表現 [0xE2,0x82,0xAC] を先頭2バイトと
1360        // 残り1バイトに分割して渡す。
1361        (
1362            "var d=new TextDecoder(); d.decode(new Uint8Array([0xE2,0x82]), {stream:true}) + \
1363             d.decode(new Uint8Array([0xAC]))",
1364            "€",
1365        ),
1366        // stream:true 無し(既定 false)で不完全なバイト列を渡すと、従来どおり
1367        // 即座に置換文字化される(持ち越されない)。
1368        ("new TextDecoder().decode(new Uint8Array([0xE2,0x82]))", "\u{FFFD}"),
1369        // crypto
1370        ("crypto.randomUUID().length", "36"),
1371        ("crypto.randomUUID().charAt(14)", "4"),
1372        ("crypto.getRandomValues([0,0,0]).length", "3"),
1373        // `crypto.getRandomValues` が種別を無視して常に `& 0xff`(0-255)で埋めており、
1374        // 8bit より広い型(`Uint16Array` 等)では値域のごく一部しか使わないバグだった。
1375        // 十分な試行数の中に 255 を超える値が1つでも現れれば、下位8bitマスクではなく
1376        // 実際に16bit幅を使っている証拠になる。
1377        (
1378            "crypto.getRandomValues(new Uint16Array(200)).some(v => v > 255)",
1379            "true",
1380        ),
1381        // `Uint8Array` は元々の挙動(0-255 の範囲内)を維持する。
1382        (
1383            "crypto.getRandomValues(new Uint8Array(50)).every(v => v >= 0 && v <= 255)",
1384            "true",
1385        ),
1386        // 【2026-11-12】`Uint8Array` が 0x00 か 0xFF しか入らなかった(64 bit の乱数を f64 経由で 8 bit に落としていた)。
1387        // 256 個の中に 0 でも 255 でもない値があり、値の種類が十分多いこと。
1388        (
1389            "crypto.getRandomValues(new Uint8Array(256)).some(v => v != 0 && v != 255)",
1390            "true",
1391        ),
1392        (
1393            "new Set(crypto.getRandomValues(new Uint8Array(256))).size > 100",
1394            "true",
1395        ),
1396        // 32 bit の配列は下位のビットも埋まる(以前は下位 11 bit が常に 0 か全部 1)。
1397        (
1398            "crypto.getRandomValues(new Uint32Array(64)).some(v => (v & 0x7ff) != 0 && (v & 0x7ff) != 0x7ff)",
1399            "true",
1400        ),
1401        ("crypto.getRandomValues(new Int8Array(64)).some(v => v < 0 && v != -1)", "true"),
1402        // 部分配列(byteOffset 付き)は自分の範囲だけ埋める。
1403        (
1404            "var b=new Uint8Array(8); crypto.getRandomValues(b.subarray(2,4)); b[0]+b[1]+b[4]+b[5]+b[6]+b[7]",
1405            "0",
1406        ),
1407        ("crypto.randomUUID() != crypto.randomUUID()", "true"),
1408        ("var r=Math.random(); r >= 0 && r < 1 && r != Math.random()", "true"),
1409        // 整数の配列へ 2^63 以上の数を書くと 2^n で割った余りになる(以前は i64 の上限に張り付いて全ビット 1)。
1410        ("new Uint8Array([Math.pow(2,63)])[0]", "0"),
1411        ("new Uint16Array([Math.pow(2,63)+4096])[0]", "4096"),
1412        ("new Int32Array([Math.pow(2,63)+2048])[0]", "2048"),
1413        ("new Uint32Array([Math.pow(2,32)+5])[0]", "5"),
1414        ("new Uint8Array([-Math.pow(2,70)])[0]", "0"),
1415        ("new Uint8Array([-1])[0]", "255"),
1416        ("new Uint8Array([Infinity, NaN, 257.9, -0.5])+''", "0,0,1,0"),
1417        ("var u=new Uint8Array(1); u[0]=Math.pow(2,64)+300; u[0]", "0"),
1418        ("var u=new Uint8Array(1); u.fill(1e19); u[0]", "0"),
1419        // ---- 2026-11-16: Chrome(V8)との差分試験の続き(例外・分割代入・穴・型付き配列・組み込みの反映)----
1420        // 期待値は Node v22(V8)で確かめた値(tmp/js_agent/st.mjs)。
1421        (r#"var a=1,b=2;[a,b]=[b,a];a+','+b"#, r#"2,1"#),
1422        (r#"var a,b;({a,b}={a:1,b:2});a+b"#, r#"3"#),
1423        (r#"var x,y,z;[x,[y],{q:z=5}]=[1,[2],{}];x+','+y+','+z"#, r#"1,2,5"#),
1424        (r#"var p,r;({p=3,...r}={q:1,s:2});p+','+Object.keys(r).join()"#, r#"3,q,s"#),
1425        (r#"var o={};[o.a,o['b']]=[1,2];o.a+o.b"#, r#"3"#),
1426        (r#"var h,t;[h,...t]='abc';h+'|'+t.join()"#, r#"a|b,c"#),
1427        (r#"function*g(){yield 1;yield 2}var [m,n]=g();m+','+n"#, r#"1,2"#),
1428        (r#"var r;try{undefined.foo=1}catch(e){r=e.name}r"#, r#"TypeError"#),
1429        (r#"var r;try{var u;u[0]=1}catch(e){r=e.name}r"#, r#"TypeError"#),
1430        (r#"var r;try{const c=1;c=2}catch(e){r=e.name+':'+e.message}r"#, r#"TypeError:Assignment to constant variable."#),
1431        (r#"const k=1;function f(k){k=2;return k}f(0)"#, r#"2"#),
1432        (r#"var r;try{class A{};A()}catch(e){r=e.name}r"#, r#"TypeError"#),
1433        (r#"class B{constructor(){this.v=1}};new B().v"#, r#"1"#),
1434        (r#"var r;try{'a' in 'b'}catch(e){r=e.name}r"#, r#"TypeError"#),
1435        (r#"var r;try{[...1]}catch(e){r=e.name}r"#, r#"TypeError"#),
1436        (r#"var r;try{Math.max(...null)}catch(e){r=e.name}r"#, r#"TypeError"#),
1437        (r#"var r;try{decodeURIComponent('%')}catch(e){r=e.name}r+','+decodeURI('%41%2f')"#, r#"URIError,A%2f"#),
1438        (r#"var r;try{new RegExp('(')}catch(e){r=e.name}r"#, r#"SyntaxError"#),
1439        (r#"var r;try{new RegExp('a','gg')}catch(e){r=e.name}r"#, r#"SyntaxError"#),
1440        (r#"var r;try{Object.defineProperty(Object.freeze({}),'a',{value:1})}catch(e){r=e.name}r"#, r#"TypeError"#),
1441        (r#"var r;try{Object.setPrototypeOf(Object.preventExtensions({}),{})}catch(e){r=e.name}r"#, r#"TypeError"#),
1442        (r#"var r;try{Reflect.ownKeys(1)}catch(e){r=e.name}r"#, r#"TypeError"#),
1443        (r#"Reflect.ownKeys({a:1,[Symbol.iterator]:0}).length"#, r#"2"#),
1444        (r#"var r;try{new Date(NaN).toISOString()}catch(e){r=e.name}r+','+JSON.stringify(new Date(NaN))"#, r#"RangeError,null"#),
1445        (r#"var r=[];['01','1.','"\\x"'].forEach(function(s){try{JSON.parse(s);r.push('ok')}catch(e){r.push(e.name)}});r.join()"#, r#"SyntaxError,SyntaxError,SyntaxError"#),
1446        (r#"JSON.parse('[0,-1.5e3,"a\\u0041"]').join()"#, r#"0,-1500,aA"#),
1447        (r#"var r;try{new Uint16Array(new ArrayBuffer(3))}catch(e){r=e.name}r"#, r#"RangeError"#),
1448        (r#"new Uint8Array({length:2,0:5,1:6}).join()+'|'+new Uint8Array('3').length+'|'+Uint8Array.of(1,2,300).join()"#, r#"5,6|3|1,2,44"#),
1449        (r#"Object.keys(new Uint8Array(2)).join()+'|'+JSON.stringify(new Int8Array([1,-1]))+'|'+Object.prototype.toString.call(new Int16Array(1))"#, r#"0,1|{"0":1,"1":-1}|[object Int16Array]"#),
1450        (r#"Array.from(new Uint8ClampedArray([Infinity,-Infinity,NaN,300])).join()"#, r#"255,0,0,255"#),
1451        (r#"var d=new DataView(new ArrayBuffer(2));d.setUint8(0,1e300);d.setUint8(1,257);new Uint8Array(d.buffer).join()"#, r#"0,1"#),
1452        (r#"var a=[,1,,2].slice();a.sort();(0 in a)+','+(2 in a)+','+(3 in a)+','+a.length"#, r#"true,false,false,4"#),
1453        (r#"var a=[,1,,2];a.reverse();(0 in a)+','+(1 in a)+','+(3 in a)"#, r#"true,false,false"#),
1454        (r#"[,1,,2].flat().join()+'|'+[,1,,2].flatMap(function(x){return [x,x]}).join()"#, r#"1,2|1,1,2,2"#),
1455        (r#"var a=[,1,,2];a.splice(1,1,'x');(0 in a)+','+(2 in a)+','+a.length"#, r#"false,false,4"#),
1456        (r#"var a=[,1,,2];a.pop();a.shift();a.unshift(7,8);a.push(9);(3 in a)+','+a.length"#, r#"false,5"#),
1457        (r#"[1,2,3].splice().length"#, r#"0"#),
1458        (r#"[].push===Array.prototype.push&&[].toString===Array.prototype.toString&&''.trim===String.prototype.trim&&(1).toFixed===Number.prototype.toFixed"#, r#"true"#),
1459        (r#"Object.keys(Math).length+','+Object.keys(Object.prototype).length+','+Object.keys(Array.prototype).length"#, r#"0,0,0"#),
1460        (r#"Math.max.name+','+Math.max.length+','+[].push.length+','+JSON.stringify.length+','+parseInt.length"#, r#"max,2,1,3,2"#),
1461        (r#"Function.prototype.toString.call(Math.max)"#, r#"function max() { [native code] }"#),
1462        (r#"function F(){this.a=1}F.prototype.b=2;var k=[];for(var i in new F)k.push(i);k.join()+'|'+Object.keys(F).join()"#, r#"a,b|"#),
1463        (r#"(function(){return Object.prototype.toString.call(arguments)})()+','+Object.prototype.toString.call(Math)"#, r#"[object Arguments],[object Math]"#),
1464        (r#"({}).__proto__===Object.prototype"#, r#"true"#),
1465        (r#"var o={valueOf:function(){return 5}};(o==5)+','+(o!=5)"#, r#"true,false"#),
1466        (r#"[].propertyIsEnumerable('length')+','+[1].propertyIsEnumerable(0)"#, r#"false,true"#),
1467        (r#"typeof Promise.prototype.then+','+typeof Map.prototype.set+','+typeof Date.prototype.getTime+','+typeof Number.prototype.toFixed"#, r#"function,function,function,function"#),
1468        (r#"var d=Object.getOwnPropertyDescriptor(function f(a,b){},'length');d.value+','+d.writable+','+d.enumerable"#, r#"2,false,false"#),
1469        (r#"Object.getOwnPropertyDescriptor('abc','length').value+','+Object.getOwnPropertyDescriptor(Math,'PI').writable"#, r#"3,false"#),
1470        (r#"var r;try{Symbol.keyFor('x')}catch(e){r=e.name}r"#, r#"TypeError"#),
1471        (r#"var r;try{new Proxy({},null)}catch(e){r=e.name}r"#, r#"TypeError"#),
1472        (r#"var r;try{'a'.matchAll(/a/)}catch(e){r=e.name}r"#, r#"TypeError"#),
1473        (r#"var r;try{Array.prototype.at.call(null)}catch(e){r=e.name}r"#, r#"TypeError"#),
1474        // ---- 2026-11-13: Chrome(V8)との差分試験で見つけた食い違い ----
1475        // Error.prototype.toString が無く、文字列にすると "[object Object]" だった。
1476        ("String(new Error('m'))", "Error: m"),
1477        ("'' + new TypeError('t')", "TypeError: t"),
1478        ("String(new Error())", "Error"),
1479        ("Error.prototype.toString.call({name:'N',message:'M'})", "N: M"),
1480        ("Error.prototype.toString.call({name:'',message:'M'})", "M"),
1481        ("(()=>{try{null.x}catch(e){return String(e).slice(0,10)}})()", "TypeError:"),
1482        ("(()=>{class E2 extends Error{constructor(m){super(m);this.name='E2'}} return String(new E2('m'))})()", "E2: m"),
1483        ("Object.prototype.toString.call(new RangeError('x'))", "[object Error]"),
1484        // 例外のプロパティは列挙しない。
1485        ("Object.keys(new Error('x')).length", "0"),
1486        ("JSON.stringify(new Error('x'))", "{}"),
1487        ("(()=>{var k=[];for(var i in new Error('x'))k.push(i);return k.length})()", "0"),
1488        ("new Error('x').message + new Error('x', {cause: 7}).cause", "x7"),
1489        // 例外の種類。
1490        ("(()=>{try{JSON.parse('{a:1}')}catch(e){return e.name}})()", "SyntaxError"),
1491        ("(()=>{try{'a'.repeat(-1)}catch(e){return e.name}})()", "RangeError"),
1492        ("(()=>{try{[].reduce((a,b)=>a)}catch(e){return e.name}})()", "TypeError"),
1493        ("(()=>{try{new Array(-1)}catch(e){return e.name}})()", "RangeError"),
1494        ("(()=>{try{(1).toFixed(101)}catch(e){return e.name}})()", "RangeError"),
1495        ("(()=>{try{new DataView(new ArrayBuffer(1)).getInt16(0)}catch(e){return e.name}})()", "RangeError"),
1496        // 配列の添字以外のプロパティ・穴・伸長。
1497        ("Object.keys('abc'.match(/b/)).join()", "0,index,input,groups"),
1498        ("Object.entries([7,8]).join('|')", "0,7|1,8"),
1499        ("Object.keys((s=>s)`a${1}b`).join()", "0,1"),
1500        ("0 in [,1]", "false"),
1501        ("Object.keys([,1,,2]).join()", "1,3"),
1502        ("(()=>{var a=[1,2,3];a.length=5;return [a.indexOf(undefined),3 in a,a.length].join()})()", "-1,false,5"),
1503        ("(()=>{var a=[];a[3]=undefined;return [3 in a,2 in a].join()})()", "true,false"),
1504        ("(()=>{var a=[];a[4294967294]=1;return a.length < 100})()", "true"),
1505        ("(([a,,b])=>a+b)([1,2,3])", "4"),
1506        // 比較・べき乗・丸め。
1507        ("[] <= 'abc'", "true"),
1508        ("'12' <= ({})", "true"),
1509        ("[5] < [10]", "false"),
1510        ("({valueOf(){return 3}}) * 2", "6"),
1511        ("1 ** NaN", "NaN"),
1512        ("(-1) ** Infinity", "NaN"),
1513        ("Math.pow(1, Infinity)", "NaN"),
1514        ("Object.is(Math.round(-0.2), -0)", "true"),
1515        ("Math.round(0.49999999999999994)", "0"),
1516        ("Math.round(2.5) + Math.round(-2.5)", "1"),
1517        ("Object.is(Math.max(-0, 0), 0) && Object.is(Math.min(0, -0), -0)", "true"),
1518        // 数値と文字列の変換。
1519        ("String(1e21)", "1e+21"),
1520        ("String(1e-7)", "1e-7"),
1521        ("String(123456789012345680000)", "123456789012345680000"),
1522        ("(1.45).toFixed(1)", "1.4"),
1523        ("(123.456).toFixed(20)", "123.45600000000000306954"),
1524        ("(1e21).toFixed(2)", "1e+21"),
1525        ("(0).toExponential()", "0e+0"),
1526        ("(1/3).toExponential()", "3.333333333333333e-1"),
1527        ("(2.5).toPrecision(21)", "2.50000000000000000000"),
1528        ("(0.1+0.2).toString(2)", "0.0100110011001100110011001100110011001100110011001101"),
1529        ("(255).toString(36)", "73"),
1530        ("parseInt('12px', 1)", "NaN"),
1531        ("parseInt('99999999999999999999')", "100000000000000000000"),
1532        ("parseInt(1e21)", "1"),
1533        ("parseFloat('-1.5e')", "-1.5"),
1534        ("parseFloat('Infinityx')", "Infinity"),
1535        ("parseFloat('.5.')", "0.5"),
1536        // 文字列・正規表現。
1537        ("'abc'.replace('b', \"[$&$`$'$$]\")", "a[bac$]c"),
1538        ("'tab'.split(/,?/).join('|')", "t|a|b"),
1539        ("''.split(/,?/).length", "0"),
1540        ("'a1b2'.split(/(\\d)/).join('|')", "a|1|b|2|"),
1541        ("'abc'.charAt(-1)", ""),
1542        ("'aBc'.toLocaleUpperCase() + 'aBc'.toLocaleLowerCase()", "ABCabc"),
1543        ("/(a*)*b/.test('aaac')", "false"),
1544        ("/(?<n>a)\\k<n>/.test('aa')", "true"),
1545        ("/((a)|(b))+/.exec('ab')[2]", "undefined"),
1546        ("'Hello'.replace(/[\\ud800-\\udfff]/g, '')", "Hello"),
1547        ("/\\u00e9/i.test('\\u00c9')", "true"),
1548        ("/\\cJ/.test('\\n')", "true"),
1549        ("JSON.stringify('\\u0000\\b\\u001f')", "\"\\u0000\\b\\u001f\""),
1550        ("typeof Symbol.iterator + typeof Symbol('x')", "symbolsymbol"),
1551        ("(()=>{class A{get x(){return 1}} return Object.keys(A.prototype).length})()", "0"),
1552        // structuredClone(深いコピー: 元を変えても複製は不変)
1553        ("var o={a:{b:1}}; var c=structuredClone(o); o.a.b=9; c.a.b", "1"),
1554        ("structuredClone([1,[2,3]])[1][0]", "2"),
1555        // structuredClone(Error) — 汎用の plain object 複製に落ちると proto が
1556        // 引き継がれず `instanceof Error` を失っていたバグ(2026-07-14 発見・修正。
1557        // message/name/stack は元々コピーされていたが、プロトタイプ連鎖が
1558        // 途切れていた)。サブタイプ(TypeError 等)も正しいプロトタイプで
1559        // 複製されることを確認。
1560        (
1561            "var c=structuredClone(new TypeError('x')); c instanceof Error && c instanceof TypeError",
1562            "true",
1563        ),
1564        ("structuredClone(new Error('boom')).message", "boom"),
1565        ("structuredClone(new TypeError('x')).stack", "TypeError: x"),
1566        // `structuredClone(function)`が仕様上の`DataCloneError`を投げず、
1567        // 汎用plain object複製に落ちて「呼出不能な壊れたオブジェクト」に
1568        // 静かに化けていたバグ(`deep_clone_value`を`Result`化して修正。
1569        // 2026-07-17 発見・実装)。
1570        (
1571            "try { structuredClone(function(){}); 'no-throw' } catch(e) { e.name }",
1572            "DataCloneError",
1573        ),
1574        (
1575            "try { structuredClone({fn: () => 1}); 'no-throw' } catch(e) { e.name }",
1576            "DataCloneError",
1577        ),
1578        ("structuredClone({a: 1, b: [2, 3]}).a", "1"),
1579        // 上記`DataCloneError`修正の副次効果として、`URLSearchParams`/
1580        // `FormData`/`Headers`(メソッド群が`.props`上の生の関数値として
1581        // 実装されている「疑似クラス」オブジェクト)を`structuredClone`
1582        // すると、以前は関数プロパティごと汎用複製されて壊れたオブジェクト
1583        // (メソッド呼び出し不能)に静かに化けていたのが、今回の修正で
1584        // 正しく`DataCloneError`を投げるようになったことを確認・記録する
1585        // (2026-07-17)。
1586        (
1587            "try { structuredClone(new URLSearchParams('a=1')); 'no-throw' } catch(e) { e.name }",
1588            "DataCloneError",
1589        ),
1590        (
1591            "try { structuredClone(new FormData()); 'no-throw' } catch(e) { e.name }",
1592            "DataCloneError",
1593        ),
1594        (
1595            "try { structuredClone(new Headers()); 'no-throw' } catch(e) { e.name }",
1596            "DataCloneError",
1597        ),
1598        // `structuredClone(Promise)`も仕様上構造化複製不可(`DataCloneError`)
1599        // だが未対応で、`.then`/`.catch`が消えた呼出不能な壊れたオブジェクト
1600        // に静かに化けていた(丸ごと未対応だった。2026-07-17 発見・実装)。
1601        (
1602            "try { structuredClone(Promise.resolve(1)); 'no-throw' } catch(e) { e.name }",
1603            "DataCloneError",
1604        ),
1605        // `WeakMap`/`WeakSet`も`URLSearchParams`/`FormData`/`Headers`と同じ
1606        // 「メソッド群が`.props`上の生の関数値」パターンの疑似クラスで、
1607        // 仕様上も構造化複製不可(`DataCloneError`)。前サイクルまでの
1608        // `deep_clone_value`関数検出修正の副次効果で既に正しく動作している
1609        // ことを確認・記録する(2026-07-17)。
1610        (
1611            "try { structuredClone(new WeakMap()); 'no-throw' } catch(e) { e.name }",
1612            "DataCloneError",
1613        ),
1614        (
1615            "try { structuredClone(new WeakSet()); 'no-throw' } catch(e) { e.name }",
1616            "DataCloneError",
1617        ),
1618        // `AbortController`/`AbortSignal`/`MessagePort`/`MessageChannel`も
1619        // 同じ「メソッド群が`.props`上の生の関数値」パターンの疑似クラス
1620        // で、仕様上も構造化複製不可。前サイクルまでの`deep_clone_value`
1621        // 関数検出修正の副次効果で正しく動作していることを確認・記録し、
1622        // `DataCloneError`検証の横断監査を完了する(2026-07-17)。
1623        (
1624            "try { structuredClone(new AbortController()); 'no-throw' } catch(e) { e.name }",
1625            "DataCloneError",
1626        ),
1627        (
1628            "try { structuredClone(new AbortController().signal); 'no-throw' } catch(e) { e.name }",
1629            "DataCloneError",
1630        ),
1631        (
1632            "try { structuredClone(new MessageChannel()); 'no-throw' } catch(e) { e.name }",
1633            "DataCloneError",
1634        ),
1635        (
1636            "try { structuredClone(new MessageChannel().port1); 'no-throw' } catch(e) { e.name }",
1637            "DataCloneError",
1638        ),
1639        // structuredClone(Map/Set) — 中身(エントリ/要素)まで正しく複製され、元を変えても
1640        // 複製に影響しないこと(以前は ObjKind::MapObj/SetObj 自体が複製されず消えていたバグ)。
1641        (
1642            "var m=new Map([['a',1],['b',2]]); var c=structuredClone(m); m.set('a',99); c.get('a')+','+c.get('b')+','+c.size",
1643            "1,2,2",
1644        ),
1645        (
1646            "var s=new Set([1,2,3]); var c=structuredClone(s); s.add(4); c.has(4)+','+c.size",
1647            "false,3",
1648        ),
1649        // structuredClone(TypedArray) — TypedArray も内部表現は ObjKind::Array 流用
1650        // (`_ta_kind` タグで区別)なため、素の配列複製経路に落ちると型情報
1651        // (`_ta_kind`/`BYTES_PER_ELEMENT`/`set`/`slice`/`fill`)が丸ごと失われる
1652        // バグだった(Date/RegExp/Map/Set と同種)。
1653        ("var a=new Int8Array([200,-100]); var c=structuredClone(a); c.join(',')", "-56,-100"),
1654        (
1655            "var a=new Int8Array(1); var c=structuredClone(a); c.BYTES_PER_ELEMENT",
1656            "1",
1657        ),
1658        ("var a=new Int8Array(1); var c=structuredClone(a); c[0]=200; c[0]", "-56"),
1659        (
1660            "var a=new Int8Array([1,2]); var c=structuredClone(a); a[0]=9; c[0]",
1661            "1",
1662        ),
1663        // structuredClone(buf, {transfer:[buf]}) — 第2引数 transfer が丸ごと
1664        // 無視されており、転送指定した ArrayBuffer が detached にならなかった
1665        // バグ。
1666        (
1667            "var b=new ArrayBuffer(4); var c=structuredClone(b,{transfer:[b]}); b.detached+','+c.byteLength",
1668            "true,4",
1669        ),
1670        // structuredClone(Blob/DataView) — どちらも `Obj::plain()` + 隠しプロパティで
1671        // 実バイト列を持つ実装のため、汎用の plain object 複製に落ちると
1672        // `slice`/`text`/`getUint8` 等のネイティブ関数プロパティが呼出不能な壊れた
1673        // オブジェクトに複製されてしまうバグだった(TypedArray と同種)。
1674        (
1675            "var b=new Blob(['hi']); var c=structuredClone(b); await c.text()",
1676            "hi",
1677        ),
1678        ("var b=new Blob(['hi']); var c=structuredClone(b); c.size", "2"),
1679        (
1680            "var dv=new DataView(new ArrayBuffer(1)); dv.setUint8(0,65); var c=structuredClone(dv); c.getUint8(0)",
1681            "65",
1682        ),
1683        // structuredClone(ArrayBuffer) — `slice` がネイティブ関数プロパティのため
1684        // 同種のバグで複製後は呼出不能になっていた。
1685        (
1686            "var buf=new ArrayBuffer(4); var c=structuredClone(buf); c.byteLength",
1687            "4",
1688        ),
1689        (
1690            "var buf=new ArrayBuffer(4); var c=structuredClone(buf); typeof c.slice",
1691            "function",
1692        ),
1693        // structuredClone(Proxy) — 実データが `.props` ではなく `ObjKind::Proxy`
1694        // 側にあるため、汎用の plain object 複製に落ちると常に空の `{}` になる
1695        // バグだった(`Date`/`Map`/`Set` 等と同種)。仕様上は本来複製不可
1696        // (`DataCloneError`)だが、他の Proxy 透過性修正と同じ「target へ
1697        // フォワード」方針で target を複製する簡略実装とした。
1698        (
1699            "var p=new Proxy({a:1,b:2},{}); var c=structuredClone(p); c.a+','+c.b",
1700            "1,2",
1701        ),
1702        (
1703            "var t={a:1}; var p=new Proxy(t,{}); var c=structuredClone(p); t.a=99; c.a",
1704            "1",
1705        ),
1706        (
1707            "var buf = await new Blob(['A']).arrayBuffer(); var c=structuredClone(buf); new DataView(c).getUint8(0)",
1708            "65",
1709        ),
1710        // Object: fromEntries / getOwnPropertyNames / freeze
1711        ("Object.fromEntries([['a',1],['b',2]]).b", "2"),
1712        ("Object.getOwnPropertyNames({x:1,y:2}).join(',')", "x,y"),
1713        // 【2026-11-18】`_` 始まりの名前(Polymer の振る舞いのメソッドなど)も出る(以前は隠れて YouTube のトップが骨組みのままだった)
1714        ("Object.getOwnPropertyNames({a:1,_b:2,__c:3,d:4}).join(',')", "a,_b,__c,d"),
1715        ("var o=Object.freeze({a:1}); o.a", "1"),
1716        // Number 静的
1717        ("Number.isInteger(5)", "true"),
1718        ("Number.isInteger(5.5)", "false"),
1719        ("Number.isInteger('5')", "false"),
1720        ("Number.isSafeInteger(9007199254740991)", "true"),
1721        ("Number.MAX_SAFE_INTEGER", "9007199254740991"),
1722        ("Number.isNaN(NaN) + ',' + Number.isNaN(5)", "true,false"),
1723        // `Number.MIN_VALUE`/`Number.NaN`(ES1 以来の定数)が丸ごと未登録だった。
1724        // `MIN_VALUE` は「0に最も近い正の値」(非正規化数まで含む)であり
1725        // `MIN_SAFE_INTEGER`(大きな負の整数)とは別物であることに注意。
1726        ("Number.MIN_VALUE > 0", "true"),
1727        ("Number.MIN_VALUE < Number.EPSILON", "true"),
1728        ("Number.isNaN(Number.NaN)", "true"),
1729        // Math 追加
1730        ("Math.hypot(3,4)", "5"),
1731        ("Math.log2(8)", "3"),
1732        ("Math.round(Math.log10(1000))", "3"),
1733        ("Math.round(Math.cbrt(27))", "3"),
1734        ("Math.atan2(0,5)", "0"),
1735        // Math 追加2(ES2015。fround/clz32/imul/sinh系/expm1/log1p/定数群が丸ごと未対応だった)。
1736        ("Math.fround(1.5)", "1.5"),
1737        ("Math.fround(1.1) !== 1.1", "true"),
1738        ("Math.f16round(1.5)", "1.5"),
1739        ("Math.f16round(1.337) !== 1.337", "true"),
1740        ("Math.sumPrecise([1, 2, 3])", "6"),
1741        ("Math.sumPrecise([0.1, 0.2])", "0.30000000000000004"),
1742        ("Math.sumPrecise([1, Infinity])", "Infinity"),
1743        ("isNaN(Math.sumPrecise([Infinity, -Infinity]))", "true"),
1744        ("isNaN(Math.sumPrecise([1, NaN]))", "true"),
1745        ("new Headers({'Set-Cookie':'a=1'}).getSetCookie().join(',')", "a=1"),
1746        ("var h=new Headers(); h.append('Set-Cookie','a=1'); h.append('Set-Cookie','b=2'); h.getSetCookie().join('; ')", "a=1; b=2"),
1747        ("Math.clz32(1)", "31"),
1748        ("Math.clz32(0)", "32"),
1749        ("Math.clz32(1000)", "22"),
1750        ("Math.imul(3,4)", "12"),
1751        ("Math.imul(0xffffffff, 5)", "-5"),
1752        ("Math.round(Math.sinh(0))", "0"),
1753        ("Math.cosh(0)", "1"),
1754        ("Math.tanh(0)", "0"),
1755        ("Math.asinh(0)", "0"),
1756        ("Math.acosh(1)", "0"),
1757        ("Math.atanh(0)", "0"),
1758        ("Math.round(Math.expm1(0))", "0"),
1759        ("Math.log1p(0)", "0"),
1760        ("Math.round(Math.LN2*1000)", "693"),
1761        ("Math.round(Math.LN10*1000)", "2303"),
1762        ("Math.round(Math.SQRT2*1000)", "1414"),
1763        ("Math.round(Math.SQRT1_2*1000)", "707"),
1764        // AbortController
1765        ("var c=new AbortController(); var b=c.signal.aborted; c.abort(); b+','+c.signal.aborted", "false,true"),
1766        // `signal.addEventListener('abort', fn)` が丸ごと no-op で、`abort()` を呼んでも
1767        // 登録済みリスナが一切発火しないバグだった。`signal.reason` も未対応だった。
1768        (
1769            "var c=new AbortController(); var fired=false; c.signal.addEventListener('abort', function(){fired=true;}); c.abort(); fired",
1770            "true",
1771        ),
1772        ("var c=new AbortController(); c.abort(); c.signal.reason.name", "AbortError"),
1773        ("var c=new AbortController(); c.abort('custom'); c.signal.reason", "custom"),
1774        // 二重 abort() は2回目以降が黙殺される(リスナが2回発火しない)。
1775        (
1776            "var c=new AbortController(); var n=0; c.signal.addEventListener('abort', function(){n++;}); c.abort(); c.abort(); n",
1777            "1",
1778        ),
1779        // `AbortSignal.abort(reason)`(ES2022)が、`AbortController` 経由でしか
1780        // signal を得られず丸ごと未対応だった。
1781        ("AbortSignal.abort().aborted", "true"),
1782        ("AbortSignal.abort('why').reason", "why"),
1783        ("AbortSignal.abort().reason.name", "AbortError"),
1784        // `DOMException`(丸ごと未対応だった。`new DOMException(message, name)`
1785        // というユーザーコードからの直接構築、レガシー `.code` 数値定数)。
1786        ("new DOMException('boom', 'NotFoundError').message", "boom"),
1787        ("new DOMException('boom', 'NotFoundError').name", "NotFoundError"),
1788        ("new DOMException('boom', 'NotFoundError').code", "8"),
1789        ("DOMException.NOT_FOUND_ERR", "8"),
1790        ("new DOMException().name", "Error"),
1791        ("new DOMException('x', 'CustomError').code", "0"),
1792        // 既存の AbortError も同じ DOMException 経路で構築されるようになった
1793        // (`.code` が正しく `20`=`ABORT_ERR` になることを確認)。
1794        ("AbortSignal.abort().reason.code", "20"),
1795        // `signal.removeEventListener('abort', fn)` が `addEventListener` は対応済み
1796        // なのに対をなす削除側だけ無条件 no-op のままだったバグ。
1797        (
1798            "var c=new AbortController(); var n=0; var fn=function(){n++;}; c.signal.addEventListener('abort', fn); c.signal.removeEventListener('abort', fn); c.abort(); n",
1799            "0",
1800        ),
1801        (
1802            "var c=new AbortController(); var n=0; c.signal.addEventListener('abort', function(){n++;}); c.signal.removeEventListener('abort', function(){}); c.abort(); n",
1803            "1",
1804        ),
1805        // `AbortSignal.any(iterable)`(ES2024)— 複数の中断条件を1つの signal にまとめる。
1806        (
1807            "var c1=new AbortController(); var c2=new AbortController(); var s=AbortSignal.any([c1.signal, c2.signal]); var before=s.aborted; c2.abort('two'); before+','+s.aborted+','+s.reason",
1808            "false,true,two",
1809        ),
1810        (
1811            "var c1=new AbortController(); c1.abort('already'); AbortSignal.any([c1.signal]).reason",
1812            "already",
1813        ),
1814        // `signal.throwIfAborted()` が丸ごと未対応だった。中断前は no-op。
1815        ("var c=new AbortController(); c.signal.throwIfAborted()", "undefined"),
1816        // 中断後は `reason` を投げる。
1817        (
1818            "var c=new AbortController(); c.abort('boom'); \
1819             var caught; try { c.signal.throwIfAborted(); } catch (e) { caught = e; } caught",
1820            "boom",
1821        ),
1822        // `EventTarget` が丸ごと未対応だった(DOM 要素以外で独自のイベント発行/購読の
1823        // 基盤として使う定番パターン)。他の EventTarget 風オブジェクトと違い型ごとに
1824        // 複数リスナを保持する。
1825        (
1826            "var t=new EventTarget(); var log=''; t.addEventListener('x', ()=>log+='a'); t.addEventListener('x', ()=>log+='b'); t.dispatchEvent(new Event('x')); log",
1827            "ab",
1828        ),
1829        (
1830            "var t=new EventTarget(); var n=0; var fn=()=>n++; t.addEventListener('x', fn); t.addEventListener('x', fn); t.dispatchEvent(new Event('x')); n",
1831            "1",
1832        ),
1833        (
1834            "var t=new EventTarget(); var n=0; var fn=()=>n++; t.addEventListener('x', fn); t.removeEventListener('x', fn); t.dispatchEvent(new Event('x')); n",
1835            "0",
1836        ),
1837        // 同一関数を capture/bubble 両方で登録すると重複扱いされず2件とも
1838        // 保持される(仕様上 `(listener, capture)` の組で区別すべきところ、
1839        // 以前は `capture` を見ずに `cb` だけで重複判定していたため2回目の
1840        // 登録が黙って無視されるバグだった。`document`のcapture対応
1841        // 〔2026-07-16〕で顕在化・同日発見・修正)。
1842        (
1843            "var t=new EventTarget(); var n=0; var fn=()=>n++; t.addEventListener('x', fn, true); t.addEventListener('x', fn, false); t.dispatchEvent(new Event('x')); n",
1844            "2",
1845        ),
1846        // `removeEventListener(type, fn)`(capture省略=既定false)はcapture
1847        // 登録済みの同一関数を巻き込んで消してはいけない。
1848        (
1849            "var t=new EventTarget(); var n=0; var fn=()=>n++; t.addEventListener('x', fn, true); t.addEventListener('x', fn, false); t.removeEventListener('x', fn); t.dispatchEvent(new Event('x')); n",
1850            "1",
1851        ),
1852        // `addEventListener(type, fn, {signal})`(丸ごと未対応だった。
1853        // `AbortController` でリスナを一括解除する定番パターン。2026-07-14
1854        // 発見・実装)。abort 後は発火しなくなる。
1855        (
1856            "var t=new EventTarget(); var c=new AbortController(); var n=0; \
1857             t.addEventListener('x', ()=>n++, {signal: c.signal}); \
1858             t.dispatchEvent(new Event('x')); c.abort(); t.dispatchEvent(new Event('x')); n",
1859            "1",
1860        ),
1861        // 登録前に既に abort 済みの signal を渡した場合は登録自体が行われない。
1862        (
1863            "var t=new EventTarget(); var c=new AbortController(); c.abort(); var n=0; \
1864             t.addEventListener('x', ()=>n++, {signal: c.signal}); \
1865             t.dispatchEvent(new Event('x')); n",
1866            "0",
1867        ),
1868        // DOM 要素側(`Element.prototype.addEventListener`)でも同じく対応。
1869        (
1870            "var el=document.createElement('div'); var c=new AbortController(); var n=0; \
1871             el.addEventListener('click', ()=>n++, {signal: c.signal}); \
1872             el.click(); c.abort(); el.click(); n",
1873            "1",
1874        ),
1875        // `event.preventDefault()` が丸ごと no-op で `defaultPrevented` を一切
1876        // 追跡せず、`dispatchEvent()` の戻り値が常に `true` になるバグだった。
1877        (
1878            "var t=new EventTarget(); t.addEventListener('x', e => e.preventDefault()); t.dispatchEvent(new Event('x', {cancelable:true}))",
1879            "false",
1880        ),
1881        (
1882            "var t=new EventTarget(); t.addEventListener('x', e => e.preventDefault()); t.dispatchEvent(new Event('x'))",
1883            "true",
1884        ),
1885        // `event.isTrusted` が丸ごと未対応だった。スクリプトから発火した
1886        // イベントは仕様上常に `false`。
1887        (
1888            "var t=new EventTarget(); var r; t.addEventListener('x', e => { r = e.isTrusted; }); t.dispatchEvent(new Event('x')); r",
1889            "false",
1890        ),
1891        // `event.composed`(丸ごと未対応だった。`Event`/`CustomEvent`両方の
1892        // コンストラクタで`options.composed`が一切読まれず常に`undefined`に
1893        // なっていた。2026-07-16 発見・実装)。
1894        ("new Event('x', {composed: true}).composed", "true"),
1895        ("new Event('x').composed", "false"),
1896        (
1897            "new CustomEvent('x', {detail: 1, composed: true}).composed",
1898            "true",
1899        ),
1900        // `EventTarget` のイベントに `stopImmediatePropagation` が丸ごと
1901        // 未対応で、呼び出すと TypeError になっていた(そもそも呼び出しようが
1902        // ないため残りのリスナーを止める効果も一切なかった)。
1903        (
1904            "var t=new EventTarget(); var log=''; \
1905             t.addEventListener('x', e => { log+='a'; e.stopImmediatePropagation(); }); \
1906             t.addEventListener('x', () => { log+='b'; }); \
1907             t.dispatchEvent(new Event('x')); log",
1908            "a",
1909        ),
1910        // `EventTarget.addEventListener` の第3引数 `{once:true}` が丸ごと
1911        // 読まれておらず、一度発火しても解除されず何度でも呼ばれ続けていた。
1912        (
1913            "var t=new EventTarget(); var n=0; t.addEventListener('x', ()=>n++, {once:true}); \
1914             t.dispatchEvent(new Event('x')); t.dispatchEvent(new Event('x')); n",
1915            "1",
1916        ),
1917        // once 指定でも removeEventListener で明示的に解除できる。
1918        (
1919            "var t=new EventTarget(); var n=0; var fn=()=>n++; t.addEventListener('x', fn, {once:true}); \
1920             t.removeEventListener('x', fn); t.dispatchEvent(new Event('x')); n",
1921            "0",
1922        ),
1923        // `EventTarget` 発の `Event`/`CustomEvent` に `composedPath()` が丸ごと
1924        // 未対応で、呼び出すと TypeError になっていた(DOM 要素側は既に対応済み)。
1925        (
1926            "var t=new EventTarget(); var p; t.addEventListener('x', e => { p = e.composedPath(); }); \
1927             t.dispatchEvent(new Event('x')); p.length === 1 && p[0] === t",
1928            "true",
1929        ),
1930        // 発火前(target 未設定)は composedPath() が空配列を返す。
1931        ("new CustomEvent('x').composedPath().length", "0"),
1932        // `KeyboardEvent`/`MouseEvent`(丸ごと未対応だった。`el.dispatchEvent
1933        // (new KeyboardEvent('keydown', {key:'a'}))` というシミュレーション
1934        // イベント構築の定番パターン)。
1935        ("new KeyboardEvent('keydown', {key:'a', code:'KeyA'}).key", "a"),
1936        ("new KeyboardEvent('keydown', {key:'a', code:'KeyA'}).code", "KeyA"),
1937        (
1938            "var t=new EventTarget(); var got; \
1939             t.addEventListener('keydown', e => { got = e.ctrlKey + ':' + e.key; }); \
1940             t.dispatchEvent(new KeyboardEvent('keydown', {key:'Enter', ctrlKey:true})); got",
1941            "true:Enter",
1942        ),
1943        ("new MouseEvent('click', {clientX:10, clientY:20}).clientX", "10"),
1944        (
1945            "var t=new EventTarget(); var got; \
1946             t.addEventListener('click', e => { got = e.clientY + ':' + e.button; }); \
1947             t.dispatchEvent(new MouseEvent('click', {clientY:5, button:2})); got",
1948            "5:2",
1949        ),
1950        ("new MouseEvent('click').bubbles", "false"),
1951        ("new MouseEvent('click', {bubbles:true}).bubbles", "true"),
1952        // `WheelEvent`/`FocusEvent`(丸ごと未対応だった。`MouseEvent` を継承
1953        // する `WheelEvent` は座標系プロパティも合わせて持つべき仕様)。
1954        ("new WheelEvent('wheel', {deltaY:100}).deltaY", "100"),
1955        ("new WheelEvent('wheel', {deltaY:1, clientX:5}).clientX", "5"),
1956        ("new WheelEvent('wheel').deltaMode", "0"),
1957        ("new FocusEvent('focusout', {relatedTarget: null}).relatedTarget === null", "true"),
1958        (
1959            "var t=new EventTarget(); var r=new EventTarget(); var got; \
1960             t.addEventListener('focusout', e => { got = e.relatedTarget; }); \
1961             t.dispatchEvent(new FocusEvent('focusout', {relatedTarget: r})); got === r",
1962            "true",
1963        ),
1964        // `Touch`/`TouchEvent`(丸ごと未対応だった。この処理系にはタッチ
1965        // スクリーン入力機構自体が無いが、コンストラクタでのシミュレーション
1966        // パターンには対応する。2026-07-15 発見・実装)。
1967        ("new Touch({identifier:1, clientX:10, clientY:20}).clientX", "10"),
1968        ("new Touch({}).force", "1"),
1969        (
1970            "var t=new Touch({identifier:1}); \
1971             new TouchEvent('touchstart', {touches:[t], changedTouches:[t]}).touches[0] === t",
1972            "true",
1973        ),
1974        // `CommandEvent`/`ToggleEvent`/`FormDataEvent`(WHATWG HTML Standard / Invoker Commands API)
1975        ("new CommandEvent('command', {command:'show-modal'}).command", "show-modal"),
1976        ("new CommandEvent('command', {source:null}).source === null", "true"),
1977        ("new ToggleEvent('toggle', {oldState:'closed', newState:'open'}).newState", "open"),
1978        ("new ToggleEvent('toggle').oldState", "closed"),
1979        ("new FormDataEvent('formdata', {formData:null}).formData === null", "true"),
1980
1981        ("new TouchEvent('touchend').changedTouches.length", "0"),
1982        // `HashChangeEvent`/`PageTransitionEvent`(丸ごと未対応だった。
1983        // 2026-07-15 発見・実装)。
1984        (
1985            "new HashChangeEvent('hashchange', {oldURL:'a', newURL:'b'}).oldURL + ',' + \
1986             new HashChangeEvent('hashchange', {oldURL:'a', newURL:'b'}).newURL",
1987            "a,b",
1988        ),
1989        (
1990            "new HashChangeEvent('hashchange').type",
1991            "hashchange",
1992        ),
1993        (
1994            "new PageTransitionEvent('pageshow', {persisted:true}).persisted",
1995            "true",
1996        ),
1997        // `PopStateEvent`(丸ごと未対応だった。実ナビゲーション経由の発火は
1998        // 既に`state`付きで動いていたが、手動シミュレーション用の専用
1999        // コンストラクタが無かった。2026-07-17 発見・実装)。
2000        (
2001            "new PopStateEvent('popstate', {state:{a:1}}).state.a",
2002            "1",
2003        ),
2004        ("new PopStateEvent('popstate').state", "null"),
2005        (
2006            "var got=null; window.addEventListener('popstate', e => got = e.state); \
2007             window.dispatchEvent(new PopStateEvent('popstate', {state:'s'})); got",
2008            "s",
2009        ),
2010        // `DOMRect`/`DOMRectReadOnly`コンストラクタ(丸ごと未対応だった。
2011        // `getBoundingClientRect()`と同じ形状で手動構築する定番パターン。
2012        // 2026-07-17 発見・実装)。
2013        (
2014            "var r=new DOMRect(10,20,30,40); \
2015             [r.x,r.y,r.width,r.height,r.left,r.top,r.right,r.bottom].join(',')",
2016            "10,20,30,40,10,20,40,60",
2017        ),
2018        ("new DOMRect().width", "0"),
2019        ("new DOMRectReadOnly(1,2,3,4).right", "4"),
2020        ("JSON.stringify(new DOMRect(1,2,3,4).toJSON()).includes('\"width\":3')", "true"),
2021        // `DOMPoint`/`DOMPointReadOnly`コンストラクタおよび DOMMatrix/DOMQuad (Geometry Interfaces)
2022        (
2023            "var p=new DOMPoint(1,2); p.x+','+p.y+','+p.z+','+p.w",
2024            "1,2,0,1",
2025        ),
2026        ("new DOMPoint(1,2,3,4).w", "4"),
2027        ("new DOMPointReadOnly().x", "0"),
2028        ("JSON.stringify(new DOMPoint(1,2).toJSON()).includes('\"y\":2')", "true"),
2029        ("new DOMPoint(10, 20).matrixTransform(new DOMMatrix().translate(5, 5)).x", "15"),
2030        ("new DOMMatrix().isIdentity", "true"),
2031        ("new DOMMatrix().is2D", "true"),
2032        ("new DOMMatrix([1,0,0,1,10,20]).toString()", "matrix(1, 0, 0, 1, 10, 20)"),
2033        ("new DOMMatrix().translate(10, 20).e", "10"),
2034        ("new DOMMatrix().scale(2, 3).d", "3"),
2035        ("DOMMatrix.fromFloat32Array(new Float32Array([1,0,0,1,10,20])).e", "10"),
2036        ("new DOMMatrix().rotate(90).b", "1"),
2037        ("new DOMMatrix([1,0,0,1,10,20]).invert().e", "-10"),
2038        ("new DOMMatrix().translateSelf(10, 20).e", "10"),
2039        ("new DOMMatrix().rotateSelf(90).b", "1"),
2040        ("new DOMMatrix().scaleSelf(2, 3).d", "3"),
2041        ("new DOMMatrix([1,0,0,1,10,20]).invertSelf().e", "-10"),
2042        ("DOMQuad.fromRect(new DOMRect(10, 20, 30, 40)).getBounds().width", "30"),
2043        ("DOMRect.fromRect({x: 5, y: 10, width: 15, height: 20}).width", "15"),
2044        ("DOMPoint.fromPoint({x: 3, y: 4, z: 5, w: 1}).z", "5"),
2045        ("'가'.normalize('NFD').normalize('NFC')", "가"),
2046
2047        // `window.dispatchEvent(event)`(丸ごと未対応だった。前サイクルで
2048        // 発見した既知ギャップを本サイクルで解消。2026-07-15 発見・実装)。
2049        (
2050            "var got=null; window.addEventListener('hashchange', e => got = e.newURL); \
2051             window.dispatchEvent(new HashChangeEvent('hashchange', {newURL:'x'})); got",
2052            "x",
2053        ),
2054        (
2055            "window.dispatchEvent(new Event('unknown-type'))",
2056            "true",
2057        ),
2058        // `window.dispatchEvent()` は `addEventListener` 登録分だけでなく
2059        // `window.on<type>`(IDL属性スタイル)も合わせて呼び出す(丸ごと
2060        // 未対応だった。2026-07-15 発見・実装)。
2061        (
2062            "var n=0; window.onhashchange = () => n++; \
2063             window.dispatchEvent(new HashChangeEvent('hashchange')); n",
2064            "1",
2065        ),
2066        (
2067            "var order=[]; window.onresize = () => order.push('on'); \
2068             window.addEventListener('resize', () => order.push('listener')); \
2069             window.dispatchEvent(new Event('resize')); order.join(',')",
2070            "on,listener",
2071        ),
2072        // `window.removeEventListener()`(丸ごと未対応だった。以前は無害な
2073        // no-op のままで、`AbortSignal` 経由以外ではリスナが二度と解除
2074        // できなかった。2026-07-15 発見・実装)。
2075        (
2076            "var n=0; var cb = () => n++; window.addEventListener('resize', cb); \
2077             window.removeEventListener('resize', cb); \
2078             window.dispatchEvent(new Event('resize')); n",
2079            "0",
2080        ),
2081        (
2082            "var log=[]; var cb1 = () => log.push('1'); var cb2 = () => log.push('2'); \
2083             window.addEventListener('resize', cb1); window.addEventListener('resize', cb2); \
2084             window.removeEventListener('resize', cb1); \
2085             window.dispatchEvent(new Event('resize')); log.join(',')",
2086            "2",
2087        ),
2088        // `document.removeEventListener()`(丸ごと未対応だった。`addEventListener`
2089        // は `window` 版を再利用していたが、対になる `removeEventListener`
2090        // 自体が未登録で「関数ではない」`TypeError` になっていた。2026-07-15
2091        // 発見・実装)。
2092        (
2093            "typeof document.removeEventListener",
2094            "function",
2095        ),
2096        (
2097            "var n=0; var cb = () => n++; document.addEventListener('hashchange', cb); \
2098             document.removeEventListener('hashchange', cb); \
2099             window.dispatchEvent(new Event('hashchange')); n",
2100            "0",
2101        ),
2102        // `document.dispatchEvent`(丸ごと未対応だった。`addEventListener`/
2103        // `removeEventListener`と同じ兄弟ギャップ。2026-07-15 発見・実装)。
2104        (
2105            "var got=null; document.addEventListener('hashchange', e => got = e.newURL); \
2106             document.dispatchEvent(new HashChangeEvent('hashchange', {newURL:'y'})); got",
2107            "y",
2108        ),
2109        // `window.dispatchEvent()`/`document.dispatchEvent()` の戻り値が仕様
2110        // どおり `!defaultPrevented` になること(以前は無条件 `true` を返し、
2111        // リスナが `preventDefault()` を呼んでも常に `true` だった。要素用
2112        // `dom_dispatch_event`/`event_target_dispatch_event` は正しく実装済みで
2113        // window/document 経路にだけ同型バグが残っていた。2026-07-16 発見・修正)。
2114        (
2115            "window.addEventListener('resize', e => e.preventDefault()); \
2116             window.dispatchEvent(new Event('resize', {cancelable:true}))",
2117            "false",
2118        ),
2119        (
2120            "document.addEventListener('scroll', e => e.preventDefault()); \
2121             document.dispatchEvent(new Event('scroll', {cancelable:true}))",
2122            "false",
2123        ),
2124        // `preventDefault()` を呼ばなければ従来どおり `true` を返す。
2125        (
2126            "window.addEventListener('popstate', () => {}); \
2127             window.dispatchEvent(new Event('popstate'))",
2128            "true",
2129        ),
2130        // dispatch 中に `event.target` が dispatch 対象へ設定されること(以前は
2131        // window/document 経路では一切設定されず `undefined` だった。2026-07-16
2132        // 発見・修正)。
2133        (
2134            "var t='none'; window.addEventListener('message', e => t = (e.target === window)); \
2135             window.dispatchEvent(new Event('message')); t",
2136            "true",
2137        ),
2138        // `window.dispatchEvent(new ErrorEvent(...))` 経由でも `window.onerror`
2139        // がレガシー5引数シグネチャ `(message, source, lineno, colno, error)` で
2140        // 呼ばれること(以前は Event オブジェクトを1引数でそのまま渡していて
2141        // `reportError()`〔既に正しい5引数呼び出し〕と経路によって呼び出し形が
2142        // 食い違っていた。2026-07-16 発見・修正)。
2143        (
2144            "var got=''; window.onerror = (msg, src, line, col) => { got = msg+'|'+src+'|'+line+'|'+col; }; \
2145             window.dispatchEvent(new ErrorEvent('error', {message:'boom', filename:'a.js', lineno:3, colno:7})); got",
2146            "boom|a.js|3|7",
2147        ),
2148        // `online`/`offline`(丸ごと未対応だった。`addEventListener('online',
2149        // ...)` が登録経路自体無く黙って何もしなかった。2026-07-16 発見・実装)。
2150        (
2151            "var n=0; window.addEventListener('online', () => n++); \
2152             window.dispatchEvent(new Event('online')); n",
2153            "1",
2154        ),
2155        (
2156            "var n=0; var cb = () => n++; window.addEventListener('offline', cb); \
2157             window.removeEventListener('offline', cb); \
2158             window.dispatchEvent(new Event('offline')); n",
2159            "0",
2160        ),
2161        // `beforeunload`/`unload`/`pageshow`/`pagehide`/`visibilitychange`/
2162        // `languagechange`(丸ごと未対応だった。2026-07-16 発見・実装)。
2163        (
2164            "var log=[]; \
2165             window.addEventListener('beforeunload', () => log.push('bu')); \
2166             window.addEventListener('unload', () => log.push('u')); \
2167             window.addEventListener('pageshow', () => log.push('ps')); \
2168             window.addEventListener('pagehide', () => log.push('ph')); \
2169             document.addEventListener('visibilitychange', () => log.push('vc')); \
2170             window.addEventListener('languagechange', () => log.push('lc')); \
2171             window.dispatchEvent(new Event('beforeunload')); \
2172             window.dispatchEvent(new Event('unload')); \
2173             window.dispatchEvent(new Event('pageshow')); \
2174             window.dispatchEvent(new Event('pagehide')); \
2175             document.dispatchEvent(new Event('visibilitychange')); \
2176             window.dispatchEvent(new Event('languagechange')); \
2177             log.join(',')",
2178            "bu,u,ps,ph,vc,lc",
2179        ),
2180        // `document.visibilityState`/`.hidden`(丸ごと未対応だった。2026-07-16
2181        // 発見・実装)。
2182        ("document.visibilityState", "visible"),
2183        ("document.hidden", "false"),
2184        // `document.characterSet`/`.compatMode`/`.contentType`/`.doctype`
2185        // (丸ごと未対応だった。2026-07-16 発見・実装)。
2186        ("document.characterSet", "UTF-8"),
2187        ("document.compatMode", "CSS1Compat"),
2188        ("document.contentType", "text/html"),
2189        ("document.doctype", "null"),
2190        // `document.currentScript`(丸ごと未対応だった。2026-07-16 発見・
2191        // 実装。実行中スクリプト要素の追跡機構が無いため常に `null` を返す
2192        // 誠実な簡略実装)。
2193        ("document.currentScript", "null"),
2194        // `document.implementation`(`DOMImplementation`。丸ごと未対応
2195        // だった。2026-07-16 発見・実装。`hasFeature()`は仕様どおり常に
2196        // `true`を返すレガシー no-op、`createDocumentType()`は独立した
2197        // 読み取り専用簡略オブジェクトを返す)。
2198        ("document.implementation.hasFeature('x','1.0')", "true"),
2199        (
2200            "var dt=document.implementation.createDocumentType('html',' ',''); dt.name+','+dt.nodeType",
2201            "html,10",
2202        ),
2203        (
2204            "var doc=document.implementation.createHTMLDocument('MyDoc'); doc.title+','+doc.nodeType",
2205            "MyDoc,9",
2206        ),
2207        (
2208            "var doc=document.implementation.createDocument('http://www.w3.org/1999/xhtml','html'); doc.qualifiedName+','+doc.nodeType",
2209            "html,9",
2210        ),
2211        // `storage` イベント(丸ごと未対応だった。`StorageEvent` コンストラクタ
2212        // 自体は既に対応済みだったが登録経路が無かった。2026-07-16 発見・実装)。
2213        (
2214            "var got=null; window.addEventListener('storage', e => got = e.key); \
2215             window.dispatchEvent(new StorageEvent('storage', {key:'k'})); got",
2216            "k",
2217        ),
2218        // `document.addEventListener('readystatechange', ...)`(丸ごと未対応
2219        // だった。`document.readyState` は常に `"complete"` のため
2220        // `load`/`DOMContentLoaded` と同じ即時発火。2026-07-16 発見・実装)。
2221        (
2222            "var n=0; document.addEventListener('readystatechange', () => n++); n",
2223            "1",
2224        ),
2225        // `window.print()`/`beforeprint`/`afterprint`(丸ごと未対応だった。
2226        // 2026-07-16 発見・実装)。
2227        ("window.print(); true", "true"),
2228        (
2229            "var log=[]; \
2230             window.addEventListener('beforeprint', () => log.push('bp')); \
2231             window.addEventListener('afterprint', () => log.push('ap')); \
2232             window.dispatchEvent(new Event('beforeprint')); \
2233             window.dispatchEvent(new Event('afterprint')); \
2234             log.join(',')",
2235            "bp,ap",
2236        ),
2237        // `PointerEvent`/`InputEvent`(丸ごと未対応だった。`PointerEvent` は
2238        // `MouseEvent` を継承するため座標系プロパティも合わせて持つべき仕様)。
2239        ("new PointerEvent('pointerdown', {pointerId:7, pointerType:'touch'}).pointerId", "7"),
2240        ("new PointerEvent('pointerdown', {pointerType:'touch', clientX:9}).clientX", "9"),
2241        ("new PointerEvent('pointerdown').isPrimary", "false"),
2242        ("new PointerEvent('pointerdown', {isPrimary:true}).width", "1"),
2243        ("new InputEvent('input', {data:'a', inputType:'insertText'}).data", "a"),
2244        ("new InputEvent('input', {data:'a', inputType:'insertText'}).inputType", "insertText"),
2245        ("new InputEvent('beforeinput').isComposing", "false"),
2246        // `setPointerCapture`/`releasePointerCapture`/`hasPointerCapture`
2247        // (Pointer Events。丸ごと未対応だった)。
2248        (
2249            "var e=document.createElement('div'); e.hasPointerCapture(1)",
2250            "false",
2251        ),
2252        (
2253            "var e=document.createElement('div'); e.setPointerCapture(1); e.hasPointerCapture(1)",
2254            "true",
2255        ),
2256        (
2257            "var e=document.createElement('div'); e.setPointerCapture(1); \
2258             e.releasePointerCapture(1); e.hasPointerCapture(1)",
2259            "false",
2260        ),
2261        // 別 pointerId には影響しない。
2262        (
2263            "var e=document.createElement('div'); e.setPointerCapture(1); e.hasPointerCapture(2)",
2264            "false",
2265        ),
2266        // `ProgressEvent`/`StorageEvent`(丸ごと未対応だった)。
2267        ("new ProgressEvent('progress', {loaded:50, total:100}).loaded", "50"),
2268        ("new ProgressEvent('progress', {lengthComputable:true}).lengthComputable", "true"),
2269        ("new ProgressEvent('progress').total", "0"),
2270        ("new StorageEvent('storage', {key:'k', newValue:'v'}).key", "k"),
2271        ("new StorageEvent('storage', {key:'k', newValue:'v'}).newValue", "v"),
2272        ("new StorageEvent('storage').oldValue === null", "true"),
2273        // `CompositionEvent`/`ClipboardEvent`(丸ごと未対応だった)。
2274        ("new CompositionEvent('compositionupdate', {data:'あ'}).data", "あ"),
2275        ("new CompositionEvent('compositionstart').data", ""),
2276        (
2277            "var t=new EventTarget(); var got; \
2278             t.addEventListener('paste', e => { got = e.clipboardData; }); \
2279             t.dispatchEvent(new ClipboardEvent('paste', {clipboardData:'X'})); got",
2280            "X",
2281        ),
2282        ("new ClipboardEvent('copy').clipboardData === null", "true"),
2283        // `AnimationEvent`/`TransitionEvent`/`DragEvent`/`SubmitEvent`(丸ごと
2284        // 未対応だった。`DragEvent` は `MouseEvent` を継承するため座標系
2285        // プロパティも合わせて持つべき仕様)。
2286        ("new AnimationEvent('animationend', {animationName:'spin'}).animationName", "spin"),
2287        ("new AnimationEvent('animationend').elapsedTime", "0"),
2288        ("new TransitionEvent('transitionend', {propertyName:'opacity'}).propertyName", "opacity"),
2289        ("new DragEvent('drop', {dataTransfer:'X'}).dataTransfer", "X"),
2290        ("new DragEvent('drop', {clientX:3}).clientX", "3"),
2291        ("new SubmitEvent('submit', {submitter:'BTN'}).submitter", "BTN"),
2292        ("new SubmitEvent('submit').submitter === null", "true"),
2293        // `MessageEvent`/`ErrorEvent`(丸ごと未対応だった。`window.
2294        // postMessage()`/`reportError()` の内部イベント形と同じ形をユーザー
2295        // コードから直接構築できる)。
2296        ("new MessageEvent('message', {data:'hi', origin:'https://a.com'}).data", "hi"),
2297        ("new MessageEvent('message', {data:'hi', origin:'https://a.com'}).origin", "https://a.com"),
2298        ("new MessageEvent('message').ports.length", "0"),
2299        ("new ErrorEvent('error', {message:'boom', lineno:5}).message", "boom"),
2300        ("new ErrorEvent('error', {message:'boom', lineno:5}).lineno", "5"),
2301        ("new ErrorEvent('error').error === null", "true"),
2302        // `EventTarget` 発のイベントで `currentTarget`/`eventPhase` が丸ごと
2303        // 未設定で常に undefined だった(DOM 要素側は既に対応済み)。
2304        (
2305            "var t=new EventTarget(); var ct, ph; \
2306             t.addEventListener('x', e => { ct = e.currentTarget; ph = e.eventPhase; }); \
2307             t.dispatchEvent(new Event('x')); ct === t && ph === 2",
2308            "true",
2309        ),
2310        // 発火完了後は currentTarget が null、eventPhase が 0 に戻る。
2311        (
2312            "var t=new EventTarget(); var e=new Event('x'); t.dispatchEvent(e); \
2313             e.currentTarget === null && e.eventPhase",
2314            "0",
2315        ),
2316        // `Event.timeStamp` がこのエンジン全体に丸ごと未対応で常に undefined
2317        // だった(DOM要素・EventTarget どちらの経路でも欠落していた)。
2318        ("typeof new Event('x').timeStamp", "number"),
2319        (
2320            "var b=document.createElement('button'); var ts; \
2321             b.addEventListener('click', e => { ts = e.timeStamp; }); \
2322             b.dispatchEvent({type:'click'}); typeof ts",
2323            "number",
2324        ),
2325        // レガシー DOM Level 0 の `returnValue`/`cancelBubble`/`srcElement` が
2326        // 丸ごと未対応だった。`e.returnValue = false` は `preventDefault()` と
2327        // 等価であるべき。
2328        (
2329            "var t=new EventTarget(); var r; \
2330             t.addEventListener('x', e => { e.returnValue = false; }); \
2331             r = t.dispatchEvent(new Event('x', {cancelable:true})); r",
2332            "false",
2333        ),
2334        // `e.cancelBubble = true` は `stopPropagation()` と等価であるべき。
2335        (
2336            "var b=document.createElement('button'); var p=document.createElement('div'); \
2337             p.appendChild(b); var s=''; \
2338             p.addEventListener('click', ()=>s+='P'); \
2339             b.addEventListener('click', e => { s+='B'; e.cancelBubble = true; }); \
2340             b.dispatchEvent({type:'click', bubbles:true}); s",
2341            "B",
2342        ),
2343        // `srcElement` は `target` と同じ値の別名。
2344        (
2345            "var t=new EventTarget(); var se; \
2346             t.addEventListener('x', e => { se = e.srcElement; }); \
2347             t.dispatchEvent(new Event('x')); se === t",
2348            "true",
2349        ),
2350        // `Event.NONE`/`.CAPTURING_PHASE`/`.AT_TARGET`/`.BUBBLING_PHASE`
2351        // (`Node.ELEMENT_NODE`と同型の標準定数)が丸ごと未対応だった。
2352        (
2353            "Event.NONE + ',' + Event.CAPTURING_PHASE + ',' + Event.AT_TARGET + ',' + Event.BUBBLING_PHASE",
2354            "0,1,2,3",
2355        ),
2356        (
2357            "var t=new EventTarget(); var ph; \
2358             t.addEventListener('x', e => { ph = e.eventPhase === Event.AT_TARGET; }); \
2359             t.dispatchEvent(new Event('x')); ph",
2360            "true",
2361        ),
2362        // `form.requestSubmit()`/`form.submit()`(HTML5)が丸ごと未対応だった。
2363        // `requestSubmit()` は `submit` イベントを発火する。
2364        (
2365            "var f=document.createElement('form'); var n=0; \
2366             f.addEventListener('submit', ()=>n++); f.requestSubmit(); n",
2367            "1",
2368        ),
2369        // `preventDefault()` で中止可能。
2370        (
2371            "var f=document.createElement('form'); \
2372             f.addEventListener('submit', e=>e.preventDefault()); \
2373             typeof f.requestSubmit()",
2374            "undefined",
2375        ),
2376        // `submit()` は無害な no-op(実際のフォーム送信/ページ遷移パイプラインが
2377        // 無いため)で、少なくとも例外を投げない。
2378        ("var f=document.createElement('form'); f.submit(); true", "true"),
2379        // `input.showPicker()`(丸ごと未対応だった。ネイティブピッカー UI 自体が
2380        // 無いため `submit()` と同じ無害な no-op。2026-07-15 発見・実装)。
2381        (
2382            "var i=document.createElement('input'); i.type='date'; i.showPicker(); true",
2383            "true",
2384        ),
2385        // `input.stepUp(n?)`/`.stepDown(n?)`(HTML5)が丸ごと未対応だった。
2386        (
2387            "var i=document.createElement('input'); i.type='number'; i.value='5'; \
2388             i.stepUp(); i.value",
2389            "6",
2390        ),
2391        ("var i=document.createElement('input'); i.type='number'; i.value='5'; i.stepDown(3); i.value", "2"),
2392        // `step` 属性を刻み幅として使う。
2393        (
2394            "var i=document.createElement('input'); i.type='number'; i.value='0'; i.step='0.5'; \
2395             i.stepUp(); i.value",
2396            "0.5",
2397        ),
2398        // `max` があればクランプする。
2399        (
2400            "var i=document.createElement('input'); i.type='number'; i.value='9'; i.max='10'; \
2401             i.stepUp(5); i.value",
2402            "10",
2403        ),
2404        // String / Array 静的・console・globalThis
2405        ("String.fromCharCode(72,105)", "Hi"),
2406        ("String.fromCodePoint(65)", "A"),
2407        ("Array.of(1,2,3).join(',')", "1,2,3"),
2408        // Array イテレータ系 + reduceRight
2409        ("[...[10,20].keys()].join(',')", "0,1"),
2410        ("[...[10,20].values()].join(',')", "10,20"),
2411        // entries() は本物の Array Iterator(.map 等の Array メソッドは持たない。仕様どおり)
2412        // を返すため、配列メソッドを使うにはまず spread/Array.from で配列化する必要がある。
2413        ("[...[5,6].entries()].map(e => e[0]+':'+e[1]).join(',')", "0:5,1:6"),
2414        ("[1,2,3].reduceRight((a,b) => a+'-'+b)", "3-2-1"),
2415        ("[1,2,3,4].reduceRight((a,b) => a+b, 0)", "10"),
2416        // document.title 読み書き
2417        ("document.title = 'AtmOS'; document.title", "AtmOS"),
2418        ("document.readyState", "complete"),
2419        // `document.compatMode`/`.characterSet`/`.charset`/`.contentType`/
2420        // `.scrollingElement`(HTML5。丸ごと未対応だった)。
2421        ("document.compatMode", "CSS1Compat"),
2422        ("document.characterSet", "UTF-8"),
2423        ("document.charset", "UTF-8"),
2424        ("document.contentType", "text/html"),
2425        ("document.scrollingElement === document.documentElement", "true"),
2426        // `document.children`/`.firstElementChild`/`.lastElementChild`/
2427        // `.childElementCount`(`ParentNode`ミックスインの`Document`側配線
2428        // 漏れ。丸ごと未対応だった。2026-07-17 発見・実装。この配列は
2429        // bare `JsRuntime::new()` で `<html>` 自体が未構築のため、実際の
2430        // 検証は `dom_cases`(HTML フィクスチャ付き)側で行う)。
2431        ("document.firstElementChild === document.documentElement", "true"),
2432        ("document.lastElementChild === document.documentElement", "true"),
2433        ("document.children.length", "0"),
2434        ("document.childElementCount", "0"),
2435        // `document.referrer`/`.lastModified`/`.domain`(HTML5。丸ごと未対応
2436        // だった)。
2437        ("document.referrer", ""),
2438        (
2439            "/^\\d{2}\\/\\d{2}\\/\\d{4} \\d{2}:\\d{2}:\\d{2}$/.test(document.lastModified)",
2440            "true",
2441        ),
2442        ("typeof document.domain", "string"),
2443        // `navigator.geolocation`(丸ごと未対応だった。実ハードウェアが無いため
2444        // 常に `PERMISSION_DENIED` で `error` コールバックを同期的に呼ぶ簡略実装)。
2445        ("typeof navigator.geolocation.getCurrentPosition", "function"),
2446        (
2447            "var code; navigator.geolocation.getCurrentPosition(() => {}, e => { code = e.code; }); \
2448             code === 1",
2449            "true",
2450        ),
2451        (
2452            "typeof navigator.geolocation.watchPosition(() => {}, () => {})",
2453            "number",
2454        ),
2455        ("typeof navigator.geolocation.clearWatch(1)", "undefined"),
2456        // `navigator.wakeLock.request(type)`(Screen Wake Lock API。丸ごと
2457        // 未対応だった。実際の電源管理機構は無いため状態のみ追跡する簡略実装)。
2458        (
2459            "(await navigator.wakeLock.request('screen')).released",
2460            "false",
2461        ),
2462        ("(await navigator.wakeLock.request('screen')).type", "screen"),
2463        (
2464            "var s = await navigator.wakeLock.request('screen'); await s.release(); s.released",
2465            "true",
2466        ),
2467        // `navigator.share(data)`/`navigator.canShare(data)`(Web Share API。
2468        // 丸ごと未対応だった。実際の共有先 UI が無いため `canShare` は常に
2469        // `false`、`share` は仕様どおり `AbortError` で拒否する)。
2470        ("navigator.canShare({title:'x'})", "false"),
2471        (
2472            "try { await navigator.share({title:'x'}); 'resolved' } \
2473             catch(e) { e.name }",
2474            "AbortError",
2475        ),
2476        // `new EyeDropper().open()`(丸ごと未対応だった。実際のピッカー UI が
2477        // 無いため、ユーザーがキャンセルした場合と同じ `AbortError` で拒否)。
2478        (
2479            "try { await new EyeDropper().open(); 'resolved' } \
2480             catch(e) { e.name }",
2481            "AbortError",
2482        ),
2483        // `navigator.vibrate(pattern)`(Vibration API。丸ごと未対応だった。
2484        // 戻り値はリクエスト受理の可否のみを表しハードウェアの有無とは
2485        // 無関係なため、常に `true`)。
2486        ("navigator.vibrate(200)", "true"),
2487        ("navigator.vibrate([100,50,100])", "true"),
2488        // `navigator.getBattery()`(Battery Status API。丸ごと未対応だった。
2489        // バッテリー非搭載・常時 AC 電源動作というこの OS のターゲット
2490        // 実態に即した「常時満充電で給電中」を返す簡略実装)。
2491        ("(await navigator.getBattery()).charging", "true"),
2492        ("(await navigator.getBattery()).level", "1"),
2493        ("(await navigator.getBattery()).chargingTime", "0"),
2494        // `navigator.connection`(Network Information API。丸ごと未対応
2495        // だった。実測機構は無いため一般的なブロードバンド相当の代表値を返す
2496        // 簡略実装)。
2497        ("navigator.connection.saveData", "false"),
2498        ("navigator.connection.effectiveType", "4g"),
2499        ("typeof navigator.connection.downlink", "number"),
2500        // `navigator.locks.request(name, callback)`(Web Locks API。丸ごと
2501        // 未対応だった。複数タブ間の実際の排他機構が無いため、コールバックを
2502        // 即座に同期呼び出しし戻り値で解決する簡略実装。2026-07-15 発見・実装)。
2503        ("await navigator.locks.request('x', lock => lock.name)", "x"),
2504        ("await navigator.locks.request('x', lock => lock.mode)", "exclusive"),
2505        (
2506            "var ran=false; await navigator.locks.request('x', () => { ran=true; }); ran",
2507            "true",
2508        ),
2509        ("(await navigator.locks.query()).held.length", "0"),
2510        // Storage Access API(`document.hasStorageAccess()`/
2511        // `.requestStorageAccess()`。丸ごと未対応だった。サードパーティ
2512        // Cookie 分離機構自体が無いため常に成功する簡略実装)。
2513        ("await document.hasStorageAccess()", "true"),
2514        ("typeof await document.requestStorageAccess()", "undefined"),
2515        // `navigator.clipboard.write(items)`/`.read()`(`ClipboardItem` 配列版。
2516        // 丸ごと未対応だった。`text/plain` エントリのみ対応する簡略実装で、
2517        // `writeText`/`readText` と同じ内部状態を共有する)。
2518        (
2519            "await navigator.clipboard.write([new ClipboardItem({'text/plain': \
2520             new Blob(['hello-clip'], {type:'text/plain'})})]); \
2521             await navigator.clipboard.readText()",
2522            "hello-clip",
2523        ),
2524        (
2525            "await navigator.clipboard.writeText('via-text'); \
2526             (await navigator.clipboard.read())[0].types[0]",
2527            "text/plain",
2528        ),
2529        (
2530            "await navigator.clipboard.writeText('via-text2'); \
2531             var items = await navigator.clipboard.read(); \
2532             var blob = await items[0].getType('text/plain'); await blob.text()",
2533            "via-text2",
2534        ),
2535        // `navigator.permissions.query({name})`(丸ごと未対応だった。`geolocation`
2536        // は常に `PERMISSION_DENIED` を返す実装と、`notifications` は
2537        // `Notification.permission === 'granted'` と、それぞれ整合させる)。
2538        (
2539            "(await navigator.permissions.query({name:'geolocation'})).state",
2540            "denied",
2541        ),
2542        (
2543            "(await navigator.permissions.query({name:'notifications'})).state",
2544            "granted",
2545        ),
2546        (
2547            "(await navigator.permissions.query({name:'camera'})).state",
2548            "denied",
2549        ),
2550        // IntersectionObserver(コールバック即時発火・isIntersecting=true)
2551        ("var seen=false; var io=new IntersectionObserver(entries => { seen=entries[0].isIntersecting; }); io.observe(document.body); seen", "true"),
2552        // `IntersectionObserverEntry` の `boundingClientRect`/`intersectionRect`/
2553        // `rootBounds`/`time`(丸ごと未対応だった。2026-07-16 発見・実装)。
2554        (
2555            "var e=null; var io=new IntersectionObserver(entries => { e=entries[0]; }); \
2556             io.observe(document.body); \
2557             typeof e.boundingClientRect.width + ',' + \
2558             (e.intersectionRect === e.boundingClientRect ? 'same' : 'diff') + ',' + \
2559             (e.rootBounds === null) + ',' + (typeof e.time)",
2560            "number,same,true,number",
2561        ),
2562        // `IntersectionObserver`のコンストラクタ第2引数`options`
2563        // (`root`/`rootMargin`/`threshold`)が丸ごと無視されており、対応
2564        // する`.root`/`.rootMargin`/`.thresholds`読み取り専用プロパティも
2565        // 存在しなかった(丸ごと未対応だった。2026-07-17 発見・実装)。
2566        (
2567            "var io=new IntersectionObserver(()=>{}); \
2568             (io.root===null)+','+io.rootMargin+','+io.thresholds.join(',')",
2569            "true,0px 0px 0px 0px,0",
2570        ),
2571        (
2572            "var r=document.body; \
2573             var io=new IntersectionObserver(()=>{}, {root:r, rootMargin:'10px', threshold:0.5}); \
2574             (io.root===r)+','+io.rootMargin+','+io.thresholds.join(',')",
2575            "true,10px,0.5",
2576        ),
2577        (
2578            "var io=new IntersectionObserver(()=>{}, {threshold:[0,0.25,1]}); io.thresholds.join(',')",
2579            "0,0.25,1",
2580        ),
2581        (
2582            "var io=new IntersectionObserver(()=>{}, {rootMargin:'-5px 10px'}); io.rootMargin",
2583            "-5px 10px",
2584        ),
2585        (
2586            "var io=new IntersectionObserver(()=>{}); typeof io.unobserve === 'function' && typeof io.disconnect === 'function'",
2587            "true",
2588        ),
2589        (
2590            "var r=null; var io=new IntersectionObserver(entries => { r=entries[0].intersectionRatio; }); io.observe(document.body); typeof r === 'number'",
2591            "true",
2592        ),
2593        // `ResizeObserverEntry.contentRect` が常に 0/0/0/0 固定だったバグと、
2594        // `borderBoxSize`/`contentBoxSize`(丸ごと未対応だった)を修正・追加。
2595        // 2026-07-16 発見・実装。
2596        (
2597            "var e=null; var ro=new ResizeObserver(entries => { e=entries[0]; }); \
2598             ro.observe(document.createElement('div')); \
2599             typeof e.contentRect.width + ',' + \
2600             Array.isArray(e.borderBoxSize) + ',' + \
2601             typeof e.borderBoxSize[0].inlineSize + ',' + \
2602             Array.isArray(e.contentBoxSize) + ',' + \
2603             typeof e.contentBoxSize[0].blockSize",
2604            "number,true,number,true,number",
2605        ),
2606        // `ResizeObserverEntry.devicePixelContentBoxSize`が丸ごと未対応
2607        // だった(`borderBoxSize`/`contentBoxSize`のみ対応済みで漏れて
2608        // いた。2026-07-17 発見・実装。`devicePixelRatio`が常に`1.0`固定
2609        // のため数値上は`contentBoxSize`と同一になる簡略実装)。
2610        (
2611            "var e=null; var ro=new ResizeObserver(entries => { e=entries[0]; }); \
2612             ro.observe(document.createElement('div')); \
2613             Array.isArray(e.devicePixelContentBoxSize) + ',' + \
2614             typeof e.devicePixelContentBoxSize[0].inlineSize",
2615            "true,number",
2616        ),
2617        // window.matchMedia(max-width 判定)
2618        ("window.matchMedia('(max-width: 9999px)').matches", "true"),
2619        ("window.matchMedia('(max-width: 0px)').matches", "false"),
2620        ("window.matchMedia('(min-width: 1px)').matches", "true"),
2621        // `window.matchMedia()` が `max-width`/`min-width` しか判定できず、CSS 側の
2622        // `@media` 評価(`prefers-color-scheme` 等)と食い違う非対称なバグだった。
2623        // 同じ判定ロジックへ統一した後の確認(既定は light テーマ)。
2624        ("window.matchMedia('(prefers-color-scheme: light)').matches", "true"),
2625        ("window.matchMedia('(prefers-color-scheme: dark)').matches", "false"),
2626        // window.scrollY / scrollTo
2627        ("typeof scrollY", "number"),
2628        ("scrollTo({top:100}); scrollY", "0"),
2629        // window.addEventListener load → 即時コールバック
2630        ("var loaded=false; window.addEventListener('load', () => { loaded=true; }); loaded", "true"),
2631        // `document.addEventListener('DOMContentLoaded', fn)` が丸ごと no-op だった
2632        // バグ(`window` 版は既に即時発火していたが `document` 側の配線が漏れていた)。
2633        // `window` 版よりもむしろよく使われる定番パターン。
2634        (
2635            "var ready=false; document.addEventListener('DOMContentLoaded', () => { ready=true; }); ready",
2636            "true",
2637        ),
2638        // `input.checked`(チェックボックス/ラジオボタンの選択状態)が JS プロパティとして
2639        // 丸ごと未実装で、`checkbox.checked`/`checkbox.checked = true` が常に
2640        // `undefined`/黙殺になっていた。
2641        (
2642            "var c=document.createElement('input'); c.type='checkbox'; c.checked",
2643            "false",
2644        ),
2645        (
2646            "var c=document.createElement('input'); c.type='checkbox'; c.checked=true; c.checked",
2647            "true",
2648        ),
2649        (
2650            "var c=document.createElement('input'); c.type='checkbox'; c.checked=true; c.checked=false; c.checked",
2651            "false",
2652        ),
2653        // `input.files`(`<input type="file">`のFileList。丸ごと未対応
2654        // だった。2026-07-17 発見・実装。実際のファイルピッカーUIが無い
2655        // ため常に空配列を返す誠実な簡略実装)。
2656        (
2657            "var f=document.createElement('input'); f.type='file'; f.files.length",
2658            "0",
2659        ),
2660        (
2661            "var f=document.createElement('input'); f.type='text'; f.files",
2662            "undefined",
2663        ),
2664        // `input[type=file].value`はセキュリティ上重要な仕様(`value`content
2665        // 属性は常に無視/未反映で、選択済みファイルが無ければ常に空文字列を
2666        // 返すべき)だが、以前は汎用の属性直結フォールバックに落ちており、
2667        // `<input type="file" value="...">`の属性値がそのまま漏れる
2668        // 静かなバグだった。
2669        (
2670            "var f=document.createElement('input'); f.type='file'; \
2671             f.setAttribute('value','c:\\\\secret.txt'); f.value",
2672            "",
2673        ),
2674        (
2675            "var f=document.createElement('input'); f.type='file'; f.value='x'; f.value",
2676            "",
2677        ),
2678        // `a`/`area`要素のURL分解プロパティ(`URLUtils`ミックスイン。
2679        // `.protocol`/`.host`/`.hostname`/`.port`/`.pathname`/`.search`/
2680        // `.hash`/`.origin`)が丸ごと未対応だった(`location`/`URL`は
2681        // 既に対応済みだったが`<a>`側への配線漏れ。2026-07-17 発見・実装)。
2682        (
2683            "var a=document.createElement('a'); a.href='https://sub.example.org:8080/x/y?z=1#top'; \
2684             [a.protocol,a.host,a.hostname,a.port,a.pathname,a.search,a.hash,a.origin].join('|')",
2685            "https:|sub.example.org:8080|sub.example.org|8080|/x/y|?z=1|#top|https://sub.example.org:8080",
2686        ),
2687        (
2688            "var a=document.createElement('area'); a.href='http://x.com/'; a.protocol",
2689            "http:",
2690        ),
2691        // `checkbox.indeterminate`(不確定表示状態。HTML 属性としては反映されない
2692        // JS 専用プロパティ)が丸ごと未対応だった。
2693        (
2694            "var c=document.createElement('input'); c.type='checkbox'; c.indeterminate",
2695            "false",
2696        ),
2697        (
2698            "var c=document.createElement('input'); c.type='checkbox'; c.indeterminate=true; c.indeterminate",
2699            "true",
2700        ),
2701        (
2702            "var c=document.createElement('input'); c.type='checkbox'; c.indeterminate=true; c.hasAttribute('indeterminate')",
2703            "false",
2704        ),
2705        // `input`/`textarea.selectionStart`/`.selectionEnd`/
2706        // `.selectionDirection`/`textarea.textLength`(丸ごと未対応
2707        // だった。2026-07-17 発見・実装。実際のキャレット機構が無いため
2708        // 状態追跡のみの簡略実装。未設定時は仕様どおり`0`/`"none"`)。
2709        (
2710            "var i=document.createElement('input'); i.selectionStart + ',' + i.selectionEnd + ',' + i.selectionDirection",
2711            "0,0,none",
2712        ),
2713        (
2714            "var i=document.createElement('input'); i.selectionStart=2; i.selectionEnd=5; i.selectionDirection='forward'; \
2715             i.selectionStart + ',' + i.selectionEnd + ',' + i.selectionDirection",
2716            "2,5,forward",
2717        ),
2718        (
2719            "var t=document.createElement('textarea'); t.value='hello'; t.textLength",
2720            "5",
2721        ),
2722        // `setSelectionRange`/`setRangeText`(丸ごと未対応だった。
2723        // `selectionStart`等と対になる操作メソッド。2026-07-17 発見・
2724        // 実装)。
2725        (
2726            "var i=document.createElement('input'); i.setSelectionRange(1,3,'forward'); \
2727             i.selectionStart + ',' + i.selectionEnd + ',' + i.selectionDirection",
2728            "1,3,forward",
2729        ),
2730        (
2731            "var i=document.createElement('input'); i.value='hello world'; \
2732             i.setRangeText('there', 6, 11); i.value",
2733            "hello there",
2734        ),
2735        (
2736            "var i=document.createElement('input'); i.value='hello world'; \
2737             i.setRangeText('there', 6, 11, 'select'); \
2738             i.value + '|' + i.selectionStart + ',' + i.selectionEnd",
2739            "hello there|6,11",
2740        ),
2741        (
2742            "var i=document.createElement('input'); i.value='hello world'; \
2743             i.selectionStart=0; i.selectionEnd=5; i.setRangeText('hi'); i.value",
2744            "hi world",
2745        ),
2746        // `checkbox.click()` は仕様上、リスナ実行前に自身の `checked` を切り替える。
2747        (
2748            "var c=document.createElement('input'); c.type='checkbox'; c.click(); c.checked",
2749            "true",
2750        ),
2751        (
2752            "var c=document.createElement('input'); c.type='checkbox'; c.click(); c.click(); c.checked",
2753            "false",
2754        ),
2755        (
2756            "var r=document.createElement('input'); r.type='radio'; r.click(); r.checked",
2757            "true",
2758        ),
2759        // `node.ownerDocument`(`element.ownerDocument.createElement(...)` という
2760        // 定番イディオムで使われる)が丸ごと未対応だった。
2761        (
2762            "document.createElement('div').ownerDocument === document",
2763            "true",
2764        ),
2765        (
2766            "typeof document.createElement('div').ownerDocument.createElement",
2767            "function",
2768        ),
2769        // **重要**: ラジオボタンの最も基本的な仕様上の挙動(同じ `name` を持つグループ内で
2770        // 1つだけが `checked` になる排他選択)が以前は非対応の簡略化として明示的に
2771        // 見送られていた。`element.click()` と `.checked = true` 代入の両方で効くこと。
2772        (
2773            "var r1=document.createElement('input'); r1.type='radio'; r1.name='g'; \
2774             var r2=document.createElement('input'); r2.type='radio'; r2.name='g'; \
2775             r1.click(); r2.click(); r1.checked + ',' + r2.checked",
2776            "false,true",
2777        ),
2778        (
2779            "var r1=document.createElement('input'); r1.type='radio'; r1.name='g2'; \
2780             var r2=document.createElement('input'); r2.type='radio'; r2.name='g2'; \
2781             r1.checked=true; r2.checked=true; r1.checked + ',' + r2.checked",
2782            "false,true",
2783        ),
2784        // 異なる `name` を持つ radio 同士は互いに影響しない。
2785        (
2786            "var r1=document.createElement('input'); r1.type='radio'; r1.name='ga'; \
2787             var r2=document.createElement('input'); r2.type='radio'; r2.name='gb'; \
2788             r1.click(); r2.click(); r1.checked + ',' + r2.checked",
2789            "true,true",
2790        ),
2791        // `input.disabled`/`option.selected`/`input.placeholder`/`input.name` も
2792        // `checked`/`type` と同じ理由で JS プロパティとして丸ごと未実装だった。
2793        (
2794            "var b=document.createElement('button'); b.disabled=true; b.disabled",
2795            "true",
2796        ),
2797        (
2798            "var b=document.createElement('button'); b.disabled=true; b.disabled=false; b.disabled",
2799            "false",
2800        ),
2801        (
2802            "var o=document.createElement('option'); o.selected=true; o.selected",
2803            "true",
2804        ),
2805        // `option.text`(`textContent` の別名。`new Option(...)`/`option.text = '...'`
2806        // という定番パターン)が丸ごと未対応だった。
2807        (
2808            "var o=document.createElement('option'); o.text='Label'; o.text",
2809            "Label",
2810        ),
2811        (
2812            "var o=document.createElement('option'); o.text='Label'; o.textContent",
2813            "Label",
2814        ),
2815        // `option`/`optgroup.label`(丸ごと未対応だった。`option.label`は
2816        // 仕様上`label`属性が無ければテキスト内容にフォールバックする。
2817        // 2026-07-17 発見・実装)。
2818        (
2819            "var o=document.createElement('option'); o.textContent='hi'; o.label",
2820            "hi",
2821        ),
2822        (
2823            "var o=document.createElement('option'); o.textContent='hi'; o.label='explicit'; o.label",
2824            "explicit",
2825        ),
2826        (
2827            "var g=document.createElement('optgroup'); g.textContent='hi'; g.label",
2828            "",
2829        ),
2830        (
2831            "var g=document.createElement('optgroup'); g.label='Group A'; g.label",
2832            "Group A",
2833        ),
2834        // `input.required`/`input.readOnly`/`input.multiple`/`img.src`/`img.alt`/
2835        // `a.href` も同じ理由で JS プロパティとして丸ごと未実装だった。
2836        (
2837            "var i=document.createElement('input'); i.required=true; i.required",
2838            "true",
2839        ),
2840        (
2841            "var i=document.createElement('input'); i.readOnly=true; i.readOnly",
2842            "true",
2843        ),
2844        (
2845            "var s=document.createElement('select'); s.multiple=true; s.multiple",
2846            "true",
2847        ),
2848        (
2849            "var img=document.createElement('img'); img.src='a.png'; img.alt='pic'; img.src+','+img.alt",
2850            "a.png,pic",
2851        ),
2852        (
2853            "var a=document.createElement('a'); a.href='/x'; a.href",
2854            "/x",
2855        ),
2856        // `label.htmlFor`/`form.action`/`form.method`/`input.min`/`max`/`step`/
2857        // `maxLength`/`a.target`/`rel`/`download` も同種の未実装だった。
2858        (
2859            "var l=document.createElement('label'); l.htmlFor='name'; l.htmlFor",
2860            "name",
2861        ),
2862        (
2863            "var f=document.createElement('form'); f.action='/submit'; f.method='post'; f.action+','+f.method",
2864            "/submit,post",
2865        ),
2866        // `form.method`(`method`属性が無いか既知の列挙値以外なら既定
2867        // `"get"`にフォールバックする。`fieldset.type`等と同じバグ
2868        // パターンで丸ごと未対応だった。2026-07-17 発見・実装)。
2869        ("document.createElement('form').method", "get"),
2870        (
2871            "var f=document.createElement('form'); f.setAttribute('method','DIALOG'); f.method",
2872            "dialog",
2873        ),
2874        (
2875            "var f=document.createElement('form'); f.setAttribute('method','bogus'); f.method",
2876            "get",
2877        ),
2878        // `form.enctype`/`.encoding`(丸ごと未対応だった。`encoding`は
2879        // `enctype`のレガシー別名で同じ属性を指す。既知の列挙値3種以外
2880        // なら既定`"application/x-www-form-urlencoded"`にフォールバック
2881        // する。2026-07-17 発見・実装)。
2882        (
2883            "document.createElement('form').enctype",
2884            "application/x-www-form-urlencoded",
2885        ),
2886        (
2887            "var f=document.createElement('form'); f.enctype='multipart/form-data'; f.enctype+','+f.encoding",
2888            "multipart/form-data,multipart/form-data",
2889        ),
2890        (
2891            "var f=document.createElement('form'); f.encoding='text/plain'; f.enctype",
2892            "text/plain",
2893        ),
2894        // `form.acceptCharset`(`accept-charset`属性のcamelCase IDL
2895        // プロパティ版。`htmlFor`と同じパターンだが丸ごと未対応だった。
2896        // 2026-07-17 発見・実装)。
2897        (
2898            "var f=document.createElement('form'); f.acceptCharset='UTF-8'; f.getAttribute('accept-charset')",
2899            "UTF-8",
2900        ),
2901        (
2902            "var f=document.createElement('form'); f.setAttribute('accept-charset','UTF-8'); f.acceptCharset",
2903            "UTF-8",
2904        ),
2905        // `button`/`input`の「送信オーバーライド」IDLプロパティ(`formAction`/
2906        // `formEnctype`/`formMethod`/`formNoValidate`/`formTarget`)が丸ごと
2907        // 未対応だった。`form.action`/`.method`/`.enctype`と同じ既定値
2908        // フォールバックパターンを踏襲する。2026-07-17 発見・実装)。
2909        (
2910            "var b=document.createElement('button'); b.formAction='/x'; b.getAttribute('formaction')",
2911            "/x",
2912        ),
2913        (
2914            "document.createElement('input').formEnctype",
2915            "application/x-www-form-urlencoded",
2916        ),
2917        (
2918            "var b=document.createElement('button'); b.formEnctype='multipart/form-data'; b.formEnctype",
2919            "multipart/form-data",
2920        ),
2921        ("document.createElement('button').formMethod", "get"),
2922        (
2923            "var i=document.createElement('input'); i.formMethod='post'; i.formMethod",
2924            "post",
2925        ),
2926        (
2927            "document.createElement('button').formNoValidate",
2928            "false",
2929        ),
2930        (
2931            "var b=document.createElement('button'); b.formNoValidate=true; b.getAttribute('formnovalidate')",
2932            "formnovalidate",
2933        ),
2934        (
2935            "var i=document.createElement('input'); i.formTarget='_blank'; i.formTarget",
2936            "_blank",
2937        ),
2938        (
2939            "var i=document.createElement('input'); i.defaultValue='hello'; i.defaultValue+','+i.getAttribute('value')",
2940            "hello,hello",
2941        ),
2942        (
2943            "var i=document.createElement('input'); i.defaultChecked=true; i.defaultChecked+','+i.hasAttribute('checked')",
2944            "true,true",
2945        ),
2946        (
2947            "var o=document.createElement('option'); o.defaultSelected=true; o.defaultSelected+','+o.hasAttribute('selected')",
2948            "true,true",
2949        ),
2950        // `img.loading`/`.decoding`(既知の列挙値以外なら仕様上の既定値
2951        // `"auto"`にフォールバックする必要があるが、`fieldset.type`等と
2952        // 同じバグパターンで空文字列になっていた。2026-07-17 発見・実装)。
2953        ("document.createElement('img').loading", "auto"),
2954        (
2955            "var i=document.createElement('img'); i.loading='lazy'; i.loading",
2956            "lazy",
2957        ),
2958        (
2959            "var i=document.createElement('img'); i.setAttribute('loading','bogus'); i.loading",
2960            "auto",
2961        ),
2962        ("document.createElement('img').decoding", "auto"),
2963        (
2964            "var i=document.createElement('img'); i.decoding='sync'; i.decoding",
2965            "sync",
2966        ),
2967        (
2968            "var i=document.createElement('img'); i.setAttribute('decoding','bogus'); i.decoding",
2969            "auto",
2970        ),
2971        // `audio`/`video.preload`(欠落時既定値`"metadata"`、不正値既定値
2972        // `"auto"`。`fieldset.type`等と同じバグパターンで空文字列になって
2973        // いた。2026-07-17 発見・実装)。
2974        ("document.createElement('audio').preload", "metadata"),
2975        (
2976            "var v=document.createElement('video'); v.preload='none'; v.preload",
2977            "none",
2978        ),
2979        (
2980            "var v=document.createElement('video'); v.setAttribute('preload','bogus'); v.preload",
2981            "auto",
2982        ),
2983        // `textarea.wrap`(`"soft"`/`"hard"`。既知値以外・欠落時は仕様上の
2984        // 既定値`"soft"`にフォールバックする必要があるが、丸ごと未対応
2985        // だった。2026-07-17 発見・実装)。
2986        ("document.createElement('textarea').wrap", "soft"),
2987        (
2988            "var t=document.createElement('textarea'); t.wrap='hard'; t.wrap",
2989            "hard",
2990        ),
2991        (
2992            "var t=document.createElement('textarea'); t.setAttribute('wrap','bogus'); t.wrap",
2993            "soft",
2994        ),
2995        // `track.kind`(欠落時既定`"subtitles"`/不正値既定`"metadata"`の
2996        // 2段階フォールバック。プロパティ自体が丸ごと未対応だった。
2997        // 2026-07-17 発見・実装)。
2998        ("document.createElement('track').kind", "subtitles"),
2999        (
3000            "var t=document.createElement('track'); t.kind='captions'; t.kind",
3001            "captions",
3002        ),
3003        (
3004            "var t=document.createElement('track'); t.setAttribute('kind','bogus'); t.kind",
3005            "metadata",
3006        ),
3007        // `track.label`/`.srclang`(単純な文字列反映)と`track.default`
3008        // (ブール型)が丸ごと未対応だった。あわせて`option`/`optgroup`/
3009        // `track`共通の`label`セッターが丸ごと存在しなかった重複バグも
3010        // 解消。2026-07-18 発見・実装)。
3011        (
3012            "var t=document.createElement('track'); t.label='English'; t.getAttribute('label')",
3013            "English",
3014        ),
3015        (
3016            "var t=document.createElement('track'); t.srclang='en'; t.srclang",
3017            "en",
3018        ),
3019        ("document.createElement('track').default", "false"),
3020        (
3021            "var t=document.createElement('track'); t.default=true; t.getAttribute('default')",
3022            "default",
3023        ),
3024        // `link.as`(`rel="preload"`/`"prefetch"`の取得先種別ヒント。単純な
3025        // 文字列反映だが丸ごと未対応だった。2026-07-18 発見・実装)。
3026        (
3027            "var l=document.createElement('link'); l.as='script'; l.getAttribute('as')",
3028            "script",
3029        ),
3030        (
3031            "var l=document.createElement('link'); l.setAttribute('as','style'); l.as",
3032            "style",
3033        ),
3034        // `video.videoWidth`/`.videoHeight`(実デコードパイプラインが
3035        // 無いため常に`0`)と`audio`/`video.seeking`(実際の非同期シーク
3036        // 処理が無いため常に`false`)が丸ごと未対応だった。2026-07-18
3037        // 発見・実装)。
3038        (
3039            "document.createElement('video').videoWidth+','+document.createElement('video').videoHeight",
3040            "0,0",
3041        ),
3042        ("document.createElement('video').seeking", "false"),
3043        ("document.createElement('audio').seeking", "false"),
3044        // `select.size`(欠落・不正値時の既定値`0`)と`input.size`(欠落・
3045        // 不正値時の既定値`20`)が丸ごと未対応だった。2026-07-18 発見・
3046        // 実装)。
3047        ("document.createElement('select').size", "0"),
3048        (
3049            "var s=document.createElement('select'); s.size=5; s.size",
3050            "5",
3051        ),
3052        ("document.createElement('input').size", "20"),
3053        (
3054            "var i=document.createElement('input'); i.size=10; i.size",
3055            "10",
3056        ),
3057        (
3058            "var i=document.createElement('input'); i.setAttribute('size','0'); i.size",
3059            "20",
3060        ),
3061        // `textarea.rows`/`.cols`(欠落・不正値時の既定値`2`/`20`)が
3062        // 丸ごと未対応だった。2026-07-18 発見・実装)。
3063        ("document.createElement('textarea').rows", "2"),
3064        (
3065            "var t=document.createElement('textarea'); t.rows=8; t.rows",
3066            "8",
3067        ),
3068        ("document.createElement('textarea').cols", "20"),
3069        (
3070            "var t=document.createElement('textarea'); t.cols=40; t.cols",
3071            "40",
3072        ),
3073        (
3074            "var t=document.createElement('textarea'); t.setAttribute('rows','0'); t.rows",
3075            "2",
3076        ),
3077        // `dialog.requestClose(returnValue?)`(`.close()`と違い、閉じる
3078        // 直前に取消可能な`cancel`イベントを発火する。丸ごと未対応
3079        // だった。2026-07-18 発見・実装)。
3080        (
3081            "var d=document.createElement('dialog'); d.open=true; d.requestClose('x'); \
3082             d.open+','+d.returnValue",
3083            "false,x",
3084        ),
3085        (
3086            "var d=document.createElement('dialog'); d.open=true; \
3087             d.addEventListener('cancel', e=>e.preventDefault()); d.requestClose(); d.open",
3088            "true",
3089        ),
3090        (
3091            "var d=document.createElement('dialog'); d.open=true; var fired=false; \
3092             d.addEventListener('close', ()=>fired=true); d.requestClose(); fired",
3093            "true",
3094        ),
3095        // `progress.position`(廃止予定だが仕様に残る読み取り専用IDL。
3096        // `value`未設定なら不確定状態`-1`、それ以外は`value/max`。丸ごと
3097        // 未対応だった。2026-07-18 発見・実装)。
3098        ("document.createElement('progress').position", "-1"),
3099        (
3100            "var p=document.createElement('progress'); p.max=10; p.value=5; p.position",
3101            "0.5",
3102        ),
3103        (
3104            "var p=document.createElement('progress'); p.value=1; p.position",
3105            "1",
3106        ),
3107        // `output.htmlFor`(`for`属性を空白区切りトークンとして扱う
3108        // `DOMTokenList`。`label.htmlFor`(単一文字列)とは異なる意味。
3109        // `relList`/`sandbox`と同じ読み取り専用トークン配列の簡略実装。
3110        // 丸ごと未対応だった。2026-07-18 発見・実装)。
3111        (
3112            "var o=document.createElement('output'); o.htmlFor='a b c'; \
3113             o.htmlFor.length+','+o.htmlFor[1]",
3114            "3,b",
3115        ),
3116        (
3117            "var o=document.createElement('output'); o.setAttribute('for','x y'); \
3118             Array.from(o.htmlFor).join(',')",
3119            "x,y",
3120        ),
3121        ("document.createElement('output').htmlFor.length", "0"),
3122        // `input[type=checkbox/radio].value`(`value`属性が無い場合の仕様上
3123        // の既定値は`""`ではなく`"on"`。フォーム送信ロジック
3124        // 〔`collect_form_data`〕は既に正しくこの既定値を使っていたが、
3125        // JSプロパティの`.value`読み出し側だけ空文字列になる不整合が
3126        // あった。2026-07-18 発見・実装)。
3127        (
3128            "var c=document.createElement('input'); c.type='checkbox'; c.value",
3129            "on",
3130        ),
3131        (
3132            "var r=document.createElement('input'); r.type='radio'; r.value",
3133            "on",
3134        ),
3135        (
3136            "var c=document.createElement('input'); c.type='checkbox'; c.value='yes'; c.value",
3137            "yes",
3138        ),
3139        (
3140            "document.createElement('input').value",
3141            "",
3142        ),
3143        // `input[type=color].value`(`value`属性が無いか7文字の`#rrggbb`
3144        // 小文字16進形式でない不正値の場合の既定値は`"#000000"`。
3145        // `checkbox`/`radio`の`"on"`と同じバグパターンで空文字列に
3146        // なっていた。2026-07-18 発見・実装)。
3147        (
3148            "var c=document.createElement('input'); c.type='color'; c.value",
3149            "#000000",
3150        ),
3151        (
3152            "var c=document.createElement('input'); c.type='color'; c.value='#ff00aa'; c.value",
3153            "#ff00aa",
3154        ),
3155        // `input[type=color].value = v`の書き込み側sanitizationが丸ごと
3156        // 未対応だった。ゲッター側は「既に小文字16進形式か」しか見ておらず、
3157        // セッター側で大文字→小文字への正規化が行われていなかったため、
3158        // 仕様上は妥当な色(大文字16進)である`'#FF00AA'`を代入しても
3159        // 小文字化されずゲッターの検証に弾かれ`#000000`になってしまう
3160        // 食い違いがあった(2026-07-18 発見・修正)。
3161        (
3162            "var c=document.createElement('input'); c.type='color'; c.value='#FF00AA'; c.value",
3163            "#ff00aa",
3164        ),
3165        (
3166            // 16進形式として無効な値(色名等)は仕様どおり`#000000`へ正規化される。
3167            "var c=document.createElement('input'); c.type='color'; c.value='red'; c.value",
3168            "#000000",
3169        ),
3170        // `input[type=range].value`(`value`属性が無いか不正値の場合の
3171        // 既定値は`min`と`max`の中点。`min`/`max`省略時は既定`0`/`100`
3172        // のため無指定時は`50`。`checkbox`/`color`と同じバグパターンで
3173        // 空文字列になっていた。2026-07-18 発見・実装)。
3174        (
3175            "var r=document.createElement('input'); r.type='range'; r.value",
3176            "50",
3177        ),
3178        (
3179            "var r=document.createElement('input'); r.type='range'; r.min='0'; r.max='10'; r.value",
3180            "5",
3181        ),
3182        (
3183            "var r=document.createElement('input'); r.type='range'; r.value='7'; r.value",
3184            "7",
3185        ),
3186        (
3187            "var r=document.createElement('input'); r.type='range'; r.min='5'; r.max='2'; r.value",
3188            "5",
3189        ),
3190        // `input[type=range].value`の仕様上のvalue sanitization algorithmは
3191        // 数値変換できない不正値の既定値フォールバックだけでなく`min`/`max`
3192        // へのクランプも含むが、パース自体には成功する範囲外の値
3193        // (`max=10`で`value=999`等)はクランプされずそのまま漏れていた。
3194        (
3195            "var r=document.createElement('input'); r.type='range'; r.min='0'; r.max='10'; r.value='999'; r.value",
3196            "10",
3197        ),
3198        (
3199            "var r=document.createElement('input'); r.type='range'; r.min='0'; r.max='10'; r.value='-5'; r.value",
3200            "0",
3201        ),
3202        (
3203            // `setAttribute`経由(IDLセッターを介さない直接の属性書き込み)でも
3204            // 同じくクランプされる。
3205            "var r=document.createElement('input'); r.type='range'; r.min='0'; r.max='10'; \
3206             r.setAttribute('value','999'); r.value",
3207            "10",
3208        ),
3209        // `table.tHead`/`.tFoot`/`.caption`のセッター(読み出し側は既に
3210        // 実装済みだったが、対になる書き込み側が丸ごと未対応だった。
3211        // 代入すると既存の同名セクションを除去し、新しい要素を正しい
3212        // 位置へ挿入する。2026-07-18 発見・実装)。
3213        (
3214            "var t=document.createElement('table'); var h=document.createElement('thead'); \
3215             t.tHead=h; t.tHead===h",
3216            "true",
3217        ),
3218        (
3219            "var t=document.createElement('table'); var h1=document.createElement('thead'); \
3220             var h2=document.createElement('thead'); t.tHead=h1; t.tHead=h2; \
3221             (t.tHead===h2)+','+t.children.length",
3222            "true,1",
3223        ),
3224        (
3225            "var t=document.createElement('table'); var h=document.createElement('thead'); \
3226             t.tHead=h; t.tHead=null; t.tHead",
3227            "null",
3228        ),
3229        (
3230            "var t=document.createElement('table'); var c=document.createElement('caption'); \
3231             var b=document.createElement('tbody'); t.appendChild(b); t.caption=c; \
3232             t.firstChild===c",
3233            "true",
3234        ),
3235        // `select.add(element, before)`(`select.options.add`と同じ意味の
3236        // 便利メソッド。丸ごと未対応だった。2026-07-18 発見・実装)。
3237        (
3238            "var s=document.createElement('select'); var o=document.createElement('option'); \
3239             s.add(o); s.options.length+','+(s.options[0]===o)",
3240            "1,true",
3241        ),
3242        (
3243            "var s=document.createElement('select'); var o1=document.createElement('option'); \
3244             var o2=document.createElement('option'); s.add(o1); s.add(o2, o1); \
3245             s.options[0]===o2",
3246            "true",
3247        ),
3248        // `audio`/`video.played`(`TimeRanges`。`buffered`/`.seekable`と
3249        // 同じ理由で常に空。丸ごと未対応だった。2026-07-18 発見・実装)。
3250        ("document.createElement('video').played.length", "0"),
3251        ("document.createElement('audio').played.length", "0"),
3252        // `element.role`/`.ariaLabel`等(`ARIAMixin`。`role`/`aria-*`属性の
3253        // IDLプロパティ版)が丸ごと未対応だった。`aria`接頭辞後の
3254        // PascalCase部分を全て小文字化して`aria-`と連結する命名規則を
3255        // 汎用アームで一括対応。2026-07-18 発見・実装)。
3256        (
3257            "var d=document.createElement('div'); d.role='button'; d.getAttribute('role')",
3258            "button",
3259        ),
3260        (
3261            "var d=document.createElement('div'); d.setAttribute('role','tab'); d.role",
3262            "tab",
3263        ),
3264        (
3265            "var d=document.createElement('div'); d.ariaLabel='close'; d.getAttribute('aria-label')",
3266            "close",
3267        ),
3268        (
3269            "var d=document.createElement('div'); d.setAttribute('aria-hidden','true'); d.ariaHidden",
3270            "true",
3271        ),
3272        (
3273            "var d=document.createElement('div'); d.ariaValueNow='5'; d.getAttribute('aria-valuenow')",
3274            "5",
3275        ),
3276        (
3277            "var d=document.createElement('div'); d.ariaLabel='x'; d.ariaLabel=null; \
3278             d.getAttribute('aria-label')",
3279            "null",
3280        ),
3281        ("document.createElement('div').ariaLabel", "null"),
3282        // `element.outerText`(読み出しは`innerText`と同じだが、書き込みは
3283        // 自身の中身ではなく自身「そのもの」をテキストノードへ置き換える
3284        // 点が違う。丸ごと未対応だった。2026-07-18 発見・実装)。
3285        (
3286            "var d=document.createElement('div'); d.textContent='hi'; d.outerText",
3287            "hi",
3288        ),
3289        (
3290            "var p=document.createElement('div'); var c=document.createElement('span'); \
3291             c.textContent='x'; p.appendChild(c); c.outerText='y'; p.textContent",
3292            "y",
3293        ),
3294        (
3295            "var p=document.createElement('div'); var c=document.createElement('span'); \
3296             p.appendChild(c); c.outerText='z'; p.children.length",
3297            "0",
3298        ),
3299        // `element.part`(CSS Shadow Parts。`relList`/`sandbox`と同じ
3300        // 読み取り専用トークン配列の簡略実装。丸ごと未対応だった。
3301        // 2026-07-18 発見・実装)。
3302        (
3303            "var d=document.createElement('div'); d.setAttribute('part','a b'); \
3304             d.part.length+','+d.part[1]",
3305            "2,b",
3306        ),
3307        ("document.createElement('div').part.length", "0"),
3308        // `link.sizes`は`img`/`source.sizes`(単純なDOMString)とは異なり
3309        // 仕様上`DOMTokenList`。`part`/`relList`と同じ読み取り専用トークン
3310        // 配列の簡略実装で区別する。以前は同名の文字列反映アームに
3311        // 一括で落ちて型が誤っていた。2026-07-18 発見・実装)。
3312        (
3313            "var l=document.createElement('link'); l.setAttribute('sizes','16x16 32x32'); \
3314             l.sizes.length+','+l.sizes[1]",
3315            "2,32x32",
3316        ),
3317        (
3318            "var i=document.createElement('img'); i.sizes='(min-width: 600px) 50vw, 100vw'; i.sizes",
3319            "(min-width: 600px) 50vw, 100vw",
3320        ),
3321        // `input.accept`(`type="file"`が許可するファイル種別フィルタ。
3322        // 単純な文字列反映だが丸ごと未対応だった。2026-07-18 発見・実装)。
3323        (
3324            "var i=document.createElement('input'); i.accept='image/*'; i.getAttribute('accept')",
3325            "image/*",
3326        ),
3327        (
3328            "var i=document.createElement('input'); i.setAttribute('accept','.pdf,.doc'); i.accept",
3329            ".pdf,.doc",
3330        ),
3331        // `script.charset`(廃止予定だが仕様に残る単純な文字列反映。
3332        // ゲッターが`meta`タグ限定のままで他タグでは未対応だった。
3333        // 2026-07-18 発見・実装)。
3334        (
3335            "var s=document.createElement('script'); s.charset='utf-8'; s.getAttribute('charset')",
3336            "utf-8",
3337        ),
3338        (
3339            "var s=document.createElement('script'); s.setAttribute('charset','shift-jis'); s.charset",
3340            "shift-jis",
3341        ),
3342        // `a`/`area.protocol`/`.host`/`.hostname`/`.port`/`.pathname`/
3343        // `.search`/`.hash`のセッター(`URLUtils`ミックスイン。ゲッターは
3344        // 既に実装済みだったが対になるセッターが丸ごと未対応だった。
3345        // 2026-07-18 発見・実装)。
3346        (
3347            "var a=document.createElement('a'); a.href='https://x.com/p'; a.hostname='y.com'; a.href",
3348            "https://y.com/p",
3349        ),
3350        (
3351            "var a=document.createElement('a'); a.href='https://x.com/p'; a.protocol='http'; a.protocol",
3352            "http:",
3353        ),
3354        (
3355            "var a=document.createElement('a'); a.href='https://x.com/p'; a.pathname='q'; a.pathname",
3356            "/q",
3357        ),
3358        (
3359            "var a=document.createElement('a'); a.href='https://x.com/p'; a.search='x=1'; a.search",
3360            "?x=1",
3361        ),
3362        (
3363            "var a=document.createElement('a'); a.href='https://x.com/p'; a.hash='frag'; a.hash",
3364            "#frag",
3365        ),
3366        (
3367            "var a=document.createElement('a'); a.href='https://x.com:80/p'; a.host='y.com:90'; \
3368             a.hostname+','+a.port",
3369            "y.com,90",
3370        ),
3371        (
3372            "var a=document.createElement('a'); a.href='https://x.com/p'; a.username='u'; \
3373             a.password='pw'; a.href",
3374            "https://u:pw@x.com/p",
3375        ),
3376        // `element.willValidate`がタグを一切見ておらず、`<output>`/`<div>`
3377        // のような本来常に`false`であるべき非フォームコントロールでも
3378        // `true`を返してしまうバグだった。2026-07-18 発見・修正)。
3379        ("document.createElement('output').willValidate", "false"),
3380        ("document.createElement('div').willValidate", "false"),
3381        ("document.createElement('fieldset').willValidate", "false"),
3382        ("document.createElement('input').willValidate", "true"),
3383        (
3384            "var b=document.createElement('button'); b.disabled=true; b.willValidate",
3385            "false",
3386        ),
3387        // `validity_flags`(`.validity`が内部で使う共通ロジック)が
3388        // `willValidate`と同根の「タグを見ない」バグを持っていた。
3389        // `<output required>`のような本来検証対象外の要素へ`required`
3390        // 属性を付けても`valueMissing`が立たないことを確認。2026-07-18
3391        // 発見・修正)。
3392        (
3393            "var o=document.createElement('output'); o.setAttribute('required','required'); \
3394             o.validity.valid",
3395            "true",
3396        ),
3397        (
3398            "var d=document.createElement('div'); d.setAttribute('required','required'); \
3399             d.validity.valueMissing",
3400            "false",
3401        ),
3402        (
3403            "var i=document.createElement('input'); i.setAttribute('required','required'); \
3404             i.validity.valueMissing",
3405            "true",
3406        ),
3407        // `validate_field`(`element.checkValidity()`が直接呼ぶ経路)も
3408        // 同根の「タグを見ない」バグを持っていた。`<output required>`へ
3409        // `checkValidity()`を直接呼んでも常に`true`のままであることを
3410        // 確認。`form.checkValidity()`側は既に`input`/`textarea`/
3411        // `select`へ絞り込み済みのため実害が無かった経路との違いに
3412        // 注意。2026-07-18 発見・修正)。
3413        (
3414            "var o=document.createElement('output'); o.setAttribute('required','required'); \
3415             o.checkValidity()",
3416            "true",
3417        ),
3418        (
3419            "var i=document.createElement('input'); i.setAttribute('required','required'); \
3420             i.checkValidity()",
3421            "false",
3422        ),
3423        // `video.disableRemotePlayback`(`disablePictureInPicture`と同じ
3424        // 単純なブール属性反映だが丸ごと未対応だった。2026-07-18
3425        // 発見・実装)。
3426        (
3427            "document.createElement('video').disableRemotePlayback",
3428            "false",
3429        ),
3430        (
3431            "var v=document.createElement('video'); v.disableRemotePlayback=true; \
3432             v.getAttribute('disableremoteplayback')",
3433            "disableremoteplayback",
3434        ),
3435        // `link`/`script.blocking`(`part`/`relList`/`sandbox`と同じ読み
3436        // 取り専用トークン配列。丸ごと未対応だった。2026-07-18 発見・
3437        // 実装)。
3438        (
3439            "var l=document.createElement('link'); l.setAttribute('blocking','render'); \
3440             l.blocking.length+','+l.blocking[0]",
3441            "1,render",
3442        ),
3443        ("document.createElement('script').blocking.length", "0"),
3444        // `output.value`/`.defaultValue`(`<output>`は`value`content属性を
3445        // 持たず、未書込み時は`.textContent`にフォールバックする。
3446        // `textarea.value`と同じパターンだが丸ごと未対応だった。
3447        // 2026-07-18 発見・実装)。
3448        (
3449            "var o=document.createElement('output'); o.textContent='42'; o.value",
3450            "42",
3451        ),
3452        (
3453            "var o=document.createElement('output'); o.textContent='42'; o.value='7'; o.value",
3454            "7",
3455        ),
3456        (
3457            "var o=document.createElement('output'); o.textContent='42'; o.value='7'; \
3458             o.textContent",
3459            "42",
3460        ),
3461        // `video.getVideoPlaybackQuality()`(丸ごと未対応だった。実
3462        // デコードパイプラインが無いため全カウンタ`0`の誠実な簡略実装。
3463        // 2026-07-18 発見・実装)。
3464        (
3465            "var q=document.createElement('video').getVideoPlaybackQuality(); \
3466             q.totalVideoFrames+','+q.droppedVideoFrames+','+q.corruptedVideoFrames",
3467            "0,0,0",
3468        ),
3469        // `element.namespaceURI`/`.localName`/`.prefix`(丸ごと未対応
3470        // だった。XML名前空間を一切モデル化していないため常にHTML
3471        // 名前空間定数/タグ名そのもの/`null`を返す誠実な簡略実装。
3472        // 2026-07-18 発見・実装)。
3473        (
3474            "document.createElement('div').namespaceURI",
3475            "http://www.w3.org/1999/xhtml",
3476        ),
3477        ("document.createElement('SPAN').localName", "span"),
3478        ("document.createElement('div').prefix", "null"),
3479        (
3480            "document.createTextNode('x').namespaceURI",
3481            "null",
3482        ),
3483        (
3484            "document.createTextNode('x').localName",
3485            "null",
3486        ),
3487        // `HTMLScriptElement.supports(type)`(静的メソッド。丸ごと未対応
3488        // だった。`classic`/`module`は実サポート済みで`true`、
3489        // `importmap`はインポートマップ自体が未実装のため`false`)。
3490        (
3491            "HTMLScriptElement.supports('classic')+','+HTMLScriptElement.supports('module')",
3492            "true,true",
3493        ),
3494        (
3495            "document.createElement('div').ariaActiveDescendantElement",
3496            "null",
3497        ),
3498        (
3499            "(function(){var a=document.createElement('div');a.setAttribute('aria-activedescendant','nope');return a.ariaActiveDescendantElement;})()",
3500            "null",
3501        ),
3502        // `element.getHTML()`/`.setHTMLUnsafe()`(`innerHTML`ゲッター/
3503        // セッターの明示的メソッド版。丸ごと未対応だった。この処理系には
3504        // Trusted Types自体が無いため`innerHTML`と可視的な違いは無い
3505        // 簡略実装。2026-07-18 発見・実装)。
3506        (
3507            "var d=document.createElement('div'); d.innerHTML='<b>x</b>'; d.getHTML()",
3508            "<b>x</b>",
3509        ),
3510        (
3511            "var d=document.createElement('div'); d.setHTMLUnsafe('<i>y</i>'); d.innerHTML",
3512            "<i>y</i>",
3513        ),
3514        // `CSS.number()`/`.percent()`/`.px()`/`.em()`/`.rem()`/`.deg()`
3515        // (CSS Typed OMの値+単位ファクトリ関数群。丸ごと未対応だった。
3516        // 2026-07-18 発見・実装)。
3517        ("CSS.px(5).value+','+CSS.px(5).unit+','+CSS.px(5).toString()", "5,px,5px"),
3518        ("CSS.percent(50).toString()", "50%"),
3519        ("CSS.number(3).toString()", "3"),
3520        ("CSS.em(1.5).toString()", "1.5em"),
3521        ("CSS.rem(2).toString()", "2rem"),
3522        ("CSS.deg(90).toString()", "90deg"),
3523        ("HTMLScriptElement.supports('importmap')", "false"),
3524        ("HTMLScriptElement.supports('bogus')", "false"),
3525        // `link.imageSrcset`/`.imageSizes`(`rel="preload" as="image"`用の
3526        // レスポンシブ画像プリロードヒント。`link.as`と同じ単純な文字列
3527        // 反映だが丸ごと未対応だった。2026-07-18 発見・実装)。
3528        (
3529            "(function(){var l=document.createElement('link');l.imageSrcset='a.jpg 1x, b.jpg 2x';l.imageSizes='100vw';return l.imageSrcset+'|'+l.imageSizes;})()",
3530            "a.jpg 1x, b.jpg 2x|100vw",
3531        ),
3532        (
3533            "document.createElement('link').imageSrcset+'|'+document.createElement('link').imageSizes",
3534            "|",
3535        ),
3536        // `iframe.credentialless`(COEP credentialless。`allowFullscreen`と
3537        // 同じ単純なブール属性反映だが丸ごと未対応だった。2026-07-18
3538        // 発見・実装)。
3539        (
3540            "(function(){var f=document.createElement('iframe');var before=f.credentialless;f.credentialless=true;var after=f.credentialless;f.credentialless=false;return before+','+after+','+f.credentialless;})()",
3541            "false,true,false",
3542        ),
3543        // `area.coords`/`.shape`(`shape`は既知値以外・欠落時は仕様上の
3544        // 既定値`"rect"`にフォールバックし、レガシー別名`"circ"`/
3545        // `"polygon"`も正規化する。プロパティ自体が丸ごと未対応だった。
3546        // 2026-07-17 発見・実装)。
3547        (
3548            "var a=document.createElement('area'); a.coords='0,0,10,10'; a.coords",
3549            "0,0,10,10",
3550        ),
3551        ("document.createElement('area').shape", "rect"),
3552        (
3553            "var a=document.createElement('area'); a.shape='circle'; a.shape",
3554            "circle",
3555        ),
3556        (
3557            "var a=document.createElement('area'); a.setAttribute('shape','circ'); a.shape",
3558            "circle",
3559        ),
3560        (
3561            "var a=document.createElement('area'); a.setAttribute('shape','polygon'); a.shape",
3562            "poly",
3563        ),
3564        // `ol.type`/`.start`/`.reversed`(`type`は既知値以外・欠落時は
3565        // 仕様上の既定値`"1"`にフォールバックする。`start`は欠落・不正値
3566        // 時の既定値`1`。どちらも丸ごと未対応だった。2026-07-17 発見・
3567        // 実装)。
3568        ("document.createElement('ol').type", "1"),
3569        (
3570            "var o=document.createElement('ol'); o.type='A'; o.type",
3571            "A",
3572        ),
3573        (
3574            "var o=document.createElement('ol'); o.setAttribute('type','bogus'); o.type",
3575            "1",
3576        ),
3577        ("document.createElement('ol').start", "1"),
3578        (
3579            "var o=document.createElement('ol'); o.start=5; o.start",
3580            "5",
3581        ),
3582        (
3583            "document.createElement('ol').reversed",
3584            "false",
3585        ),
3586        (
3587            "var o=document.createElement('ol'); o.reversed=true; o.getAttribute('reversed')",
3588            "reversed",
3589        ),
3590        // `meter.low`/`.high`/`.optimum`(`min`/`max`と同じく丸ごと未対応
3591        // だった。既定値はそれぞれ`min`/`max`/`min`と`max`の中点。
3592        // 2026-07-17 発見・実装)。
3593        (
3594            "var m=document.createElement('meter'); m.min='2'; m.max='10'; m.low+','+m.high+','+m.optimum",
3595            "2,10,6",
3596        ),
3597        (
3598            "var m=document.createElement('meter'); m.max='10'; m.low='4'; m.low",
3599            "4",
3600        ),
3601        (
3602            "var m=document.createElement('meter'); m.max='10'; m.high='20'; m.high",
3603            "10",
3604        ),
3605        // `td`/`th.colSpan`/`.rowSpan`(欠落・不正値時の既定値`1`、
3606        // `colSpan`は最大`1000`、`rowSpan`は最大`65534`にクランプ。
3607        // どちらも丸ごと未対応だった。2026-07-17 発見・実装)。
3608        ("document.createElement('td').colSpan", "1"),
3609        (
3610            "var c=document.createElement('td'); c.colSpan=3; c.colSpan",
3611            "3",
3612        ),
3613        (
3614            "var c=document.createElement('td'); c.setAttribute('colspan','9999'); c.colSpan",
3615            "1000",
3616        ),
3617        ("document.createElement('th').rowSpan", "1"),
3618        (
3619            "var c=document.createElement('th'); c.rowSpan=0; c.rowSpan",
3620            "0",
3621        ),
3622        // `td`/`th.headers`(単純な文字列反映)と`th.scope`(既知値以外・
3623        // 欠落時は仕様上の既定値`""`にフォールバック)、`th.abbr`(単純な
3624        // 文字列反映)が丸ごと未対応だった。2026-07-17 発見・実装)。
3625        (
3626            "var c=document.createElement('td'); c.headers='h1 h2'; c.headers",
3627            "h1 h2",
3628        ),
3629        ("document.createElement('th').scope", ""),
3630        (
3631            "var t=document.createElement('th'); t.scope='col'; t.scope",
3632            "col",
3633        ),
3634        (
3635            "var t=document.createElement('th'); t.setAttribute('scope','bogus'); t.scope",
3636            "",
3637        ),
3638        (
3639            "var t=document.createElement('th'); t.abbr='Description'; t.abbr",
3640            "Description",
3641        ),
3642        // `col`/`colgroup.span`(欠落・不正値時の既定値`1`、最大`1000`に
3643        // クランプ。丸ごと未対応だった。2026-07-17 発見・実装)。
3644        ("document.createElement('col').span", "1"),
3645        (
3646            "var c=document.createElement('colgroup'); c.span=3; c.span",
3647            "3",
3648        ),
3649        (
3650            "var c=document.createElement('col'); c.setAttribute('span','9999'); c.span",
3651            "1000",
3652        ),
3653        // `object.data`(`href`/`src`/`action`と同じくURL属性を反映し、
3654        // 現在のページURL基準の絶対URLを返す。テキストノードの
3655        // `CharacterData.data`と同名で衝突するためタグ限定で扱う必要が
3656        // あったが、プロパティ自体が丸ごと未対応だった。2026-07-17
3657        // 発見・実装)。
3658        (
3659            "var o=document.createElement('object'); o.data='/x'; o.getAttribute('data')",
3660            "/x",
3661        ),
3662        (
3663            "var t=document.createTextNode('hi'); t.data",
3664            "hi",
3665        ),
3666        // `meta.httpEquiv`/`.content`/`.charset`(`httpEquiv`は`http-equiv`
3667        // 属性の camelCase IDL プロパティ版で`htmlFor`と同じマッピング
3668        // パターン、`content`/`.charset`は単純な属性反映。3つとも丸ごと
3669        // 未対応だった。2026-07-17 発見・実装)。
3670        (
3671            "var m=document.createElement('meta'); m.httpEquiv='refresh'; m.getAttribute('http-equiv')",
3672            "refresh",
3673        ),
3674        (
3675            "var m=document.createElement('meta'); m.setAttribute('http-equiv','refresh'); m.httpEquiv",
3676            "refresh",
3677        ),
3678        (
3679            "var m=document.createElement('meta'); m.content='width=device-width'; m.content",
3680            "width=device-width",
3681        ),
3682        (
3683            "var m=document.createElement('meta'); m.charset='utf-8'; m.charset",
3684            "utf-8",
3685        ),
3686        // `blockquote`/`q`/`ins`/`del.cite`(単純な文字列反映)と
3687        // `ins`/`del`/`time.dateTime`(`datetime`属性のcamelCase IDL
3688        // プロパティ版)が丸ごと未対応だった。2026-07-17 発見・実装)。
3689        (
3690            "var b=document.createElement('blockquote'); b.cite='https://example.com'; b.getAttribute('cite')",
3691            "https://example.com",
3692        ),
3693        (
3694            "var t=document.createElement('time'); t.dateTime='2026-07-17'; t.getAttribute('datetime')",
3695            "2026-07-17",
3696        ),
3697        (
3698            "var i=document.createElement('ins'); i.setAttribute('datetime','2026-07-17'); i.dateTime",
3699            "2026-07-17",
3700        ),
3701        // `video.disablePictureInPicture`/`iframe.allowFullscreen`(単純な
3702        // ブール属性反映だが丸ごと未対応だった。2026-07-17 発見・実装)。
3703        (
3704            "document.createElement('video').disablePictureInPicture",
3705            "false",
3706        ),
3707        (
3708            "var v=document.createElement('video'); v.disablePictureInPicture=true; v.getAttribute('disablepictureinpicture')",
3709            "disablepictureinpicture",
3710        ),
3711        (
3712            "var f=document.createElement('iframe'); f.allowFullscreen=true; f.getAttribute('allowfullscreen')",
3713            "allowfullscreen",
3714        ),
3715        // `canvas.width`/`.height`(欠落・不正値時の既定値`300`/`150`)と
3716        // `img`/`video.width`/`.height`(既定値`0`)が丸ごと未対応
3717        // だった。2026-07-17 発見・実装)。
3718        (
3719            "document.createElement('canvas').width+','+document.createElement('canvas').height",
3720            "300,150",
3721        ),
3722        (
3723            "var c=document.createElement('canvas'); c.width=640; c.height=480; c.width+','+c.height",
3724            "640,480",
3725        ),
3726        (
3727            "document.createElement('img').width+','+document.createElement('img').height",
3728            "0,0",
3729        ),
3730        (
3731            "var v=document.createElement('video'); v.width=320; v.width",
3732            "320",
3733        ),
3734        // `embed`/`object`/`iframe.width`/`.height`(`DOMString`型の単純な
3735        // 文字列反映。`canvas`/`img`/`video`の`unsigned long`型とは異なり
3736        // 数値クランプ・既定値フォールバックが無い。丸ごと未対応
3737        // だった。2026-07-17 発見・実装)。
3738        (
3739            "var e=document.createElement('embed'); e.width='50%'; e.width",
3740            "50%",
3741        ),
3742        (
3743            "var o=document.createElement('object'); o.height='300'; o.height",
3744            "300",
3745        ),
3746        ("document.createElement('iframe').width", ""),
3747        (
3748            "var f=document.createElement('iframe'); f.setAttribute('width','640'); f.width",
3749            "640",
3750        ),
3751        // `input`/`textarea.defaultValue`(`value`属性/初期テキストを
3752        // 反映)と`input.defaultChecked`/`option.defaultSelected`(`checked`/
3753        // `selected`属性の有無を反映するブール型)が丸ごと未対応
3754        // だった。2026-07-17 発見・実装)。
3755        (
3756            "var i=document.createElement('input'); i.defaultValue='hi'; i.getAttribute('value')",
3757            "hi",
3758        ),
3759        (
3760            "var i=document.createElement('input'); i.setAttribute('value','preset'); i.defaultValue",
3761            "preset",
3762        ),
3763        (
3764            "var i=document.createElement('input'); i.setAttribute('value','preset'); i.value='changed'; i.defaultValue",
3765            "preset",
3766        ),
3767        (
3768            "var i=document.createElement('input'); i.setAttribute('value','preset'); i.value='changed'; i.value",
3769            "changed",
3770        ),
3771        (
3772            "document.createElement('input').defaultChecked",
3773            "false",
3774        ),
3775        (
3776            "var i=document.createElement('input'); i.defaultChecked=true; i.getAttribute('checked')",
3777            "checked",
3778        ),
3779        (
3780            "var i=document.createElement('input'); i.defaultChecked=true; i.checked=false; i.defaultChecked",
3781            "true",
3782        ),
3783        (
3784            "document.createElement('option').defaultSelected",
3785            "false",
3786        ),
3787        (
3788            "var o=document.createElement('option'); o.defaultSelected=true; o.getAttribute('selected')",
3789            "selected",
3790        ),
3791        // `output.type`(仕様上、属性値に関わらず常に固定文字列
3792        // `"output"`を返す読み取り専用IDLプロパティ。`<output>`要素
3793        // 自体が丸ごと未対応だった。2026-07-17 発見・実装)。
3794        ("document.createElement('output').type", "output"),
3795        (
3796            "var o=document.createElement('output'); o.setAttribute('type','bogus'); o.type",
3797            "output",
3798        ),
3799        // `iframe.srcdoc`(単純な文字列反映だが丸ごと未対応だった。
3800        // 2026-07-17 発見・実装)。
3801        (
3802            "var f=document.createElement('iframe'); f.srcdoc='<p>hi</p>'; f.getAttribute('srcdoc')",
3803            "<p>hi</p>",
3804        ),
3805        (
3806            "var f=document.createElement('iframe'); f.setAttribute('srcdoc','<b>x</b>'); f.srcdoc",
3807            "<b>x</b>",
3808        ),
3809        // `li.value`(順序リストの番号上書き用`long`型IDLプロパティ。
3810        // 欠落・不正値時の既定値は`0`。丸ごと未対応だった。汎用の`value`
3811        // アームだと数値ではなく文字列になってしまう衝突があった。
3812        // 2026-07-17 発見・実装)。
3813        ("document.createElement('li').value", "0"),
3814        (
3815            "var l=document.createElement('li'); l.value=5; l.value",
3816            "5",
3817        ),
3818        (
3819            "var l=document.createElement('li'); l.setAttribute('value','bogus'); l.value",
3820            "0",
3821        ),
3822        // `input.pattern`(`placeholder`と同じ単純な文字列反映だが丸ごと
3823        // 未対応だった。2026-07-17 発見・実装)。
3824        (
3825            "var i=document.createElement('input'); i.pattern='[0-9]+'; i.getAttribute('pattern')",
3826            "[0-9]+",
3827        ),
3828        (
3829            "var i=document.createElement('input'); i.setAttribute('pattern','[a-z]+'); i.pattern",
3830            "[a-z]+",
3831        ),
3832        // `input.capture`(`type="file"`のカメラ/マイク取り込みヒント。
3833        // 単純な文字列反映だが丸ごと未対応だった。2026-07-17 発見・実装)。
3834        (
3835            "var i=document.createElement('input'); i.capture='environment'; i.getAttribute('capture')",
3836            "environment",
3837        ),
3838        (
3839            "var i=document.createElement('input'); i.setAttribute('capture','user'); i.capture",
3840            "user",
3841        ),
3842        // `input.autocomplete`(単純な文字列反映)と`element.autofocus`
3843        // (ブール型。実際のフォーカス自動移動機構は無いため属性値の
3844        // 反映のみ)が丸ごと未対応だった。2026-07-18 発見・実装)。
3845        (
3846            "var i=document.createElement('input'); i.autocomplete='email'; i.getAttribute('autocomplete')",
3847            "email",
3848        ),
3849        (
3850            "var i=document.createElement('input'); i.setAttribute('autocomplete','off'); i.autocomplete",
3851            "off",
3852        ),
3853        (
3854            "document.createElement('input').autofocus",
3855            "false",
3856        ),
3857        (
3858            "var i=document.createElement('input'); i.autofocus=true; i.getAttribute('autofocus')",
3859            "autofocus",
3860        ),
3861        (
3862            "var i=document.createElement('input'); i.min='0'; i.max='10'; i.step='2'; i.min+','+i.max+','+i.step",
3863            "0,10,2",
3864        ),
3865        (
3866            "var i=document.createElement('input'); i.maxLength='5'; i.maxLength",
3867            "5",
3868        ),
3869        // `maxLength`/`minLength`はWebIDL上`long`(数値型)のIDL属性で、無指定時
3870        // の既定値は`-1`だが、以前は`maxLength`が文字列型(属性が無ければ空
3871        // 文字列)で返っており、`minLength`はゲッター自体が丸ごと未対応だった
3872        // (`min`/`max`/`step`は`DOMString`型が正しいIDL定義のため対象外)。
3873        (
3874            "typeof document.createElement('input').maxLength",
3875            "number",
3876        ),
3877        (
3878            "document.createElement('input').maxLength",
3879            "-1",
3880        ),
3881        (
3882            "var i=document.createElement('input'); i.minLength=3; typeof i.minLength + ',' + i.minLength",
3883            "number,3",
3884        ),
3885        (
3886            "document.createElement('textarea').minLength",
3887            "-1",
3888        ),
3889        (
3890            "var a=document.createElement('a'); a.target='_blank'; a.rel='noopener'; a.download='f.txt'; a.target+','+a.rel+','+a.download",
3891            "_blank,noopener,f.txt",
3892        ),
3893        (
3894            "var i=document.createElement('input'); i.placeholder='enter name'; i.placeholder",
3895            "enter name",
3896        ),
3897        (
3898            "var d=document.createElement('details'); d.open",
3899            "false",
3900        ),
3901        (
3902            "var d=document.createElement('details'); d.open=true; d.open",
3903            "true",
3904        ),
3905        (
3906            "var d=document.createElement('details'); d.setAttribute('open',''); d.open",
3907            "true",
3908        ),
3909        (
3910            "var i=document.createElement('input'); i.name='email'; i.name",
3911            "email",
3912        ),
3913        // `select.value`/`select.selectedIndex` が丸ごと未対応だった。`<select>` は
3914        // 自身に `value` 属性を持たず、子の `<option selected>` が選択状態を持つため、
3915        // 汎用の属性直結 getter では常に空文字列になっていた。
3916        (
3917            "var s=document.createElement('select'); s.innerHTML=\"<option value='a'>A</option><option value='b'>B</option>\"; s.value",
3918            "a",
3919        ),
3920        (
3921            "var s=document.createElement('select'); s.innerHTML=\"<option value='a'>A</option><option value='b'>B</option>\"; s.value='b'; s.value",
3922            "b",
3923        ),
3924        (
3925            "var s=document.createElement('select'); s.innerHTML=\"<option value='a'>A</option><option value='b'>B</option>\"; s.value='b'; s.selectedIndex",
3926            "1",
3927        ),
3928        (
3929            "var s=document.createElement('select'); s.innerHTML=\"<option value='a'>A</option><option value='b'>B</option>\"; s.selectedIndex=1; s.value",
3930            "b",
3931        ),
3932        // `option.index`(`select.selectedIndex`と対になる、`<option>`側の0始まり
3933        // 位置を返すIDL属性)が丸ごと未対応だった。
3934        (
3935            "var s=document.createElement('select'); s.innerHTML=\"<option value='a'>A</option><option value='b'>B</option>\"; s.options[1].index",
3936            "1",
3937        ),
3938        (
3939            "document.createElement('option').index",
3940            "0",
3941        ),
3942        // `select.length`(`select.options.length`と同じ値を返すIDL属性、および
3943        // 末尾optionを切り捨てる/空optionで埋めるセッター)が丸ごと未対応だった。
3944        (
3945            "var s=document.createElement('select'); s.innerHTML=\"<option value='a'>A</option><option value='b'>B</option>\"; s.length",
3946            "2",
3947        ),
3948        (
3949            "var s=document.createElement('select'); s.innerHTML=\"<option value='a'>A</option><option value='b'>B</option>\"; s.length=1; s.options.length + ',' + s.value",
3950            "1,a",
3951        ),
3952        (
3953            "var s=document.createElement('select'); s.length=2; s.options.length",
3954            "2",
3955        ),
3956        // `select.remove(index)`(`HTMLSelectElement`固有のオーバーロード。
3957        // 指定インデックスのoptionを削除する)が、同名の`ChildNode.remove()`
3958        // (引数無しで自身を親から削除する)と混同され、`select.remove(1)`が
3959        // 常にselect自身を親ごと削除してしまうバグだった。
3960        (
3961            "var s=document.createElement('select'); s.innerHTML=\"<option value='a'>A</option><option value='b'>B</option>\"; s.remove(0); s.options.length + ',' + s.value",
3962            "1,b",
3963        ),
3964        (
3965            // 引数無しの `.remove()` は従来どおり自身を親から削除する
3966            // (ChildNode.remove()と同じ挙動を維持)。
3967            "var d=document.createElement('div'); var s=document.createElement('select'); d.appendChild(s); s.remove(); d.children.length",
3968            "0",
3969        ),
3970        (
3971            // 負のインデックスはno-op(`as usize`の飽和変換で誤って先頭が
3972            // 削除されるバグを防いだ確認)。
3973            "var s=document.createElement('select'); s.innerHTML=\"<option value='a'>A</option>\"; s.remove(-1); s.options.length",
3974            "1",
3975        ),
3976        // `textarea.value` も同種のバグだった(`<textarea>` の初期値は本来テキスト
3977        // ノードの内容で表現されるべきだが、`.value` 書込み後の読み出し往復は
3978        // 最低限このとおり動くことを確認する)。
3979        (
3980            "var t=document.createElement('textarea'); t.value='hi'; t.value",
3981            "hi",
3982        ),
3983        ("typeof console.table", "function"),
3984        ("typeof globalThis", "object"),
3985        ("typeof globalThis.document", "object"),
3986        // fetch(data: URL でネット非依存にフルチェーン検証: Promise→Response→text()/json())
3987        ("typeof fetch", "function"),
3988        ("(await fetch('data:,hello')).status", "200"),
3989        ("(await fetch('data:,hello')).ok", "true"),
3990        ("await (await fetch('data:,hello world')).text()", "hello world"),
3991        ("await fetch('data:text/plain,abc').then(r => r.text())", "abc"),
3992        ("(await (await fetch('data:application/json,{\"a\":7,\"b\":[1,2]}')).json()).a", "7"),
3993        ("(await (await fetch('data:application/json,{\"a\":7,\"b\":[1,2]}')).json()).b.length", "2"),
3994        // `Response.prototype.blob()`(丸ごと未対応で `blob is not defined` だった)。
3995        ("(await (await fetch('data:,hello')).blob()).size", "5"),
3996        ("await (await (await fetch('data:,hello')).blob()).text()", "hello"),
3997        // `Response.prototype.arrayBuffer()` も同種の欠落だった。実バイト列付きの
3998        // ArrayBuffer で解決するため、そこから作った DataView で正しく読み戻せる。
3999        (
4000            "var buf = await (await fetch('data:,A')).arrayBuffer(); new DataView(buf).getUint8(0)",
4001            "65",
4002        ),
4003        ("await fetch('ftp://x/y').then(() => 'ok', e => 'err:' + (e.message || e))", "err:fetch: only absolute http(s) and data URLs are supported"),
4004        // `Response.prototype.statusText` が丸ごと未対応で常に `undefined` だった
4005        // (エラーログの定番パターン `console.log(response.status, response.statusText)`
4006        // で参照される)。
4007        ("(await fetch('data:,hi')).statusText", "OK"),
4008        // `Response.prototype.clone()`(`response.clone().json()` のように本文を
4009        // 2回読みたい場合に使う定番パターン)が丸ごと未対応で `clone is not a
4010        // function` だった。
4011        (
4012            "var r = await fetch('data:,hello'); var c = r.clone(); (await c.text()) + ',' + (await r.text())",
4013            "hello,hello",
4014        ),
4015        ("(await fetch('data:,x')).clone().status", "200"),
4016        // `Response.prototype.url`(リダイレクト後の最終 URL 確認等で使われる
4017        // 定番プロパティ)が丸ごと未対応で常に `undefined` だった。
4018        (
4019            "(await fetch('data:,hi')).url",
4020            "data:,hi",
4021        ),
4022        // `Response` コンストラクタ自体が丸ごと未対応だった(`fetch()` 内部からしか
4023        // 生成できず、`new Response(...)` が呼び出すと TypeError になっていた)。
4024        ("new Response('hi').status", "200"),
4025        ("await new Response('hi', {status: 201}).text()", "hi"),
4026        (
4027            "(await new Response(JSON.stringify({a:1}), {headers:{'content-type':'application/json'}}).json()).a",
4028            "1",
4029        ),
4030        // `Response.json(data, init)`(ES2022 static factory)。
4031        ("(await Response.json({a:5}).json()).a", "5"),
4032        ("Response.json({}).headers.get('content-type')", "application/json"),
4033        // `Response.error()`。
4034        ("Response.error().ok", "false"),
4035        ("Response.error().type", "error"),
4036        // `Response.redirect(url, status?)`。
4037        ("Response.redirect('https://e.com/x').status", "302"),
4038        ("Response.redirect('https://e.com/x', 301).headers.get('location')", "https://e.com/x"),
4039        (
4040            "(await fetch('data:,x')).clone().url",
4041            "data:,x",
4042        ),
4043        // `fetch(url, {signal})` が丸ごと未対応で、既に aborted な signal を渡しても
4044        // 常にリクエストを実行してしまっていた。
4045        (
4046            "await fetch('data:,hi', {signal: AbortSignal.abort('why')}).then(() => 'no-throw', e => 'caught:' + e)",
4047            "caught:why",
4048        ),
4049        (
4050            "await fetch('data:,hi', {signal: new AbortController().signal}).then(r => r.status)",
4051            "200",
4052        ),
4053        // `new Request(url, options)` が丸ごと未対応で `Request is not defined`
4054        // だった。`fetch(request)` という定番パターンも合わせて確認する。
4055        ("new Request('data:,hi').url", "data:,hi"),
4056        ("new Request('data:,hi', {method:'POST'}).method", "POST"),
4057        // `request.headers` が仕様上常に本物の `Headers` インスタンスであるべき
4058        // ところ、生の値をそのまま格納するだけで `.get(...)` が壊れていた。
4059        (
4060            "new Request('data:,hi', {headers:{'X-Foo':'bar'}}).headers.get('x-foo')",
4061            "bar",
4062        ),
4063        ("typeof new Request('data:,hi').headers.get", "function"),
4064        // `response.type`/`.redirected` が丸ごと未対応で常に `undefined` だった。
4065        ("(await fetch('data:,hi')).type", "basic"),
4066        ("(await fetch('data:,hi')).redirected", "false"),
4067        ("await fetch(new Request('data:,hello')).then(r => r.text())", "hello"),
4068        (
4069            "await fetch(new Request('data:,x'), {method:'GET'}).then(r => r.status)",
4070            "200",
4071        ),
4072        // `Headers`(Fetch API の get/set/has/append/delete 付き専用クラス)が
4073        // 丸ごと未対応だった。ヘッダ名は大小無視で正規化される。
4074        ("new Headers({'Content-Type':'text/plain'}).get('content-type')", "text/plain"),
4075        // `[[k,v], ...]` 配列形式の init(`make_headers` の `is_array` 分岐。
4076        // 2026-07-14、clippy `single_match` 修正時に既存テストで一度もこの
4077        // 分岐が通っていなかったことに気づき追加)。
4078        ("new Headers([['A','1'],['b','2']]).get('a')", "1"),
4079        ("new Headers().has('x')", "false"),
4080        (
4081            "var h=new Headers(); h.set('X-Foo','1'); h.has('x-foo')",
4082            "true",
4083        ),
4084        (
4085            "var h=new Headers(); h.append('a','1'); h.append('a','2'); h.get('a')",
4086            "1, 2",
4087        ),
4088        (
4089            "var h=new Headers({a:'1'}); h.delete('a'); h.has('a')",
4090            "false",
4091        ),
4092        (
4093            "var h=new Headers({a:'1',b:'2'}); var s=''; h.forEach(function(v,k){s+=k+'='+v+';'}); s",
4094            "a=1;b=2;",
4095        ),
4096        // `entries`/`keys`/`values`/`Symbol.iterator`(`for (const [k,v] of headers)`
4097        // という定番イディオムを含む)が丸ごと未対応だった。
4098        (
4099            "Array.from(new Headers({b:'2',a:'1'}).entries()).map(function(e){return e[0]+'='+e[1]}).join(',')",
4100            "a=1,b=2",
4101        ),
4102        ("Array.from(new Headers({a:'1',b:'2'}).keys()).join(',')", "a,b"),
4103        ("Array.from(new Headers({a:'1',b:'2'}).values()).join(',')", "1,2"),
4104        (
4105            "var s=''; for (var e of new Headers({a:'1',b:'2'})) { s += e[0]+e[1]; } s",
4106            "a1b2",
4107        ),
4108        // `response.headers` が丸ごと欠落しておらず、本物の `Headers`(メソッド持ち)
4109        // が返ること。この処理系はレスポンスヘッダを捕捉していないため中身は
4110        // 常に空になる。
4111        (
4112            "typeof (await fetch('data:,hi')).headers.get",
4113            "function",
4114        ),
4115        // `xhr.getResponseHeader(name)` が丸ごと未対応で「関数ではない」の
4116        // TypeError になっていた。
4117        (
4118            "var x=new XMLHttpRequest(); x.open('GET','data:,hi'); x.send(); x.getResponseHeader('x') === null",
4119            "true",
4120        ),
4121        // XMLHttpRequest(同期。data: でオフライン検証)
4122        ("typeof XMLHttpRequest", "function"),
4123        ("var x=new XMLHttpRequest(); x.open('GET','data:,hi'); x.send(); x.responseText", "hi"),
4124        // responseType 'json' は解析した値(lottie-web は解析済みとして `layers` を読む)。
4125        ("var x=new XMLHttpRequest(); x.responseType='json'; x.open('GET','data:application/json,{\"n\":5}'); x.send(); typeof x.response + x.response.n", "object5"),
4126        ("var x=new XMLHttpRequest(); x.responseType='json'; x.open('GET','data:,not json'); x.send(); x.response === null", "true"),
4127        ("var x=new XMLHttpRequest(); x.open('GET','data:,hi'); x.send(); x.status", "200"),
4128        ("var x=new XMLHttpRequest(); x.open('GET','data:,hi'); x.send(); x.readyState", "4"),
4129        // `xhr.statusText` がコンストラクタで空文字列初期化されたきり `send()` 完了後も
4130        // 一切更新されないバグだった(`Response.prototype.statusText` と同種)。
4131        ("var x=new XMLHttpRequest(); x.open('GET','data:,hi'); x.send(); x.statusText", "OK"),
4132        ("var g=''; var x=new XMLHttpRequest(); x.onload=function(){g=x.responseText}; x.open('GET','data:,YO'); x.send(); g", "YO"),
4133        ("var g=''; var x=new XMLHttpRequest(); x.addEventListener('load',function(){g='L'+x.status}); x.open('GET','data:,q'); x.send(); g", "L200"),
4134        // `xhr.removeEventListener` が丸ごと未対応で、呼び出すと「関数ではない」の
4135        // TypeError になっていた。
4136        (
4137            "var g=''; var x=new XMLHttpRequest(); var fn=function(){g='L'}; x.addEventListener('load',fn); x.removeEventListener('load',fn); x.open('GET','data:,q'); x.send(); g",
4138            "",
4139        ),
4140        (
4141            "typeof new XMLHttpRequest().removeEventListener",
4142            "function",
4143        ),
4144        (
4145            "var log=[]; var x=new XMLHttpRequest(); x.onreadystatechange=function(){log.push('r'+x.readyState)}; x.addEventListener('progress',function(e){log.push('p'+e.loaded)}); x.addEventListener('load',function(){log.push('L1')}); x.addEventListener('load',function(){log.push('L2')}); x.addEventListener('loadend',function(e){log.push('E'+e.loaded)}); x.open('GET','data:,hello'); x.send(); log.join(',')",
4146            "r1,r2,r3,p5,r4,L1,L2,E5",
4147        ),
4148        (
4149            "var log=[]; var x=new XMLHttpRequest(); x.addEventListener('readystatechange',function(){log.push('r'+x.readyState); if(x.readyState===2)x.abort();}); x.addEventListener('load',function(){log.push('L')}); x.addEventListener('abort',function(){log.push('A'+x.readyState)}); x.addEventListener('loadend',function(){log.push('E')}); x.open('GET','data:,hi'); x.send(); log.push('f'+x.readyState); log.join(',')",
4150            "r1,r2,r4,A4,E,f0",
4151        ),
4152        ("var x=new XMLHttpRequest(); x.open('GET','data:application/json,{\"n\":5}'); x.send(); JSON.parse(x.responseText).n", "5"),
4153        // fetch/XHR の POST オプション配線(data: は method 非依存で本文を返す=経路確認)
4154        ("await (await fetch('data:,hi', {method:'POST', body:'x'})).text()", "hi"),
4155        ("(await fetch('data:,ok', {method:'POST', headers:{'Content-Type':'application/json'}, body:'{}'})).status", "200"),
4156        ("var x=new XMLHttpRequest(); x.open('POST','data:,ok'); x.setRequestHeader('Content-Type','application/json'); x.send('{\"a\":1}'); x.responseText", "ok"),
4157        ("var x=new XMLHttpRequest(); x.open('POST','data:,z'); x.send(); x.status", "200"),
4158        // RegExp
4159        ("/\\d+/.test('abc123')", "true"),
4160        ("/^\\d+$/.test('abc')", "false"),
4161        ("'2026-06-15'.match(/(\\d+)-(\\d+)-(\\d+)/)[2]", "06"),
4162        ("'hello world'.replace(/o/g, '0')", "hell0 w0rld"),
4163        ("'a1b2c3'.replace(/\\d/g, m => '[' + m + ']')", "a[1]b[2]c[3]"),
4164        ("'one,two;three four'.split(/[,; ]/).join('|')", "one|two|three|four"),
4165        ("'foobarbaz'.match(/a/g).length", "2"),
4166        ("new RegExp('[A-Z]+').test('hello WORLD')", "true"),
4167        ("'Hello'.replace(/(\\w)(\\w+)/, '$2$1')", "elloH"),
4168        ("'price: $42'.match(/\\$(\\d+)/)[1]", "42"),
4169        ("/cat/i.test('CAT')", "true"),
4170        ("'a,b,,c'.split(/,/).length", "4"),
4171        // RegExp `y`(sticky)フラグ(ES2015): lastIndex の位置でのみマッチを試みる
4172        // (`g` と違い前方探索しない)。dotAll/sticky ゲッタープロパティも合わせて検証。
4173        ("/x/y.sticky", "true"),
4174        ("/x/g.sticky", "false"),
4175        ("/./s.dotAll", "true"),
4176        ("/./.dotAll", "false"),
4177        (
4178            "var re=/foo/y; re.lastIndex=3; re.test('xxxfoo')",
4179            "true",
4180        ),
4181        (
4182            "var re=/foo/y; re.lastIndex=2; re.test('xxxfoo')",
4183            "false",
4184        ),
4185        (
4186            "var re=/foo/y; var a=re.exec('foofoo').index; var b=re.exec('foofoo').index; a+','+b",
4187            "0,3",
4188        ),
4189        // RegExp `d`(hasIndices)フラグ(ES2022): exec() 結果に各キャプチャの
4190        // [start,end) 文字インデックスを持つ indices 配列を追加する。
4191        ("/x/d.hasIndices", "true"),
4192        ("/x/.hasIndices", "false"),
4193        (
4194            "var m=/(foo)(bar)/d.exec('xxfoobar'); m.indices[0].join(',')",
4195            "2,8",
4196        ),
4197        (
4198            "var m=/(foo)(bar)/d.exec('xxfoobar'); m.indices[1].join(',')+'/'+m.indices[2].join(',')",
4199            "2,5/5,8",
4200        ),
4201        (
4202            "var m=/(foo)(baz)?/d.exec('foo'); typeof m.indices[2]",
4203            "undefined",
4204        ),
4205        ("/x/.exec('x').indices", "undefined"),
4206        // setInterval: 発火確認は同一 eval 内では行えない(コールバックは
4207        // event_loop の次 tick で発火するため、登録直後は n=0 が正しい)。
4208        // 複数回発火の検証は下の「2段階評価テスト」で行う。
4209        // clearInterval: 登録直後にクリアすれば未発火のまま n=0。
4210        ("var n=0; var id=setInterval(function(){n++;}, 10); clearInterval(id); n", "0"),
4211        // window.innerWidth / innerHeight
4212        ("typeof window.innerWidth", "number"),
4213        ("typeof window.innerHeight", "number"),
4214        // XMLHttpRequest 任意メソッド(PUT/DELETE/PATCH)。data: URL は同期・無ネットワークで
4215        // メソッド非依存に 200+ボディを返すため、do_http_request→web_request 経路が
4216        // GET/POST 以外でも例外なく通ることを決定論的に検証できる。
4217        ("var x=new XMLHttpRequest(); x.open('PUT','data:text/plain,HELLO'); x.send('body'); x.status", "200"),
4218        ("var x=new XMLHttpRequest(); x.open('PUT','data:text/plain,HELLO'); x.send('body'); x.responseText", "HELLO"),
4219        ("var x=new XMLHttpRequest(); x.open('DELETE','data:text/plain,GONE'); x.send(); x.status", "200"),
4220        ("var x=new XMLHttpRequest(); x.open('DELETE','data:text/plain,GONE'); x.send(); x.responseText", "GONE"),
4221        ("var x=new XMLHttpRequest(); x.open('PATCH','data:text/plain,Pdata'); x.send('d'); x.responseText", "Pdata"),
4222        // 小文字メソッドも web_request 側で大文字正規化され通ること。
4223        ("var x=new XMLHttpRequest(); x.open('put','data:text/plain,low'); x.send('b'); x.responseText", "low"),
4224        // history.back/forward/go: ナビ要求を history._pending_nav(相対移動量)に積む。
4225        // 実ナビはホスト側 process_pending_nav が回収・実行するため、ここでは積算値を検証。
4226        ("history.back(); history._pending_nav", "-1"),
4227        ("history.forward(); history._pending_nav", "1"),
4228        ("history.go(-2); history._pending_nav", "-2"),
4229        ("history.back(); history.back(); history._pending_nav", "-2"),
4230        ("history.go(0); history._pending_nav || 0", "0"),
4231        // popstate リスナ登録は window の隠し配列へ蓄積される(発火はホスト主導)。
4232        ("window.addEventListener('popstate', function(){}); window._popstate_listeners.length", "1"),
4233        // scroll リスナも window の隠し配列 _scroll_listeners へ蓄積される(発火はホスト主導)。
4234        ("window.addEventListener('scroll', function(){}); window._scroll_listeners.length", "1"),
4235        ("window.addEventListener('scroll', function(){}); window.addEventListener('scroll', function(){}); window._scroll_listeners.length", "2"),
4236        // window.scrollY 初期値は 0(ホストが fire_scroll で更新する)。
4237        ("window.scrollY", "0"),
4238        // `window.postMessage()`(丸ごと未対応だった。フレーム分離が無いため
4239        // 同一 window 上の 'message' リスナへ同期配送する簡略実装)。
4240        (
4241            "var got=null; window.addEventListener('message', function(e){ got=e.data; }); \
4242             window.postMessage({x:1}); got.x",
4243            "1",
4244        ),
4245        (
4246            "var t=null; window.addEventListener('message', function(e){ t=e.type; }); \
4247             window.postMessage('hi'); t",
4248            "message",
4249        ),
4250        // `window.addEventListener(type, fn, {signal})`(丸ごと未対応だった。
4251        // `AbortController` でリスナを一括解除する定番パターン。2026-07-14
4252        // 発見・実装)。abort 後は発火しなくなる。
4253        (
4254            "var c=new AbortController(); var n=0; \
4255             window.addEventListener('message', function(){n++;}, {signal: c.signal}); \
4256             window.postMessage('a'); c.abort(); window.postMessage('b'); n",
4257            "1",
4258        ),
4259        // 登録前に既に abort 済みの signal を渡した場合は登録自体が行われない。
4260        (
4261            "var c=new AbortController(); c.abort(); var n=0; \
4262             window.addEventListener('message', function(){n++;}, {signal: c.signal}); \
4263             window.postMessage('a'); n",
4264            "0",
4265        ),
4266        // ---- Proxy / Reflect ----
4267        // get トラップ: プロパティ読み取りを横取りする。
4268        ("var p=new Proxy({}, {get:function(t,k){return 'G:'+k;}}); p.foo", "G:foo"),
4269        // get トラップ未定義なら target へフォワード。
4270        ("var p=new Proxy({a:42}, {}); p.a", "42"),
4271        // set トラップ: 書き込みを横取りして target に別キーで格納。
4272        ("var log=''; var p=new Proxy({}, {set:function(t,k,v){t['_'+k]=v;return true;}}); p.x=9; p._x", "9"),
4273        // set トラップ未定義なら target に直接書く。
4274        ("var p=new Proxy({}, {}); p.y=7; p.y", "7"),
4275        // has トラップ: in 演算子を横取り。
4276        ("var p=new Proxy({}, {has:function(t,k){return k==='magic';}}); ('magic' in p)", "true"),
4277        ("var p=new Proxy({}, {has:function(t,k){return k==='magic';}}); ('other' in p)", "false"),
4278        // has トラップ未定義なら target の存在判定にフォワード。
4279        ("var p=new Proxy({z:1}, {}); ('z' in p)", "true"),
4280        ("var p=new Proxy({z:1}, {}); ('w' in p)", "false"),
4281        // deleteProperty トラップ: `delete p.prop` を横取り。以前はここが未対応で、
4282        // トラップ呼び出しはおろか target へのフォワードすら行われず常に何も削除せず
4283        // `true` を返すだけの黙殺バグだった。
4284        (
4285            "var log=''; var p=new Proxy({a:1}, {deleteProperty:function(t,k){log+=k; delete t[k]; return true;}}); delete p.a; log + ':' + ('a' in p)",
4286            "a:false",
4287        ),
4288        // deleteProperty トラップ未定義なら target への delete にフォワードする。
4289        ("var p=new Proxy({a:1}, {}); delete p.a; ('a' in p)", "false"),
4290        // `Index`(`delete p['a']`)経由でも同じくフォワードされる。
4291        ("var p=new Proxy({a:1}, {}); delete p['a']; ('a' in p)", "false"),
4292        // `Object.defineProperty`/`Object.getOwnPropertyDescriptor` も Proxy 自身の
4293        // 意味の無い `.props` に書き込む/読み取るだけで target に一切反映・反射されない
4294        // バグだった。target フォワードで対応(trap 呼び出しまでは非対応)。
4295        (
4296            "var t={}; var p=new Proxy(t, {}); Object.defineProperty(p, 'x', {value:5}); t.x",
4297            "5",
4298        ),
4299        (
4300            "var p=new Proxy({x:5}, {}); Object.getOwnPropertyDescriptor(p, 'x').value",
4301            "5",
4302        ),
4303        // apply トラップ: 関数呼び出しを横取り。
4304        ("var f=function(a,b){return a+b;}; var p=new Proxy(f, {apply:function(t,thiz,args){return args[0]*args[1];}}); p(3,4)", "12"),
4305        // apply トラップ未定義なら target を普通に呼ぶ。
4306        ("var f=function(a,b){return a+b;}; var p=new Proxy(f, {}); p(3,4)", "7"),
4307        // construct トラップ: new を横取り。
4308        ("function C(){} var p=new Proxy(C, {construct:function(t,args){return {made:args[0]};}}); (new p(99)).made", "99"),
4309        // construct トラップ未定義なら target を new する。
4310        ("function C(x){this.v=x;} var p=new Proxy(C, {}); (new p(5)).v", "5"),
4311        // Reflect.get / set
4312        ("var o={a:1}; Reflect.set(o,'a',8); Reflect.get(o,'a')", "8"),
4313        // Reflect.has
4314        ("Reflect.has({k:1},'k')", "true"),
4315        ("Reflect.has({k:1},'x')", "false"),
4316        // Reflect.deleteProperty
4317        ("var o={a:1,b:2}; Reflect.deleteProperty(o,'a'); ('a' in o)", "false"),
4318        // Reflect.ownKeys
4319        ("Reflect.ownKeys({a:1,b:2,c:3}).length", "3"),
4320        // Reflect.defineProperty
4321        ("var o={}; Reflect.defineProperty(o,'x',{value:42}); o.x", "42"),
4322        // Reflect.apply
4323        ("Reflect.apply(function(a,b){return a-b;}, null, [10,3])", "7"),
4324        // Reflect.apply/construct の argumentsList は仕様上 array-like 全般
4325        // (実配列に限らない)を受け付けるべきだが、以前は `&mut Interp` を持たない
4326        // `iterable_values` を使っており、素の array-like を渡すと引数が消えていた。
4327        (
4328            "Reflect.apply(function(a,b){return a-b;}, null, {0:10,1:3,length:2})",
4329            "7",
4330        ),
4331        // Reflect.construct
4332        ("function P(x){this.x=x;} Reflect.construct(P,[77]).x", "77"),
4333        (
4334            "function P(x){this.x=x;} Reflect.construct(P,{0:77,length:1}).x",
4335            "77",
4336        ),
4337        // Reflect.get がプロトタイプ連鎖を辿る。
4338        ("var base={greet:'hi'}; var o=Object.create(base); Reflect.get(o,'greet')", "hi"),
4339        // Proxy + Reflect 併用: get をログしつつ target にフォワード。
4340        ("var p=new Proxy({n:5}, {get:function(t,k){return Reflect.get(t,k)*2;}}); p.n", "10"),
4341        // 配列を包む Proxy の get(数値インデックス)。
4342        ("var p=new Proxy([10,20,30], {get:function(t,k){return Reflect.get(t,k);}}); p[1]", "20"),
4343        // ネストした Proxy(二重ラップ)。
4344        ("var inner=new Proxy({v:1},{get:function(t,k){return 100;}}); var outer=new Proxy(inner,{}); outer.v", "100"),
4345        // WeakMap
4346        ("var wm=new WeakMap(); var k={}; wm.set(k,42); wm.get(k)", "42"),
4347        ("var wm=new WeakMap(); var k={}; wm.set(k,1); wm.has(k)", "true"),
4348        ("var wm=new WeakMap(); var k={}; wm.set(k,1); wm.delete(k); wm.has(k)", "false"),
4349        // WeakSet
4350        ("var ws=new WeakSet(); var o={}; ws.add(o); ws.has(o)", "true"),
4351        ("var ws=new WeakSet(); var o={}; ws.add(o); ws.delete(o); ws.has(o)", "false"),
4352        // `WeakMap`/`WeakSet` は仕様上オブジェクト以外のキー/値を拒否し `TypeError` を
4353        // 投げるべきだが、以前は型を一切検証せず静かに成功していたバグ。
4354        (
4355            "try { new WeakMap().set(1,'x'); 'no-throw' } catch(e) { 'caught' }",
4356            "caught",
4357        ),
4358        (
4359            "try { new WeakSet().add('x'); 'no-throw' } catch(e) { 'caught' }",
4360            "caught",
4361        ),
4362        // 【2026-11-18】`Symbol()` 由来のシンボル(登録されていないもの)は WeakMap のキー・WeakSet の値にできる(ES2023)。
4363        // `Symbol.for` で登録したシンボルは今までどおり拒否する。
4364        ("var s=Symbol('k'); var wm=new WeakMap(); wm.set(s,5); wm.get(s)", "5"),
4365        ("var s=Symbol(); var wm=new WeakMap(); wm.set(s,1); wm.has(s)+','+wm.has(Symbol())", "true,false"),
4366        ("var s=Symbol('k'); var wm=new WeakMap(); wm.set(s,1); wm.set(s,2); wm.get(s)", "2"),
4367        ("var s=Symbol('k'); var wm=new WeakMap(); wm.set(s,1); wm.delete(s); wm.has(s)", "false"),
4368        ("var s=Symbol('k'); var ws=new WeakSet(); ws.add(s); ws.has(s)", "true"),
4369        ("var wm=new WeakMap(); wm.set(Symbol.iterator,1); wm.get(Symbol.iterator)", "1"),
4370        ("try { new WeakMap().set(Symbol.for('r'),1); 'no-throw' } catch(e) { e.name }", "TypeError"),
4371        ("var f=function(){}; class C{}; var o=new C(); var p=new Proxy({},{}); var wm=new WeakMap(); wm.set(f,1); wm.set(C,2); wm.set(o,3); wm.set(p,4); wm.get(f)+''+wm.get(C)+wm.get(o)+wm.get(p)", "1234"),
4372        // 【2026-11-18】64KB 以上の本体を持つ関数は、2 回目以降の呼び出しで空の本体を実行して undefined を返していた
4373        // (YouTube の `ZiD`)。何度呼んでも同じ値を返す。
4374        (
4375            "var f=eval('(function(){var a=0;'+'a+=1;'.repeat(14000)+'return a})'); [f(),f(),f()].join(',')",
4376            "14000,14000,14000",
4377        ),
4378        // `new WeakMap(iterable)`/`new WeakSet(iterable)` の初期化引数が `Map` と違い
4379        // 完全に無視されていた(常に空になるバグ)。
4380        ("var k1={}; var wm=new WeakMap([[k1,1]]); wm.get(k1)", "1"),
4381        ("var o1={}; var ws=new WeakSet([o1]); ws.has(o1)", "true"),
4382        // WeakRef
4383        ("var o={v:7}; var wr=new WeakRef(o); wr.deref().v", "7"),
4384        // Symbol 関数(AtmOS では文字列近似)
4385        ("typeof Symbol('x')", "symbol"),
4386        ("Symbol('a') === Symbol('a')", "false"),
4387        ("Symbol.for('x') === Symbol.for('x')", "true"),
4388        // `Symbol.keyFor`(`Symbol.for` の逆引き)が丸ごと未対応だった。
4389        ("Symbol.keyFor(Symbol.for('mykey'))", "mykey"),
4390        ("typeof Symbol.keyFor(Symbol('local'))", "undefined"),
4391        ("typeof Symbol.iterator", "symbol"),
4392        // MutationObserver — typeof で存在確認。
4393        ("typeof MutationObserver", "function"),
4394        // MutationObserver — コンストラクタが呼べる。
4395        ("var mo = new MutationObserver(function(){}); typeof mo.observe", "function"),
4396        // MutationObserver — disconnect と takeRecords が存在する。
4397        ("var mo = new MutationObserver(function(){}); typeof mo.disconnect + ',' + typeof mo.takeRecords", "function,function"),
4398        // MutationObserver — takeRecords は初期状態で空配列。
4399        ("var mo = new MutationObserver(function(){}); mo.takeRecords().length", "0"),
4400        // MutationObserver — attributeOldValue が丸ごと未対応で oldValue が常に
4401        // null 固定だったバグ(以前は old_value 自体を捕捉していなかった)。
4402        (
4403            "var el=document.createElement('div'); el.setAttribute('foo','bar'); \
4404             var mo=new MutationObserver(function(){}); \
4405             mo.observe(el,{attributes:true,attributeOldValue:true}); \
4406             el.setAttribute('foo','baz'); var r=mo.takeRecords(); \
4407             r.length+','+r[0].attributeName+','+r[0].oldValue",
4408            "1,foo,bar",
4409        ),
4410        // MutationObserver — attributeFilter が丸ごと未対応で、フィルタ対象外の
4411        // 属性変化まで常に通知されてしまっていたバグ。
4412        (
4413            "var el=document.createElement('div'); \
4414             var mo=new MutationObserver(function(){}); \
4415             mo.observe(el,{attributes:true,attributeFilter:['foo']}); \
4416             el.setAttribute('bar','x'); el.setAttribute('foo','y'); \
4417             var r=mo.takeRecords(); r.length+','+r[0].attributeName",
4418            "1,foo",
4419        ),
4420        // MutationObserver — removeAttribute() が非対称に通知漏れしていたバグ
4421        // (setAttribute() は既に notify_attribute を呼んでいたが removeAttribute()
4422        // 側だけこの呼び出し自体が丸ごと欠けていた)。
4423        (
4424            "var el=document.createElement('div'); el.setAttribute('foo','bar'); \
4425             var mo=new MutationObserver(function(){}); \
4426             mo.observe(el,{attributes:true,attributeOldValue:true}); \
4427             el.removeAttribute('foo'); var r=mo.takeRecords(); \
4428             r.length+','+r[0].attributeName+','+r[0].oldValue",
4429            "1,foo,bar",
4430        ),
4431        // MutationObserver — classList.add()/.remove() が「class」属性を書き換える
4432        // にもかかわらず notify_attribute を一切呼んでおらず通知漏れしていたバグ
4433        // (setAttribute('class',...)/removeAttribute() 経由の変更は通知されるのに
4434        // classList 経由だけ抜けていた非対称ペア)。
4435        (
4436            "var el=document.createElement('div'); el.className='a'; \
4437             var mo=new MutationObserver(function(){}); \
4438             mo.observe(el,{attributes:true,attributeOldValue:true}); \
4439             el.classList.add('b'); var r=mo.takeRecords(); \
4440             r.length+','+r[0].attributeName+','+r[0].oldValue",
4441            "1,class,a",
4442        ),
4443        (
4444            "var el=document.createElement('div'); el.className='a b'; \
4445             var mo=new MutationObserver(function(){}); \
4446             mo.observe(el,{attributes:true,attributeOldValue:true}); \
4447             el.classList.remove('b'); var r=mo.takeRecords(); \
4448             r.length+','+r[0].attributeName+','+r[0].oldValue",
4449            "1,class,a b",
4450        ),
4451        // MutationObserver — style.xxx=/.cssText= が「style」属性を書き換える
4452        // にもかかわらず notify_attribute を一切呼んでいなかったバグ(classList と
4453        // 同型の非対称ペア)。
4454        (
4455            "var el=document.createElement('div'); el.style.color='red'; \
4456             var mo=new MutationObserver(function(){}); \
4457             mo.observe(el,{attributes:true,attributeOldValue:true}); \
4458             el.style.color='blue'; var r=mo.takeRecords(); \
4459             r.length+','+r[0].attributeName+','+r[0].oldValue",
4460            "1,style,color: red",
4461        ),
4462        // MutationObserver — 仕様上`attributeOldValue`/`attributeFilter`が
4463        // 指定され`attributes`自体が省略された場合は`attributes`を暗黙的に
4464        // `true`とみなすべきところ、この暗黙有効化ロジックが丸ごと無く
4465        // `observe(el,{attributeOldValue:true})`という定番の省略記法
4466        // (`attributes:true`を明示せずとも動くのが仕様)が黙って何も
4467        // 監視しないバグだった。2026-07-17 発見・実装。
4468        (
4469            "var el=document.createElement('div'); el.setAttribute('data-x','1'); \
4470             var mo=new MutationObserver(function(){}); \
4471             mo.observe(el,{attributeOldValue:true}); \
4472             el.setAttribute('data-x','2'); var r=mo.takeRecords(); \
4473             r.length+','+r[0].type",
4474            "1,attributes",
4475        ),
4476        // `attributeFilter`のみ指定(`attributes`省略)でも同様に暗黙有効化される。
4477        (
4478            "var el=document.createElement('div'); \
4479             var mo=new MutationObserver(function(){}); \
4480             mo.observe(el,{attributeFilter:['data-x']}); \
4481             el.setAttribute('data-x','1'); var r=mo.takeRecords(); \
4482             r.length",
4483            "1",
4484        ),
4485        // 【2026-10-18】以下の characterData の試験は、要素ではなくテキストノードの textContent を変える
4486        // (要素への代入は子の置き換えで childList になる。Chrome で確認)。
4487        // `characterDataOldValue`のみ指定(`characterData`省略)でも同様。
4488        (
4489            "var el=document.createElement('div'); el.textContent='hi'; \
4490             var mo=new MutationObserver(function(){}); \
4491             mo.observe(el,{characterDataOldValue:true, subtree:true}); \
4492             el.firstChild.textContent='bye'; var r=mo.takeRecords(); \
4493             r.length+','+r[0].type+','+r[0].oldValue",
4494            "1,characterData,hi",
4495        ),
4496        // `attributes:false`を明示している場合は暗黙有効化しない(明示指定を
4497        // 尊重する。`attributes_specified.is_none()`条件の裏側の確認)。
4498        (
4499            "var el=document.createElement('div'); el.setAttribute('data-x','1'); \
4500             var mo=new MutationObserver(function(){}); \
4501             mo.observe(el,{attributes:false, attributeOldValue:true}); \
4502             el.setAttribute('data-x','2'); var r=mo.takeRecords(); \
4503             r.length",
4504            "0",
4505        ),
4506        // MutationObserver — el.innerHTML=... が childList の変化を一切通知して
4507        // いなかったバグ(appendChild/removeChild/insertBefore/replaceChild は
4508        // 既に notify_child_list を呼んでいたのに、最も頻繁に使われる innerHTML
4509        // 代入だけがこの呼び出しを欠いていた)。
4510        (
4511            "var el=document.createElement('div'); \
4512             var mo=new MutationObserver(function(){}); \
4513             mo.observe(el,{childList:true}); \
4514             el.innerHTML='<span>hi</span>'; var r=mo.takeRecords(); \
4515             r.length+','+r[0].type+','+r[0].addedNodes.length",
4516            "1,childList,1",
4517        ),
4518        // 要素の textContent 再代入は子の置き換え(childList 1 件。Chrome と同じ)。
4519        (
4520            "var el=document.createElement('div'); el.textContent='hi'; \
4521             var mo=new MutationObserver(function(){}); \
4522             mo.observe(el,{childList:true}); \
4523             el.textContent='bye'; var r=mo.takeRecords(); \
4524             r.length+','+r[0].type+','+r[0].removedNodes.length+','+r[0].addedNodes.length",
4525            "1,childList,1,1",
4526        ),
4527        // MutationObserver — 子が1件も無い要素への textContent=... 代入
4528        // (新規テキストノードを1件追加する経路)も childList を通知していなかった。
4529        (
4530            "var el=document.createElement('div'); \
4531             var mo=new MutationObserver(function(){}); \
4532             mo.observe(el,{childList:true}); \
4533             el.textContent='hi'; var r=mo.takeRecords(); \
4534             r.length+','+r[0].type+','+r[0].addedNodes.length",
4535            "1,childList,1",
4536        ),
4537        // MutationObserver — `characterData`オプションが丸ごと未対応だった
4538        // (`childList`/`attributes`は既に対応済みで`characterData`だけ抜けて
4539        // いた兄弟ギャップ。テキストノードが既に存在する要素への
4540        // `textContent`再代入は`characterData`変化として通知されるべき
4541        // ところ、対応する通知経路自体が存在せず`observe(el,
4542        // {characterData:true})`を指定してもコールバックが一切呼ばれ
4543        // なかった。2026-07-17 発見・実装)。
4544        (
4545            "var el=document.createElement('div'); el.textContent='hi'; \
4546             var mo=new MutationObserver(function(){}); \
4547             mo.observe(el,{characterData:true, subtree:true}); \
4548             el.firstChild.textContent='bye'; var r=mo.takeRecords(); \
4549             r.length+','+r[0].type",
4550            "1,characterData",
4551        ),
4552        // `characterDataOldValue:true`で変更前のテキストを取得できる。
4553        (
4554            "var el=document.createElement('div'); el.textContent='hi'; \
4555             var mo=new MutationObserver(function(){}); \
4556             mo.observe(el,{characterData:true, characterDataOldValue:true, subtree:true}); \
4557             el.firstChild.textContent='bye'; var r=mo.takeRecords(); \
4558             r[0].oldValue",
4559            "hi",
4560        ),
4561        // 値が実質変化していない代入(同じ文字列への再代入)は通知しない。
4562        (
4563            "var el=document.createElement('div'); el.textContent='hi'; \
4564             var mo=new MutationObserver(function(){}); \
4565             mo.observe(el,{characterData:true, subtree:true}); \
4566             el.firstChild.textContent='hi'; var r=mo.takeRecords(); r.length",
4567            "0",
4568        ),
4569        // `characterData`未指定(既定false)ならテキスト変化を通知しない
4570        // (`childList:true`のみ指定している場合、テキストノードの中身が
4571        // 変わっただけでは子ノードの追加/削除ではないため無関係)。
4572        (
4573            "var el=document.createElement('div'); el.textContent='hi'; \
4574             var mo=new MutationObserver(function(){}); \
4575             mo.observe(el,{childList:true}); \
4576             el.firstChild.textContent='bye'; var r=mo.takeRecords(); r.length",
4577            "0",
4578        ),
4579        // MutationObserver — 同一インスタンスによる複数ターゲット監視。
4580        (
4581            "var e1=document.createElement('div'); var e2=document.createElement('div'); \
4582             var mo=new MutationObserver(function(){}); \
4583             mo.observe(e1,{attributes:true}); mo.observe(e2,{attributes:true}); \
4584             e1.setAttribute('a','1'); e2.setAttribute('b','2'); \
4585             var r=mo.takeRecords(); r.length",
4586            "2",
4587        ),
4588        // MutationObserver — W3Cプロパティ previousSibling/nextSibling/attributeNamespace が null。
4589        (
4590            "var el=document.createElement('div'); \
4591             var mo=new MutationObserver(function(){}); \
4592             mo.observe(el,{attributes:true}); \
4593             el.setAttribute('a','1'); \
4594             var r=mo.takeRecords()[0]; \
4595             (r.previousSibling===null) && (r.nextSibling===null) && (r.attributeNamespace===null)",
4596            "true",
4597        ),
4598        // Object.defineProperty — データ記述子。
4599        ("var o={}; Object.defineProperty(o,'x',{value:42,writable:true}); o.x", "42"),
4600        // Object.defineProperty — getter。
4601        ("var o={_v:7}; Object.defineProperty(o,'v',{get:function(){return this._v*2;}}); o.v", "14"),
4602        // Object.defineProperty — setter + getter。
4603        ("var o={_x:0}; Object.defineProperty(o,'x',{get:function(){return this._x;},set:function(v){this._x=v+1;}}); o.x=9; o.x", "10"),
4604        // Object.defineProperty — setterのみ(getterなし→undefined)。
4605        ("var o={_s:''}; Object.defineProperty(o,'s',{set:function(v){this._s=v;}}); o.s='hi'; o._s", "hi"),
4606        // `__defineGetter__`/`__defineSetter__`/`__lookupGetter__`/
4607        // `__lookupSetter__`(Annex B.3.1)が丸ごと未対応だった。
4608        ("var o={_v:7}; o.__defineGetter__('v', function(){return this._v*2;}); o.v", "14"),
4609        ("var o={_x:0}; o.__defineSetter__('x', function(v){this._x=v+1;}); o.x=9; o._x", "10"),
4610        // getter/setter を別々に定義しても互いを上書きしない。
4611        (
4612            "var o={_x:1}; o.__defineGetter__('x', function(){return this._x;}); \
4613             o.__defineSetter__('x', function(v){this._x=v;}); o.x=5; o.x",
4614            "5",
4615        ),
4616        ("var o={}; o.__defineGetter__('v', function(){return 1;}); typeof o.__lookupGetter__('v')", "function"),
4617        ("var o={}; typeof o.__lookupGetter__('nope')", "undefined"),
4618        // Object.defineProperties — 複数。
4619        ("var o={}; Object.defineProperties(o,{a:{value:1},b:{value:2}}); o.a+o.b", "3"),
4620        // getter で動的値を返す。
4621        ("var o={n:0}; Object.defineProperty(o,'next',{get:function(){return ++this.n;}}); o.next; o.next; o.next", "3"),
4622        // Object.getOwnPropertyDescriptor — データ記述子。
4623        ("var o={x:5}; Object.getOwnPropertyDescriptor(o,'x').value", "5"),
4624        // Object.getOwnPropertyDescriptor — アクセサ記述子。
4625        ("var o={}; Object.defineProperty(o,'v',{get:function(){return 99;}}); typeof Object.getOwnPropertyDescriptor(o,'v').get", "function"),
4626        // Object.getOwnPropertyDescriptor — 存在しないキー→undefined。
4627        ("Object.getOwnPropertyDescriptor({x:1},'y')", "undefined"),
4628        // Object.getOwnPropertyDescriptors — 全記述子。
4629        ("var o={a:1}; Object.defineProperty(o,'b',{get:function(){return 2;}}); Object.getOwnPropertyDescriptors(o).a.value + Object.getOwnPropertyDescriptors(o).b.get()", "3"),
4630        // getter/setter リテラル構文(ES2015。Object.defineProperty 経由でのみ可能だった
4631        // アクセサ定義を、オブジェクトリテラル/クラス本体で直接書けるようにする)。
4632        // オブジェクトリテラルの getter。
4633        ("var o={_v:7, get v(){return this._v*2;}}; o.v", "14"),
4634        // オブジェクトリテラルの getter+setter。
4635        ("var o={_x:0, get x(){return this._x;}, set x(v){this._x=v+1;}}; o.x=9; o.x", "10"),
4636        // "get"/"set" という名前そのもののプロパティ/メソッドは従来通り動作する
4637        // (2トークン先読みでアクセサと誤認しないこと)。
4638        ("var o={get: 5}; o.get", "5"),
4639        ("var o={get(){return 7;}}; o.get()", "7"),
4640        // クラスの getter。
4641        (
4642            "class Circle { constructor(r){this.r=r;} get area(){return Math.round(Math.PI*this.r*this.r);} } new Circle(2).area",
4643            "13",
4644        ),
4645        // クラスの getter+setter(private フィールド風の下線プレフィックス)。
4646        (
4647            "class Box { constructor(){this._w=0;} get w(){return this._w;} set w(v){this._w=v<0?0:v;} } var b=new Box(); b.w=-5; b.w",
4648            "0",
4649        ),
4650        // static getter。
4651        (
4652            "class Config { static get version(){return '1.0';} } Config.version",
4653            "1.0",
4654        ),
4655        // Array.prototype.splice — 要素削除と返値。
4656        ("var a=[1,2,3,4]; var r=a.splice(1,2); r.join(',')+'/'+a.join(',')", "2,3/1,4"),
4657        // splice — 挿入。
4658        ("var a=[1,4]; a.splice(1,0,2,3); a.join(',')", "1,2,3,4"),
4659        // lastIndexOf。
4660        ("[1,2,3,2,1].lastIndexOf(2)", "3"),
4661        // copyWithin。
4662        ("[1,2,3,4,5].copyWithin(0,3).join(',')", "4,5,3,4,5"),
4663        // copyWithin — 負のインデックス(末尾からのオフセット)。
4664        ("[1,2,3,4,5].copyWithin(-2,0).join(',')", "1,2,3,1,2"),
4665        // copyWithin — end 引数で範囲を限定。
4666        ("[1,2,3,4,5].copyWithin(0,3,4).join(',')", "4,2,3,4,5"),
4667        // toSorted — 元配列を変更しない。
4668        ("var a=[3,1,2]; var s=a.toSorted(); a[0]+'/'+s.join(',')", "3/1,2,3"),
4669        // sort — undefined は比較関数に渡さず常に末尾に送る(SortCompare の特別扱い)。
4670        ("[undefined,3,undefined,1,2].sort((a,b)=>a-b).join(',')", "1,2,3,,"),
4671        ("[undefined,3,1,2].sort().join(',')", "1,2,3,"),
4672        ("[undefined,3,1,2].toSorted((a,b)=>a-b).join(',')", "1,2,3,"),
4673        // 配列の数値変換(ToPrimitive→ToNumber)。以前は Object 全般と同じく常に NaN だった。
4674        ("[5]*2", "10"),
4675        ("[]+1", "1"),
4676        ("['5']-2", "3"),
4677        ("[1,2]*1", "NaN"),
4678        // `Value::to_number` にも同種の Proxy 素通しバグがあり、`Array` は
4679        // 特別扱いされているのに `Proxy` で包むと常に `NaN` になっていた
4680        // (`Array.isArray`/`to_js_string` 等は既に透過性修正済みだった)。
4681        ("new Proxy([5],{})*2", "10"),
4682        ("+new Proxy([5],{})", "5"),
4683        // 緩やか等価(==)で Object(配列)と Number/String を比較。以前はどの分岐にも
4684        // 該当せず常に false になっていた。
4685        ("[5]==5", "true"),
4686        ("[5]=='5'", "true"),
4687        ("''==[]", "true"),
4688        ("[1,2]==5", "false"),
4689        // Number("0x..")/("0o..")/("0b..") 整数リテラル変換。以前は NaN 固定だった。
4690        ("Number('0x1F')", "31"),
4691        ("Number('0o17')", "15"),
4692        ("Number('0b101')", "5"),
4693        ("+'0xff'", "255"),
4694        // String.prototype.normalize — 丸ごと欠落していた。Unicode 分解/合成テーブルが無い
4695        // ため恒等変換の簡略実装だが、少なくとも呼び出せて有効な form は通ることを確認。
4696        ("'abc'.normalize()", "abc"),
4697        ("'abc'.normalize('NFD')", "abc"),
4698        ("(function(){ try { 'x'.normalize('bogus'); return 'no-throw'; } catch(e) { return 'threw'; } })()", "threw"),
4699        // 西欧言語の分音符付きラテン文字に限定した部分実装の NFC/NFD 検証
4700        ("'e\\u0301'.normalize('NFC') === '\\u00e9'", "true"),
4701        ("'\\u00e9'.normalize('NFD') === 'e\\u0301'", "true"),
4702        ("'\\u00e9'.normalize('NFC') === '\\u00e9'", "true"),
4703        // オプショナルチェイニング `a?.[b]`(computed member)。以前は Index に optional
4704        // フラグ自体が存在せず、常に通常のプロパティアクセスとして評価され null/undefined
4705        // で TypeError になっていた(`a?.b` の識別子版は動いていたが `[]` 版だけ壊れていた)。
4706        ("var a=null; a?.['x']", "undefined"),
4707        ("var a=undefined; a?.[0]", "undefined"),
4708        ("var a=[1,2,3]; a?.[1]", "2"),
4709        ("var f=null; f?.['x'](1,2)", "undefined"),
4710        // オプショナルチェイン全体の短絡伝播。以前は直近1段しか短絡せず `a?.b.c` は
4711        // `a` が null/undefined のとき後続の `.c` アクセスで TypeError になっていた。
4712        ("var a=null; a?.b.c", "undefined"),
4713        ("var a=undefined; a?.b.c.d", "undefined"),
4714        ("var a=null; a?.b[0].c", "undefined"),
4715        ("var a=null; a?.b()", "undefined"),
4716        ("var o={b:{c:5}}; o?.b.c", "5"),
4717        // for...in がプロトタイプ連鎖上の継承プロパティを列挙しないバグ。以前は自身の
4718        // プロパティのみだった。
4719        ("(function(){ function Base(){} Base.prototype.x=1; function D(){this.y=2;} D.prototype=Object.create(Base.prototype); var d=new D(); var ks=[]; for(var k in d) ks.push(k); return ks.sort().join(','); })()", "x,y"),
4720        // 【2026-11-16】`Base.prototype.constructor` は列挙しない(V8 と同じ)ので期待値から外した。
4721        // 自身のプロパティがプロトタイプ側の同名キーを覆い隠す(重複しない)ことも確認。
4722        ("(function(){ function Base(){} Base.prototype.x=1; function D(){this.x=99;} D.prototype=Object.create(Base.prototype); var d=new D(); var ks=[]; for(var k in d) ks.push(k); return ks.sort().join(','); })()", "x"),
4723        // `in` 演算子・for-in が accessors(getter/setter 限定プロパティ)専用マップを
4724        // 見ておらず「無い」扱いになっていたバグ。
4725        ("'x' in {get x(){return 1;}}", "true"),
4726        ("(function(){ var o={get x(){return 1;}}; var ks=[]; for(var k in o) ks.push(k); return ks.join(','); })()", "x"),
4727        // Object.keys/values/entries/assign も同じ accessors 見落としバグがあった。
4728        ("Object.keys({get x(){return 1;}}).join(',')", "x"),
4729        ("Object.values({get x(){return 42;}}).join(',')", "42"),
4730        ("JSON.stringify(Object.entries({get x(){return 7;}}))", "[[\"x\",7]]"),
4731        ("Object.assign({}, {get x(){return 9;}}).x", "9"),
4732        // JSON.stringify も同じ accessors 見落としバグがあった。
4733        ("JSON.stringify({get x(){return 5;}})", "{\"x\":5}"),
4734        // オブジェクトスプレッド {...src} も同じ accessors 見落としバグがあった。
4735        ("({...{get x(){return 3;}}}).x", "3"),
4736        ("var s={get x(){return 1;}}; var o={...s, y:2}; o.x+','+o.y", "1,2"),
4737        // Number.prototype.toExponential/toPrecision/valueOf — 丸ごと欠落していた。
4738        ("(150).toExponential(2)", "1.50e+2"),
4739        // 0.0012345 は 2 進では 0.00123449999… なので、正しくは切り捨て(V8 も "1.234e-3"。以前の期待値 "1.235e-3" は
4740        // f64 の掛け算で丸めていた頃の誤った値。2026-11-13)。
4741        ("(0.0012345).toExponential(3)", "1.234e-3"),
4742        ("(123.456).toPrecision(5)", "123.46"),
4743        ("(0.0001234).toPrecision(2)", "0.00012"),
4744        ("(123456).toPrecision(2)", "1.2e+5"),
4745        ("(5).valueOf()", "5"),
4746        // `Number.prototype.toFixed(fractionDigits)` は仕様上 `fractionDigits` が
4747        // 0〜100 の範囲外なら RangeError を投げる必要があるが、以前は範囲外/非有限値を
4748        // 黙って0にクランプするだけで上限チェックが無く、`(1).toFixed(500)` のような
4749        // 呼び出しが `10^500`(Infinity)経由で壊れた出力になり得た。
4750        ("(1).toFixed(0)", "1"),
4751        ("(1.5).toFixed(100).length", "102"),
4752        (
4753            "try { (1).toFixed(-1); 'no-throw' } catch(e) { 'threw' }",
4754            "threw",
4755        ),
4756        (
4757            "try { (1).toFixed(101); 'no-throw' } catch(e) { 'threw' }",
4758            "threw",
4759        ),
4760        ("(NaN).toFixed(2)", "NaN"),
4761        ("(Infinity).toFixed(2)", "Infinity"),
4762        // Array.prototype.toLocaleString / Number.prototype.toLocaleString — 丸ごと欠落。
4763        ("[1,2,3].toLocaleString()", "1,2,3"),
4764        ("[1,null,undefined,2].toLocaleString()", "1,,,2"),
4765        // Number.prototype.toLocaleString は `toString()` の別名でしかなく、実際のブラウザなら
4766        // `Intl` 非搭載でも入る3桁区切りのカンマが欠落していた(2026-07-09に修正)。
4767        ("(1234.5).toLocaleString()", "1,234.5"),
4768        ("(1234567).toLocaleString()", "1,234,567"),
4769        ("(123).toLocaleString()", "123"),
4770        ("(-1234567.89).toLocaleString()", "-1,234,567.89"),
4771        // `Intl` グローバルが丸ごと未対応だった。ロケール/オプション引数は無視するが、
4772        // `new Intl.NumberFormat().format(n)` という最頻出イディオムだけは救う最小実装。
4773        ("new Intl.NumberFormat().format(1234567)", "1,234,567"),
4774        ("new Intl.NumberFormat('en-US').format(-1234.5)", "-1,234.5"),
4775        ("typeof Intl.NumberFormat().format", "function"),
4776        ("(0).toLocaleString()", "0"),
4777        ("(NaN).toLocaleString()", "NaN"),
4778        // 【2026-11-18】ロケール・オプション付きの数の書式(期待値は Node v22。詳細の照合はホスト試験 test_js_numloc)。
4779        ("(0.256).toLocaleString('en-US',{style:'percent'})", "26%"),
4780        ("(1234.5).toLocaleString('de-DE')", "1.234,5"),
4781        ("(1234.5).toLocaleString('en-US',{style:'currency',currency:'USD'})", "$1,234.50"),
4782        ("new Intl.NumberFormat('en',{notation:'compact'}).format(1234567)", "1.2M"),
4783        ("new Intl.NumberFormat('ja-JP',{notation:'compact'}).format(12345)", "1.2万"),
4784        ("(1234.5).toLocaleString('en-US',{maximumFractionDigits:0})", "1,235"),
4785        ("1e21.toLocaleString('en-US')", "1,000,000,000,000,000,000,000"),
4786        ("try{new Intl.NumberFormat('xx-invalid-locale-zzzzzzzzzz');'ok'}catch(e){e.name}", "RangeError"),
4787        ("[1,2,3].map(new Intl.NumberFormat('en').format).join()", "1,2,3"),
4788        // 値の包みオブジェクト・配列の添字・関数のソース・`yield*` の値・`Reflect.get` の receiver・`Error.captureStackTrace`。
4789        ("[new Number(5)+1, new String('ab').length, Object(1) instanceof Number, JSON.stringify(new String('s')), new Number(1)==1].join()", "6,2,true,\"s\",true"),
4790        ("var a=[];a['01']=2;a[1]=3;[a.length,a['01'],a[1],Object.keys(a).join('|')].join()", "2,2,3,1|01"),
4791        ("var f=(a,b)=>a+b; var o={m(a){return a}}; [f.toString(), o.m.toString(), (class A{ m(){} }).toString()].join('|')", "(a,b)=>a+b|m(a){return a}|class A{ m(){} }"),
4792        ("function*i(){yield 1;return 'r'} function*o(){var x=yield* i();yield x} [...o()].join()", "1,r"),
4793        ("Reflect.get({get a(){return this.b},b:2},'a',{b:9})", "9"),
4794        ("var o={};Error.captureStackTrace(o);typeof o.stack+typeof Error.stackTraceLimit", "stringnumber"),
4795        ("Object.getPrototypeOf(async function(){}).constructor.name+','+Object.getPrototypeOf(function*(){}).constructor.name", "AsyncFunction,GeneratorFunction"),
4796        ("String(Math)+Math.exp(1)", "[object Math]2.718281828459045"),
4797        ("Object.keys(new Proxy({},{ownKeys:()=>['a','b'],getOwnPropertyDescriptor:()=>({value:1,enumerable:true,configurable:true})})).join()", "a,b"),
4798        ("(Infinity).toLocaleString()", "∞"),
4799        // Boolean プリミティブへのプロパティアクセスが一律 undefined になり、メソッド呼出
4800        // 自体が丸ごと欠落していたバグ(プリミティブ中 Boolean だけメソッドが皆無だった)。
4801        ("true.toString()", "true"),
4802        ("false.toString()", "false"),
4803        ("true.valueOf()", "true"),
4804        ("(false).valueOf() === false", "true"),
4805        // 関数の name/length が丸ごと欠落していたバグ。
4806        ("function foo(a,b){} foo.name", "foo"),
4807        ("function foo(a,b){} foo.length", "2"),
4808        ("function foo(a,b=1,...c){} foo.length", "1"),
4809        ("(function(){}).length", "0"),
4810        // 【2026-11-16】組み込みの length は仕様の値(V8 と同じ。以前は常に 0 を期待していた)。
4811        ("Math.max.length", "2"),
4812        // `Function.prototype.bind()` が返す関数の `.name`/`.length` が丸ごと未対応で
4813        // 常に `undefined` になっていた。
4814        // 【2026-09-26】`Function.prototype` が存在しなかった(OpenStreetMap 埋め込みで発見)。
4815        ("typeof Function.prototype", "object"),
4816        ("typeof Function.prototype.toString", "function"),
4817        ("function foo(){} Function.prototype.toString.call(foo).includes('foo')", "true"),
4818        ("function add(a,b){return a+b} Function.prototype.call.call(add, null, 2, 3)", "5"),
4819        ("var of = 7; of + 1", "8"),
4820        ("0x10000000000000000 === 18446744073709551616", "true"),
4821        ("function foo(a,b,c){} foo.bind(null).name", "bound foo"),
4822        ("function foo(a,b,c){} foo.bind(null).length", "3"),
4823        ("function foo(a,b,c){} foo.bind(null,1).length", "2"),
4824        ("function foo(a,b,c){} foo.bind(null,1,2,3,4).length", "0"),
4825        // 束縛済み関数の文字列化(`String(fn.bind(...))`)も専用ケースが無く
4826        // `[object Object]` に落ちるバグだった。
4827        (
4828            "function foo(){} String(foo.bind(null)).includes('native code')",
4829            "true",
4830        ),
4831        // `Object.prototype.toString.call(x)` が `this` の実際の種別を一切見ず
4832        // 常に `[object Object]` を返すバグだった(`lodash` 等で広く使われる
4833        // 型判定イディオムが配列/Map/Set/Date/RegExp/関数のいずれに対しても
4834        // 機能しなくなる、実用上かなり影響の大きいバグ)。
4835        ("Object.prototype.toString.call([1,2])", "[object Array]"),
4836        ("Object.prototype.toString.call({})", "[object Object]"),
4837        ("Object.prototype.toString.call(new Date())", "[object Date]"),
4838        ("Object.prototype.toString.call(/a/)", "[object RegExp]"),
4839        ("Object.prototype.toString.call(new Map())", "[object Map]"),
4840        ("Object.prototype.toString.call(new Set())", "[object Set]"),
4841        ("Object.prototype.toString.call(function(){})", "[object Function]"),
4842        ("Object.prototype.toString.call(null)", "[object Null]"),
4843        ("Object.prototype.toString.call(undefined)", "[object Undefined]"),
4844        // `Symbol.toStringTag`(クラスでカスタムタグを定義する仕組み)も一切考慮して
4845        // いなかった。データプロパティ/アクセサ(getter)どちらの定義方法も動くこと。
4846        (
4847            "class Foo { get [Symbol.toStringTag](){ return 'Foo'; } } Object.prototype.toString.call(new Foo())",
4848            "[object Foo]",
4849        ),
4850        (
4851            "var o={}; o['Symbol(Symbol.toStringTag)']='Bar'; Object.prototype.toString.call(o)",
4852            "[object Bar]",
4853        ),
4854        // NamedEvaluation(ES2015): `const f = function(){}`/`const f = () => {}` の
4855        // ような無名関数式を単純な識別子へ代入すると、その識別子名を `.name` として
4856        // 継承する仕様が丸ごと未対応で、常に空文字列のままだった。
4857        ("var f = function(){}; f.name", "f"),
4858        ("var g = () => {}; g.name", "g"),
4859        // 既に名前を持つ関数式(`function foo(){}`)は変数名で上書きされない。
4860        ("var h = function foo(){}; h.name", "foo"),
4861        // object literal のプロパティ値としての無名関数式も同様にキー名を継承する。
4862        ("({bar: function(){}}).bar.name", "bar"),
4863        ("({baz: () => {}}).baz.name", "baz"),
4864        // メソッド短縮記法は元々キー名を持つため、この継承の影響を受けない
4865        // (上書きではなく「無名の場合のみ設定」であることの確認)。
4866        ("({qux(){}}).qux.name", "qux"),
4867        // structuredClone(Date/RegExp) — 実データが props に無く plain object 化に落ちて
4868        // 消えてしまうバグ(Map/Set と同種)。
4869        ("var d=new Date(2020,0,1); var c=structuredClone(d); c.getTime()===d.getTime() && c!==d", "true"),
4870        ("var r=/abc/gi; var c=structuredClone(r); c.source+','+c.flags+','+(c!==r)", "abc,gi,true"),
4871        // 分割代入の rest ({...rest}) も同じ accessors 見落としバグがあった。
4872        ("var o={get x(){return 1;}, y:2}; var {y, ...rest} = o; rest.x+','+rest.y", "1,undefined"),
4873        // hasOwnProperty/Object.hasOwn が accessors と配列インデックス/length を
4874        // 見落とすバグ。
4875        ("({get x(){return 1;}}).hasOwnProperty('x')", "true"),
4876        ("[1,2,3].hasOwnProperty(0)", "true"),
4877        ("[1,2,3].hasOwnProperty('length')", "true"),
4878        ("[1,2,3].hasOwnProperty(5)", "false"),
4879        ("Object.hasOwn({get x(){return 1;}}, 'x')", "true"),
4880        ("({}).toLocaleString()", "[object Object]"),
4881        ("[{}, {}].toLocaleString()", "[object Object],[object Object]"),
4882        // Object.getOwnPropertyDescriptor(s) が配列の数値インデックス/length を見落とし
4883        // 常に undefined になるバグ。
4884        ("Object.getOwnPropertyDescriptor([1,2,3], '0').value", "1"),
4885        ("Object.getOwnPropertyDescriptor([1,2,3], 'length').value", "3"),
4886        ("Object.keys(Object.getOwnPropertyDescriptors([1,2])).sort().join(',')", "0,1,length"),
4887        // Object.defineProperty が配列の数値インデックス/length に書き込んでも
4888        // 実データ(ObjKind::Array)側に反映されないバグ。
4889        ("var a=[1,2,3]; Object.defineProperty(a,'0',{value:99}); a[0]", "99"),
4890        ("var a=[1,2]; Object.defineProperty(a,'5',{value:9}); a.length+','+a[5]", "6,9"),
4891        ("var a=[1,2,3]; Object.defineProperty(a,'length',{value:1}); a.join(',')", "1"),
4892        // Array/Map/Set の Symbol.iterator が丸ごと未登録で、明示呼出し
4893        // (`arr[Symbol.iterator]()`)が「関数ではない」になっていたバグ。for...of は
4894        // 内部高速経路のため気づかれなかった。
4895        ("[...[1,2,3][Symbol.iterator]()].join(',')", "1,2,3"),
4896        ("var m=new Map([['a',1]]); [...m[Symbol.iterator]()][0].join(',')", "a,1"),
4897        ("[...new Set([1,2])[Symbol.iterator]()].join(',')", "1,2"),
4898        // entries/keys/values が本物の Iterator(`.next()`/`Symbol.iterator` 持ち)ではなく
4899        // 単なる配列を返しており、明示的なイテレータプロトコル駆動
4900        // (`const it = arr.values(); it.next()`) が「next が存在しない」で壊れていたバグ。
4901        ("var it=[10,20].values(); it.next().value+','+it.next().value+','+it.next().done", "10,20,true"),
4902        ("var it=[1,2].entries(); it.next().value.join(',')", "0,1"),
4903        ("var it=[1,2].keys(); it.next().value+','+it.next().value", "0,1"),
4904        ("var it=new Map([['a',1]]).entries(); it.next().value.join(',')", "a,1"),
4905        ("var it=new Set([5,6]).values(); it.next().value+','+it.next().value", "5,6"),
4906        ("var it=[1].values(); it[Symbol.iterator]()===it", "true"),
4907        // String.prototype[Symbol.iterator] が丸ごと欠落していたバグ。
4908        ("[...'ab'[Symbol.iterator]()].join(',')", "a,b"),
4909        ("var it='xy'[Symbol.iterator](); it.next().value+it.next().value+it.next().done", "xytrue"),
4910        // 上記の Iterator 化に伴う回帰: Array.from/new Map/new Set が新しい軽量イテレータ
4911        // オブジェクト(entries/keys/values の戻り値)を「iterable」として認識できず
4912        // 空になっていたバグ(本イテレータ導入時に発見・即修正)。
4913        ("Array.from([10,20].values()).join(',')", "10,20"),
4914        ("Array.from([1,2].entries()).map(e=>e.join(':')).join(',')", "0:1,1:2"),
4915        ("var m=new Map(new Map([['a',1]]).entries()); m.get('a')", "1"),
4916        ("var s=new Set([1,2,2,3].values()); [...s].join(',')", "1,2,3"),
4917        // イテレータの内部実装詳細(_items/_pos)が Object.keys/JSON.stringify/spread から
4918        // 見えてしまう漏れ(make_iterator 導入時に発見・即修正)。
4919        ("Object.keys([1,2].values()).length", "0"),
4920        ("JSON.stringify([1,2].values())", "{}"),
4921        ("Object.keys({...[1,2].values()}).length", "0"),
4922        // AggregateError(ES2021)が丸ごと欠落していた。Promise.any が全滅した際に
4923        // 最後の reject 理由しか見えず、`.errors` を持つ AggregateError も
4924        // 投げられていなかった。
4925        ("new AggregateError([1,2],'m').errors.join(',')", "1,2"),
4926        ("new AggregateError([],'m') instanceof Error", "true"),
4927        (
4928            "await Promise.any([Promise.reject('a'),Promise.reject('b')]).catch(e => e.name+':'+e.errors.join(','))",
4929            "AggregateError:a,b",
4930        ),
4931        // Date の日時文字列パース(ISO 8601)が丸ごと非対応だった(`new Date("2024-01-15")`
4932        // が Invalid Date になっていた)。
4933        ("new Date('2024-01-15').getFullYear()+'-'+(new Date('2024-01-15').getMonth()+1)+'-'+new Date('2024-01-15').getDate()", "2024-1-15"),
4934        ("Date.parse('2024-01-15T00:00:00Z')", "1705276800000"),
4935        ("Date.parse('2024-01-15T02:00:00+02:00')", "1705276800000"),
4936        // コロン無しタイムゾーンオフセット(`+0900` 形式。ISO 8601/ECMA-262 双方で正当)
4937        ("Date.parse('2024-01-15T09:00:00+0900')", "1705276800000"),
4938        ("Date.parse('2024-01-15T00:00:00+00')", "1705276800000"),
4939        ("new Date('2024-01-15T00:00:00.500Z').getTime()", "1705276800500"),
4940        ("isNaN(Date.parse('not a date'))", "true"),
4941        // RFC 2822 形式(HTTP日付ヘッダ等の定番書式)が丸ごと非対応で、ISO 8601以外の
4942        // 文字列は常に NaN になっていたバグ。曜日名の有無・タイムゾーンオフセット双方を
4943        // 確認する。
4944        ("Date.parse('Mon, 15 Jan 2024 00:00:00 GMT')", "1705276800000"),
4945        ("Date.parse('15 Jan 2024 00:00:00 GMT')", "1705276800000"),
4946        ("Date.parse('Mon, 15 Jan 2024 02:00:00 +0200')", "1705276800000"),
4947        // `Date.now`/`Date.parse` は登録済みだったが `Date.UTC` が丸ごと未対応だった。
4948        ("Date.UTC(2024, 0, 15) === Date.parse('2024-01-15T00:00:00Z')", "true"),
4949        ("new Date(Date.UTC(2024,0,15,10,30,0)).getUTCHours()", "10"),
4950        // 省略引数の既定値(day のみ1、他は0)。
4951        ("new Date(Date.UTC(2024,0)).getDate()", "1"),
4952        ("new Date('Mon, 15 Jan 2024 00:00:00 GMT').getFullYear()", "2024"),
4953        // RegExp 名前付きキャプチャグループ (?<name>...)(ES2018)が丸ごと非対応で
4954        // `(?<`(lookbehind と誤認され `:` フォールバックと同じ経路)を通ると壊れた
4955        // パース結果になり、`match.groups` は常に undefined だった。
4956        ("'2024-01-15'.match(/(?<year>\\d+)-(?<month>\\d+)-(?<day>\\d+)/).groups.year", "2024"),
4957        ("'2024-01-15'.match(/(?<year>\\d+)-(?<month>\\d+)-(?<day>\\d+)/).groups.month", "01"),
4958        ("/(?<a>x)(y)/.exec('xy')[2]", "y"),
4959        ("/(x)/.exec('x').groups", "undefined"),
4960        ("[...'a1 b2'.matchAll(/(?<letter>[a-z])(?<num>\\d)/g)].map(m=>m.groups.letter+m.groups.num).join(',')", "a1,b2"),
4961        // replace() の $<name> 置換パターン(ES2018)が丸ごと非対応だった。合わせて
4962        // $`(一致より前)/$'(一致より後)も未対応だった。
4963        ("'2024-01-15'.replace(/(?<y>\\d+)-(?<m>\\d+)-(?<d>\\d+)/, '$<d>/$<m>/$<y>')", "15/01/2024"),
4964        ("'abc'.replace(/b/, \"[$`|$']\")", "a[a|c]c"),
4965        ("'x'.replace(/(?<a>x)/, (m,a,off,str,groups)=>groups.a+'!')", "x!"),
4966        // RegExp の \uXXXX/\u{X...}/\xXX エスケープが丸ごと未対応で、`A` が文字コード
4967        // 指定ではなく `u0041`(5文字のリテラル)として誤解釈されていたバグ。
4968        ("/\\u0041/.test('A')", "true"),
4969        ("/\\u{1F600}/u.test('\\u{1F600}')", "true"),
4970        ("/\\x41/.test('A')", "true"),
4971        ("'A1'.match(/\\u0041\\d/)[0]", "A1"),
4972        // 文字クラス内の \uXXXX/\xXX(範囲の端点含む)も同じバグがあった。
4973        ("/[\\u0041-\\u005A]/.test('M')", "true"),
4974        ("/[\\x41-\\x5A]/.test('Z')", "true"),
4975        ("/[\\u0041-\\u005A]/.test('m')", "false"),
4976        // String.prototype.split(regexp) がキャプチャグループを結果に含めないバグ
4977        // (仕様上、区切りに使った正規表現のキャプチャは結果配列に挿入される)。
4978        ("'a1b2c'.split(/(\\d)/).join('|')", "a|1|b|2|c"),
4979        ("'axb'.split(/(x)|(y)/).join(',')", "a,x,,b"),
4980        ("'abc'.split(/b/).join(',')", "a,c"),
4981        // クラス/オブジェクトリテラルの async/generator メソッド短縮記法が丸ごと
4982        // 未認識で、`*`/`async` に遭遇するとキー解析がその場で失敗し、メンバ自体が
4983        // 消えるだけでなく後続メンバの解析まで壊れる重大バグだった。
4984        ("class C { *gen(){ yield 1; yield 2; } } [...new C().gen()].join(',')", "1,2"),
4985        ("await (new (class C { async f(){ return 42; } })()).f()", "42"),
4986        ("class C { *gen(){ yield 'a'; } method(){ return 'm'; } } var c=new C(); [...c.gen()].join(',')+c.method()", "am"),
4987        ("[...{ *gen(){ yield 1; yield 2; } }.gen()].join(',')", "1,2"),
4988        ("await { async f(){ return 'ok'; } }.f()", "ok"),
4989        // static + async/generator の組み合わせ、および算出メソッド名との組み合わせ。
4990        ("await (class C { static async f(){ return 7; } }).f()", "7"),
4991        ("class C { static *gen(){ yield 9; } } [...C.gen()].join(',')", "9"),
4992        ("class C { *[Symbol.iterator](){ yield 3; } } [...new C()].join(',')", "3"),
4993        ("({ async *gen(){}, method(){ return 'ok'; } }).method()", "ok"),
4994        // 分割代入の算出プロパティ名 `{[expr]: target}` が丸ごと未認識で、`[` に遭遇すると
4995        // パターン解析全体が壊れる(後続プロパティも巻き添え)バグだった。
4996        ("var k='x'; var {[k]: v} = {x: 42}; v", "42"),
4997        ("var k='a'; var {[k]: v, y} = {a: 1, y: 2}; v+','+y", "1,2"),
4998        ("var k='n'; function f({[k]: val}){ return val; } f({n: 7})", "7"),
4999        // 直前の async/generator 修飾子検出の実装ミス("async"/"*" を常に修飾子として
5000        // 消費してしまい、"async" という名前の通常プロパティ/フィールド自体が壊れる
5001        // 新規回帰)を発見・即修正。
5002        ("({ async: 1, b: 2 }).async + ({ async: 1, b: 2 }).b", "3"),
5003        ("class C { async = 5; b = 6; } var c = new C(); c.async + c.b", "11"),
5004        // "static" の修飾子誤認識も同じバグ族(`static`/`async`/`*` 全てに共通の
5005        // 「次が `(` でなければ無条件で修飾子」という緩すぎる判定)だった。
5006        ("class C { static = 5; b = 6; } var c = new C(); c.static + c.b", "11"),
5007        ("class C { static x = 1; static method(){ return 2; } } C.x + C.method()", "3"),
5008        // get/set の算出プロパティ名 `get [expr](){}` がアクセサとして認識されず、
5009        // "get"/"set" という名前の孤立フィールド+無関係なメソッドに分解される
5010        // バグだった。
5011        ("var k='x'; var o={ get [k](){ return 42; } }; o.x", "42"),
5012        ("var k='y'; var o={y:0, set [k](v){ this._y=v; } }; o.y=5; o._y", "5"),
5013        ("var k='z'; class C { get [k](){ return 9; } } new C().z", "9"),
5014        // for(let i=...) の反復ごとの束縛(per-iteration binding)が丸ごと未対応で、
5015        // ループ内で作ったクロージャが全て同じ最終値を捕捉してしまうバグだった
5016        // (`var` は対象外で仕様どおり単一束縛のまま)。
5017        ("var a=[]; for(let i=0;i<3;i++){ a.push(()=>i); } a.map(f=>f()).join(',')", "0,1,2"),
5018        ("var a=[]; for(var i=0;i<3;i++){ a.push(()=>i); } a.map(f=>f()).join(',')", "3,3,3"),
5019        ("var a=[]; for(let i=0;i<3;i++){ if(i===1) continue; a.push(()=>i); } a.map(f=>f()).join(',')", "0,2"),
5020        // for-of/for-in の let/const も同じ反復ごとの束縛が必要(var は対象外)。
5021        ("var a=[]; for(const x of [1,2,3]){ a.push(()=>x); } a.map(f=>f()).join(',')", "1,2,3"),
5022        ("var a=[]; for(var x of [1,2,3]){ a.push(()=>x); } a.map(f=>f()).join(',')", "3,3,3"),
5023        ("var a=[]; for(let k in {a:1,b:2}){ a.push(()=>k); } a.map(f=>f()).join(',')", "a,b"),
5024        // 配列プロトタイプメソッドのほぼ全てが使う共通ヘルパ this_items/this_objref が
5025        // Proxy を素通しできず、Proxy でラップした配列へメソッド呼出し
5026        // (`.map()`/`.push()` 等)すると常に空扱いになるバグだった(for...of/スプレッドは
5027        // 別経路で既に対応済みだったが、メソッド呼出し経由は漏れていた)。
5028        ("new Proxy([1,2,3],{}).map(x=>x*2).join(',')", "2,4,6"),
5029        ("var p=new Proxy([1,2],{}); p.push(3); p.join(',')", "1,2,3"),
5030        ("new Proxy([5,6,7],{}).indexOf(6)", "1"),
5031        // `String(proxy)`/文字列連結/テンプレートリテラル補間が使う
5032        // `Value::to_js_string` にも同種の Proxy 素通しバグがあり、`ObjKind::Proxy`
5033        // 専用ケースが無く汎用の "[object Object]" に落ちていた。
5034        ("String(new Proxy([1,2,3], {}))", "1,2,3"),
5035        ("'' + new Proxy([7,8], {})", "7,8"),
5036        // Map/Set の全メソッドが使う with_map/with_set にも同じ Proxy 素通しバグがあった。
5037        ("var p=new Proxy(new Map([['a',1]]),{}); p.get('a')", "1"),
5038        ("var p=new Proxy(new Set([1,2]),{}); p.add(3); [...p].join(',')", "1,2,3"),
5039        // WeakSet / Promise / Generator の共通ヘルパにも同じ Proxy 素通しバグがあった。
5040        ("var o={}; var p=new Proxy(new WeakSet([o]),{}); p.has(o)", "true"),
5041        ("await new Proxy(Promise.resolve(5), {}).then(x=>x*2)", "10"),
5042        ("function* g(){ yield 1; yield 2; } var p=new Proxy(g(),{}); [...p].join(',')", "1,2"),
5043        // String.fromCharCode/fromCodePoint が同じ実装を共有しており、fromCharCode の
5044        // サロゲートペア結合(絵文字1文字を表す ES1 以来の定番イディオム)が壊れていた。
5045        ("String.fromCharCode(72,105)", "Hi"),
5046        ("String.fromCharCode(0xD83D,0xDE00)", "\u{1F600}"),
5047        ("String.fromCodePoint(0x1F600)", "\u{1F600}"),
5048        ("String.fromCodePoint(72,105)", "Hi"),
5049        // Object.create(proto, propertiesObject) の第2引数が丸ごと無視されていたバグ。
5050        ("Object.create(null, {x:{value:5}}).x", "5"),
5051        ("var o=Object.create(null, {y:{value:9}, z:{value:1}}); o.y + o.z", "10"),
5052        // JSON.stringify の toJSON() フックが Date 専用の特別扱いのみで、任意のオブジェクトに
5053        // 定義できる汎用フックとして機能していなかった。
5054        ("JSON.stringify({toJSON(){ return 42; }})", "42"),
5055        ("JSON.stringify({a: {toJSON(){ return 'x'; }}})", "{\"a\":\"x\"}"),
5056        ("JSON.stringify([{toJSON(){ return 1; }}, 2])", "[1,2]"),
5057        // 数値セパレータ `_`(ES2021)が丸ごと未対応で、`1_000` の `_` の時点で数値
5058        // リテラルが打ち切られ、残りが別トークン(識別子)として構文解析を静かに
5059        // 壊すバグだった。
5060        ("1_000_000", "1000000"),
5061        ("0x1_000", "4096"),
5062        ("1_000.5_5", "1000.55"),
5063        // `0o`(8進)/`0b`(2進)リテラルがソースコード上で丸ごと未対応で、`0` だけ
5064        // 数値トークンとして打ち切られ `o17`/`b101` が別の識別子トークンになり
5065        // 構文解析が静かに壊れるバグだった(16進 `0x` は既存で対応済みだったのと非対称)。
5066        ("0o17", "15"),
5067        ("0b101", "5"),
5068        ("0o17 + 0b101", "20"),
5069        ("0b101n + 2n", "7"),
5070        // 文字列リテラル中の行継続(`\` の直後の改行)が仕様上「何も追加しない」はずが、
5071        // 改行文字そのものを値に混入させていたバグ。
5072        ("'abc\\\ndef'", "abcdef"),
5073        ("'abc\\\r\ndef'.length", "6"),
5074        // toReversed — 元配列を変更しない。
5075        ("var a=[1,2,3]; var r=a.toReversed(); a[0]+'/'+r.join(',')", "1/3,2,1"),
5076        // toSpliced — 元配列を変更しない。
5077        ("var a=[1,2,3]; var s=a.toSpliced(1,1,9); a.join(',')+'/'+s.join(',')", "1,2,3/1,9,3"),
5078        // toSpliced — deleteCount 省略時は末尾まで削除するが、明示的な `undefined` は
5079        // 仕様上 `ToIntegerOrInfinity(undefined)` = 0(省略とは異なる)扱いになる。
5080        ("[1,2,3].toSpliced(1).join(',')", "1"),
5081        ("[1,2,3].toSpliced(1, undefined).join(',')", "1,2,3"),
5082        // Array.prototype.concat — `Symbol.isConcatSpreadable` が丸ごと未対応で、
5083        // 常に `ObjKind::Array` かどうかだけで展開の有無を決めていたバグ。
5084        // 配列に `[Symbol.isConcatSpreadable]=false` を明示すると展開されず単一要素になる。
5085        (
5086            "var a=[1,2]; a[Symbol.isConcatSpreadable]=false; [0].concat(a).length",
5087            "2",
5088        ),
5089        // 非配列の array-like に `Symbol.isConcatSpreadable=true` を明示すると
5090        // `length`+添字プロパティから展開される。
5091        (
5092            "var o={0:'x',1:'y',length:2}; o[Symbol.isConcatSpreadable]=true; [0].concat(o).join(',')",
5093            "0,x,y",
5094        ),
5095        // フラグ未指定時は従来どおり配列のみ自動展開、非配列は単一要素のまま。
5096        ("[1].concat([2,3],4).join(',')", "1,2,3,4"),
5097        // `Array.prototype.join` は仕様上ジェネリックメソッド(`this` の `length` +
5098        // 添字プロパティだけを見る)だが、以前は `ObjKind::Array` 以外を無条件で空扱いし
5099        // 配列インスタンスから取り出した `join` を array-like へ `.call()` しても
5100        // 常に `""` になっていた(この処理系はメソッド解決を `ObjKind::Array` の
5101        // プロパティ取得時にのみ行う簡略実装のため、実際に呼び出し可能な関数値を
5102        // 得るには `Array.prototype.join` ではなく実配列インスタンスから取り出す)。
5103        (
5104            "var f=[].join; f.call({0:'a',1:'b',length:2}, '-')",
5105            "a-b",
5106        ),
5107        // `push`/`pop`/`shift`/`unshift` は仕様上ミューテートするメソッドの中でも
5108        // 特にジェネリック(`length` を介して任意の array-like を書き換える)
5109        // ことが要求される定番のイディオム(`Array.prototype.push.call(arguments, x)` 等)。
5110        (
5111            "var o={length:0}; var f=[].push; f.call(o,'a','b')+','+o.length+','+o[0]+','+o[1]",
5112            "2,2,a,b",
5113        ),
5114        (
5115            "var o={0:'a',1:'b',length:2}; var f=[].pop; f.call(o)+','+o.length",
5116            "b,1",
5117        ),
5118        (
5119            "var o={0:'a',1:'b',length:2}; var f=[].shift; f.call(o)+','+o.length+','+o[0]",
5120            "a,1,b",
5121        ),
5122        (
5123            "var o={0:'a',length:1}; var f=[].unshift; f.call(o,'x','y')+','+o.length+','+o[0]+','+o[1]+','+o[2]",
5124            "3,3,x,y,a",
5125        ),
5126        // 通常の配列に対する挙動には回帰なし。
5127        ("[1,2,3].join('-')", "1-2-3"),
5128        // `arguments.callee`(Annex B。無名関数の自己再帰呼び出しイディオム)が
5129        // 丸ごと未対応だった。
5130        (
5131            "var fact = function(n){ return n <= 1 ? 1 : n * arguments.callee(n - 1); }; fact(5)",
5132            "120",
5133        ),
5134        ("var g = function(){ return arguments.callee === g; }; g()", "true"),
5135        // 名前付き関数式の自己参照束縛(`(function f(){ ...f... })()` で `f` を
5136        // 本体内から参照できる仕様どおりの挙動)が丸ごと未対応だった。
5137        ("(function f(n){ return n<=1?1:n*f(n-1); })(5)", "120"),
5138        ("(function f(){ return typeof f; })()", "function"),
5139        // 外側スコープからは関数式自身の名前が見えない(仕様どおり)。
5140        ("(function f(){})(); typeof f", "undefined"),
5141        // `Array.prototype.slice` も同じジェネリックメソッド未対応バグがあった
5142        // (`join`/`concat` と同型。`this_items` が `ObjKind::Array` 以外を無条件で
5143        // 空 `Vec` 扱いしていたため array-like への適用が常に `[]` になっていた)。
5144        (
5145            "var s=[].slice; s.call({0:'a',1:'b',length:2}, 0, 1).join(',')",
5146            "a",
5147        ),
5148        (
5149            "var s=[].slice; s.call({0:'a',1:'b',2:'c',length:3}, 1).join(',')",
5150            "b,c",
5151        ),
5152        // 通常の配列に対する挙動には回帰なし。
5153        ("[1,2,3,4].slice(1,3).join(',')", "2,3"),
5154        // `forEach`/`map`/`filter`/`indexOf`/`includes` にも同型のジェネリックメソッド
5155        // 未対応バグがあった(`join`/`slice`/`concat` で修正済みの続き)。array-like
5156        // (`arguments`/`NodeList` 等への `.call()` の定番イディオム)への適用が
5157        // 「何も反復しない/常に見つからない」結果になっていた。
5158        (
5159            "var out=''; var fe=[].forEach; fe.call({0:'a',1:'b',length:2}, function(v){ out+=v }); out",
5160            "ab",
5161        ),
5162        (
5163            "var m=[].map; m.call({0:1,1:2,length:2}, function(v){ return v*2 }).join(',')",
5164            "2,4",
5165        ),
5166        (
5167            "var fl=[].filter; fl.call({0:1,1:2,2:3,length:3}, function(v){ return v>1 }).join(',')",
5168            "2,3",
5169        ),
5170        (
5171            "var io=[].indexOf; io.call({0:'a',1:'b',length:2}, 'b')",
5172            "1",
5173        ),
5174        (
5175            "var inc=[].includes; inc.call({0:'a',1:'b',length:2}, 'b')",
5176            "true",
5177        ),
5178        // `reduce`/`find`/`findIndex`/`some`/`every` にも同型のジェネリックメソッド
5179        // 未対応バグがあった(`forEach`/`map`/`filter`/`indexOf`/`includes` の続き)。
5180        (
5181            "var r=[].reduce; r.call({0:1,1:2,2:3,length:3}, function(a,v){ return a+v }, 0)",
5182            "6",
5183        ),
5184        (
5185            "var fd=[].find; fd.call({0:1,1:2,2:3,length:3}, function(v){ return v>1 })",
5186            "2",
5187        ),
5188        (
5189            "var fi=[].findIndex; fi.call({0:1,1:2,2:3,length:3}, function(v){ return v>1 })",
5190            "1",
5191        ),
5192        (
5193            "var sm=[].some; sm.call({0:1,1:2,length:2}, function(v){ return v>1 })",
5194            "true",
5195        ),
5196        (
5197            "var ev=[].every; ev.call({0:1,1:2,length:2}, function(v){ return v>0 })",
5198            "true",
5199        ),
5200        (
5201            "var at=[].at; at.call({0:1,1:2,length:2}, -1)",
5202            "2",
5203        ),
5204        (
5205            "var fl=[].findLast; fl.call({0:1,1:2,length:2}, function(v){ return v<2 })",
5206            "1",
5207        ),
5208        (
5209            "var fli=[].findLastIndex; fli.call({0:1,1:2,length:2}, function(v){ return v<2 })",
5210            "0",
5211        ),
5212        (
5213            "var fm=[].flatMap; fm.call({0:1,1:2,length:2}, function(v){ return v*2 }).join(',')",
5214            "2,4",
5215        ),
5216        (
5217            "var rr=[].reduceRight; rr.call({0:1,1:2,length:2}, function(a,v){ return a+v })",
5218            "3",
5219        ),
5220        (
5221            "var lio=[].lastIndexOf; lio.call({0:1,1:1,length:2}, 1)",
5222            "1",
5223        ),
5224        (
5225            "var fla=[].flat; fla.call({0:1,1:[2,3],length:2}).join(',')",
5226            "1,2,3",
5227        ),
5228        (
5229            "var en=[].entries; var itr=en.call({0:1,1:2,length:2}); itr.next().value.join(',')",
5230            "0,1",
5231        ),
5232        (
5233            "var ky=[].keys; var itr=ky.call({0:1,1:2,length:2}); itr.next().value+','+itr.next().value",
5234            "0,1",
5235        ),
5236        (
5237            "var vl=[].values; var itr=vl.call({0:1,1:2,length:2}); itr.next().value+','+itr.next().value",
5238            "1,2",
5239        ),
5240        (
5241            "var tls=[].toLocaleString; tls.call({0:1,1:2,length:2})",
5242            "1,2",
5243        ),
5244        (
5245            "var o={0:1,1:2,length:2}; o[Symbol.isConcatSpreadable]=true; [].concat.call(o, 3).join(',')",
5246            "1,2,3",
5247        ),
5248        (
5249            "var o={0:1,1:2,length:2}; [].concat.call(o, 3).length",
5250            "2",
5251        ),
5252        (
5253            "var ts=[].toSorted; ts.call({0:3,1:1,length:2}).join(',')",
5254            "1,3",
5255        ),
5256        (
5257            "var tr=[].toReversed; tr.call({0:1,1:2,length:2}).join(',')",
5258            "2,1",
5259        ),
5260        (
5261            "var tsp=[].toSpliced; tsp.call({0:1,1:2,length:2}, 1, 0, 9).join(',')",
5262            "1,9,2",
5263        ),
5264        (
5265            "var w=[].with; w.call({0:1,1:2,length:2}, 0, 9).join(',')",
5266            "9,2",
5267        ),
5268        // 通常の配列に対する挙動には回帰なし。
5269        ("[1,2,3].map(function(v){return v*2}).join(',')", "2,4,6"),
5270        // with — 元配列を変更しない。
5271        ("var a=[1,2,3]; var b=a.with(1,9); a[1]+'/'+b[1]", "2/9"),
5272        // TypeError コンストラクタ。
5273        ("(function(){ try { throw new TypeError('bad'); } catch(e) { return e.name+':'+e.message; } })()", "TypeError:bad"),
5274        // RangeError コンストラクタ。
5275        ("(function(){ try { throw new RangeError('oor'); } catch(e) { return e.name; } })()", "RangeError"),
5276        // FinalizationRegistry — register は no-op (object が取れる)。
5277        ("typeof new FinalizationRegistry(function(){}).register", "function"),
5278        // requestIdleCallback — 呼んだ後で(同期的にではなく)コールバックが呼ばれ、didTimeout が false。
5279        ("var s=''; requestIdleCallback(function(d){ s += (!d.didTimeout && d.timeRemaining()>0) ? 'cb' : 'bad'; }); s += 'sync,'; await new Promise(r => setTimeout(r, 0)); s", "sync,cb"),
5280        // 時間切れ付きの待ち(kevlar の `ym`): 決まらない Promise の finally と、時間切れで reject する Promise の race。
5281        ("var r; try { await Promise.race([new Promise(function(){}).finally(function(){}), new Promise(function(q){ setTimeout(q, 0); }).then(function(){ return Promise.reject(Error('Va')); })]); r='res'; } catch(e) { r='rej '+e.message; } r", "rej Va"),
5282        // Promise.all / allSettled — 後から決まる要素を待つ(従来は undefined で即座に解決していた)。
5283        ("var r = await Promise.all([1, new Promise(function(q){ setTimeout(function(){ q(2); }, 0); })]); r.join(',')", "1,2"),
5284        ("var r = await Promise.allSettled([new Promise(function(q, j){ setTimeout(function(){ j(3); }, 0); })]); r[0].status + ':' + r[0].reason", "rejected:3"),
5285        // Promise.race — 後から決まった方で解決する。
5286        ("await Promise.race([new Promise(function(){}), new Promise(function(q){ setTimeout(function(){ q('late'); }, 0); })])", "late"),
5287        // cancelIdleCallback — 取り消したコールバックは呼ばれない。
5288        ("var c=0; var id=requestIdleCallback(function(){ c++; }); cancelIdleCallback(id); await new Promise(r => setTimeout(r, 0)); c", "0"),
5289        // Object.hasOwn — あり/なし。
5290        ("Object.hasOwn({x:1},'x')+','+Object.hasOwn({x:1},'y')", "true,false"),
5291        // Object.groupBy — 偶奇グループ。
5292        ("var g=Object.groupBy([1,2,3,4],function(n){return n%2===0?'e':'o'}); g.e.join(',')+'/'+g.o.join(',')", "2,4/1,3"),
5293        // Map.groupBy(ES2024)— Object.groupBy と違いキーを文字列化せず任意の値のまま使える。
5294        ("var m=Map.groupBy([1,2,3,4],function(n){return n%2===0?'e':'o'}); m.get('e').join(',')+'/'+m.get('o').join(',')", "2,4/1,3"),
5295        (
5296            "var kEven={}; var kOdd={}; var m=Map.groupBy([1,2,3],function(n){return n%2===0?kEven:kOdd}); m.get(kEven).join(',')+'/'+m.get(kOdd).join(',')",
5297            "2/1,3",
5298        ),
5299        ("Map.groupBy([1,2,3],function(n){return n}).size", "3"),
5300        // Object.groupBy/Map.groupBy は仕様上任意の iterable を受け付ける(配列限定ではない)。
5301        // 以前は実配列以外は無条件で空扱いになり Set/Map/ジェネレータが常に空グループになるバグだった。
5302        (
5303            "var g=Object.groupBy(new Set([1,2,3,4]),function(n){return n%2===0?'e':'o'}); g.e.join(',')+'/'+g.o.join(',')",
5304            "2,4/1,3",
5305        ),
5306        (
5307            "function* gen(){yield 1;yield 2;yield 3;} var g=Object.groupBy(gen(),function(n){return n%2===0?'e':'o'}); g.e.join(',')+'/'+g.o.join(',')",
5308            "2/1,3",
5309        ),
5310        (
5311            "var m=Map.groupBy(new Set([1,2,3,4]),function(n){return n%2===0?'e':'o'}); m.get('e').join(',')+'/'+m.get('o').join(',')",
5312            "2,4/1,3",
5313        ),
5314        // Map/Set/WeakMap/WeakSet コンストラクタ・Promise.all 系・Object.fromEntries も
5315        // 同じく `Interp` 不要の純関数 `iterable_values` を使っており、Generator を渡すと
5316        // 常に空になる同型のバグがあった(`it.iter_to_vec` に統一して解消)。
5317        (
5318            "function* gen(){yield [1,'a'];yield [2,'b'];} var m=new Map(gen()); m.get(1)+','+m.get(2)",
5319            "a,b",
5320        ),
5321        (
5322            "function* gen(){yield 1;yield 2;yield 2;} [...new Set(gen())].join(',')",
5323            "1,2",
5324        ),
5325        (
5326            "function* gen(){yield ['a',1];} Object.fromEntries(gen()).a",
5327            "1",
5328        ),
5329        (
5330            "function* gen(){yield Promise.resolve(1);yield Promise.resolve(2);} await Promise.all(gen()).then(a => a.join(','))",
5331            "1,2",
5332        ),
5333        // Uint8Array — 長さ指定・要素代入・length。
5334        ("var a=new Uint8Array(3); a[0]=10; a[1]=20; a.length+','+a[0]+','+a[1]", "3,10,20"),
5335        // Uint8Array — 配列/イテラブルから構築。
5336        ("Array.from(new Uint8Array([1,2,3])).join(',')", "1,2,3"),
5337        // Uint8Array.from — 静的メソッド。
5338        ("Uint8Array.from([4,5,6]).join(',')", "4,5,6"),
5339        // Uint8Array コンストラクタは Generator も受け付けるべき(仕様上どの iterable でも可)。
5340        (
5341            "function* gen(){yield 1;yield 2;yield 3;} new Uint8Array(gen()).join(',')",
5342            "1,2,3",
5343        ),
5344        // AggregateError も同様に Generator を errors として受け付ける。
5345        (
5346            "function* gen(){yield 'a';yield 'b';} new AggregateError(gen(), 'msg').errors.join(',')",
5347            "a,b",
5348        ),
5349        // Uint8Array — 値のラップ(256 は mod 256 で 0、-1 は 255、300 は 44)。
5350        ("var a=new Uint8Array([256,-1,300]); a.join(',')", "0,255,44"),
5351        // TypedArray コンストラクタに負の length を渡すと仕様上 RangeError(`ToIndex` が
5352        // `integer >= 0` を要求)だが、以前は `.max(0.0)` で黙って0にクランプしていた。
5353        (
5354            "try { new Uint8Array(-1); 'no-throw' } catch(e) { 'threw' }",
5355            "threw",
5356        ),
5357        (
5358            "try { new Float64Array(-3); 'no-throw' } catch(e) { 'threw' }",
5359            "threw",
5360        ),
5361        // `typedArray.set(array, offset)`は仕様上`offset + array.length`が
5362        // 対象の長さを超えるとRangeErrorだが、以前は範囲外の書き込みを
5363        // 黙って無視するだけで、`ta.set([1,2,3], hugeOffset)`が例外にならず
5364        // 無害なno-opとして成立してしまっていた(TypedArrayコンストラクタの
5365        // 負lengthバグと同じ「範囲外を黙って受け流す」パターン)。
5366        (
5367            "try { new Uint8Array(3).set([1,2,3], 5); 'no-throw' } catch(e) { 'threw' }",
5368            "threw",
5369        ),
5370        (
5371            "try { new Uint8Array(3).set([1,2], 2); 'no-throw' } catch(e) { 'threw' }",
5372            "threw",
5373        ),
5374        (
5375            // 境界ちょうど(offset + length === target.length)は範囲内なので例外にならない。
5376            "var a=new Uint8Array(3); a.set([9,9], 1); a.join(',')",
5377            "0,9,9",
5378        ),
5379        // Uint8Array.set — offset 付き上書き。
5380        ("var a=new Uint8Array(4); a.set([9,9],1); a.join(',')", "0,9,9,0"),
5381        // Uint8Array.set — 仕様上 array-like(非配列プレーンオブジェクト)も受け付けるべき。
5382        (
5383            "var a=new Uint8Array(3); a.set({0:5,1:6,length:2}); a.join(',')",
5384            "5,6,0",
5385        ),
5386        // Uint8Array.slice — 独立コピーを返す。
5387        ("var a=new Uint8Array([1,2,3,4,5]); var s=a.slice(1,3); s.join(',')+'/'+a.length", "2,3/5"),
5388        // 【2026-10-17】グローバルの var と window のプロパティは同じ束縛(YouTube の
5389        // `var ytcfg = …; window.ytcfg.set(…)`)。代入も双方向に効く。組み込みも window から見える。
5390        // スクリプトのトップレベルの `this` は window(Closure Compiler 形式の `(function(w){…})(this)`)。
5391        ("this === window", "true"),
5392        // DataView はバッファを共有(書いた値が同じバッファの TypedArray から見える)。
5393        ("var zab=new ArrayBuffer(8); var zdv=new DataView(zab, 2, 4); zdv.setUint16(0, 0x0102); var zua=new Uint8Array(zab); var zdv2=new DataView(zab); [zua[2], zua[3], zdv2.getUint8(3), zdv.byteLength, new Uint8Array(zdv.buffer, zdv.byteOffset, 2)[1]].join()", "1,2,2,4,2"),
5394        // subarray・バッファ上のビューへの書き込みが元の配列へ届く(protobuf の書き手)。
5395        ("var zo=new Uint8Array(6); var zs=zo.subarray(2,5); zs[0]=7; zs.set([8,9],1); var zw=new Uint8Array(zo.buffer, 1, 2); zw[0]=5; var zss=zs.subarray(2); zss[0]=4; [Array.from(zo).join(''), zs.byteOffset, zss.byteOffset].join(' ')", "057840 2 4"),
5396        // TypedArray と ArrayBuffer の共有(後から書いた値がバッファ経由の新しいビューで見える)。
5397        ("var zu8=new Uint8Array(4); zu8[0]=7; zu8[3]=9; var zv=new Uint8Array(zu8.buffer, 1, 3); var zd=new DataView(zu8.buffer); [zv[0], zv[2], zd.getUint8(0), new Uint8Array(zu8.buffer)[3]].join()", "0,9,7,9"),
5398        // Closure の goog.Uri の分解用正規表現(遅延量指定子・先読み・文字クラス内の \\ と /)。
5399        ("var zre=/^(?:([^:/?#.]+):)?(?:\\/\\/(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$/; var zm='https://a.com/videoplayback?x=1'.match(zre); [zm[1],zm[3],zm[5],zm[6]].join('|')", "https|a.com|/videoplayback|x=1"),
5400        // URL のパス(ホストとパスの間の "/")。
5401        ("var zu=new URL('https://a.com'); zu.pathname='videoplayback'; var zu2=new URL('https://a.com/'); zu2.pathname='/x'; [zu.href, zu2.href, new URL('videoplayback?x=1','https://a.com').href, new URL('https://a.com?q=1').href, new URL('https://a.com').pathname].join(' ')", "https://a.com/videoplayback https://a.com/x https://a.com/videoplayback?x=1 https://a.com/?q=1 /"),
5402        // try/finally の復元(return・throw・break・continue・入れ子)。
5403        ("var zst=[0]; function zf1(){ var g=zst[0]; zst[0]=1; try { return 5; } finally { zst[0]=g; } } function zf2(){ var g=zst[0]; zst[0]=2; try { throw new Error('e'); } finally { zst[0]=g; } } var zr1=zf1(); try { zf2(); } catch(e) {} var zc=0; for (var i=0;i<3;i++){ try { if(i==1) continue; if(i==2) break; } finally { zc++; } } [zr1, zst[0], zc].join()", "5,0,3"),
5404        ("var zst=[0]; function zf3(){ try { try { return 'a'; } finally { zst[0]=7; } } finally { zst[0]+=1; } } [zf3(), zst[0]].join()", "a,8"),
5405        ("function zf4(){ try { return 1; } finally { return 2; } } zf4()", "2"),
5406        // undefined 値のプロパティも自身のプロパティ(Wiz のコンテキスト `_.kp`)。
5407        ("var zka={defaultValue:void 0}; [Object.hasOwn(zka,'defaultValue'), !zka||!Object.hasOwn(zka,'defaultValue'), Object.keys(Object.assign({}, zka)).length].join()", "true,false,1"),
5408        // 同じ説明の Symbol は別物(switch・Map・オブジェクトのキー)。
5409        ("var zs1=Symbol('x'), zs2=Symbol('x'); var zr; switch(zs2){case zs1: zr='a'; break; case zs2: zr='b';} var zm=new Map(); zm.set(zs1,1); zm.set(zs2,2); var zo={}; zo[zs1]=3; zo[zs2]=4; [zr, zm.get(zs1), zm.get(zs2), zo[zs1], zo[zs2], zs1===zs2].join()", "b,1,2,3,4,false"),
5410        // プリミティブも Object.prototype のメソッドとポリフィルを引ける。
5411        ("[false.hasOwnProperty('x'), (1).hasOwnProperty('x'), 'ab'.hasOwnProperty('length'), typeof true.isPrototypeOf].join()", "false,false,true,function"),
5412        ("String.prototype.zq = function(){ return 'z' + this; }; Boolean.prototype.zb = function(){ return 1; }; ['a'.zq(), true.zb()].join()", "za,1"),
5413        // 組込みの instanceof(遅延コンポーネントの `m instanceof Promise`)。
5414        ("[Promise.resolve(1) instanceof Promise, new Map() instanceof Map, new Date() instanceof Date, /a/ instanceof RegExp, (function(){}) instanceof Function, [] instanceof Object, Promise.resolve() instanceof Object, ({}) instanceof Promise, Object.create(null) instanceof Object].join()", "true,true,true,true,true,true,true,false,false"),
5415        // 要素の独自プロパティ(expando)は別の経路で取った同じ要素からも見える。
5416        ("var zp=document.createElement('div'); var ze=document.createElement('span'); zp.appendChild(ze); ze.getApi=function(){return 7;}; ze.k=3; var zf=zp.children[0]; [zf.getApi(), zf.k, 'getApi' in zf, typeof document.createElement('div').getApi].join()", "7,3,true,undefined"),
5417        ("var zo=document.createElement('div'); zo.appendChild=function(){return 'patched';}; zo.appendChild(1)", "patched"),
5418        // DOM ノードの動的プロパティも `in` で見える(Closure のノード判定 `"nodeType" in a`)。
5419        ("var zd=document.createElement('div'); ['nodeType' in zd, 'tagName' in zd, 'appendChild' in zd, 'zzz' in zd, 'nodeType' in document.createTextNode('x')].join()", "true,true,true,false,true"),
5420        // 組込みコンストラクタの prototype(ポリフィル判定 `typeof X.prototype.m`)。
5421        ("[typeof AbortSignal.prototype, typeof AbortSignal.prototype.throwIfAborted, typeof AbortSignal.timeout, AbortSignal.prototype.constructor === AbortSignal].join()", "object,undefined,function,true"),
5422        ("typeof Map.prototype === 'object' && typeof Promise.prototype === 'object'", "true"),
5423        ("[Error().message, new TypeError().message, typeof Error().stack].join('|')", "||string"),
5424        // 未実装の WebGL は null(機能判定が誤認しない)。
5425        ("document.createElement('canvas').getContext('webgl')", "null"),
5426        // {} のプロトタイプは Object.prototype、その先は null(Redux の isPlainObject)。
5427        ("Object.getPrototypeOf({}) === Object.prototype", "true"),
5428        ("Object.getPrototypeOf(Object.prototype)", "null"),
5429        ("Object.getPrototypeOf([]) === Array.prototype", "true"),
5430        ("Object.getPrototypeOf(Object.create(null))", "null"),
5431        ("function zip(x){ if(typeof x!=='object'||x===null) return false; var p=x; while(Object.getPrototypeOf(p)!==null) p=Object.getPrototypeOf(p); return Object.getPrototypeOf(x)===p; } [zip({type:'a'}), zip([]), zip(new (function F(){})()), zip(Object.create(null))].join()", "true,false,false,false"),
5432        // 非 strict の関数の this は window(YouTube player の `(function(g){var window=this;…})(x)`)。
5433        ("(function(){ return this === window; })()", "true"),
5434        ("var zsl={}; (function(g){ var window=this; g.d = typeof window.document; })(zsl); zsl.d", "object"),
5435        // strict の関数(指令・外側の指令・クラス)は undefined のまま。
5436        ("(function(){ 'use strict'; return this; })() === undefined", "true"),
5437        ("(function(){ 'use strict'; return (function(){ return this; })(); })() === undefined", "true"),
5438        ("class ZS { m(){ return (function(){ return this; })(); } } new ZS().m() === undefined", "true"),
5439        ("(function(){ 'use strict'; var big = function(){ var a=1,b=2,c=3,d=4,e=5,f=6,g=7,h=8; return [a,b,c,d,e,f,g,h,this].length && this; }; return big(); })() === undefined", "true"),
5440        // 呼び出しが深すぎるときは捕捉可能な RangeError(従来はスクリプト全体を打ち切っていた)。
5441        ("function zrec(){ return zrec(); } var zr; try { zrec(); zr='no'; } catch(e) { zr = (e instanceof RangeError) + ':' + e.message; } zr", "true:Maximum call stack size exceeded"),
5442        // 深さ 1000 の再帰は正常に動く(スタック使用量のガードが早すぎない)。
5443        ("function zdeep(n){ return n ? 1 + zdeep(n - 1) : 0; } zdeep(1000)", "1000"),
5444        ("var zdd=0; function zdm(){ zdd++; zdm(); } try { zdm(); } catch(e) {} zdd > 1500", "true"),
5445        // String.prototype.lastIndexOf(未実装だった)と indexOf の開始位置(無視していた)。
5446        ("'abcabc'.lastIndexOf('b')+','+'abcabc'.lastIndexOf('b',3)+','+'abc'.lastIndexOf('z')+','+'SID=1'.lastIndexOf('SID=',0)", "4,1,-1,0"),
5447        ("'abcabc'.indexOf('b',2)+','+'abc'.indexOf('a',-5)+','+'abc'.indexOf('',9)", "4,0,3"),
5448        ("(function(w){ return typeof w.document; })(this)", "object"),
5449        // 遅延解析した関数本体(24 トークン以上)も入れ子のクロージャごと正しく動く。
5450        ("function zlazy(a){ var t=0; for(var i=0;i<a;i++){ t+=i; } var g=function(x){ var y=x*2; return y+t+1+2+3+4+5; }; return g(a); } zlazy(4)", "29"),
5451        ("var zwin1=5; window.zwin1", "5"),
5452        ("var zwin2=1; window.zwin2=7; zwin2", "7"),
5453        ("typeof window.Element+','+typeof window.HTMLElement", "function,function"),
5454        // `new Image(w,h)` / `new Audio(src)`(HTML の名前付きコンストラクタ)。
5455        ("var im=new Image(3,4); im.tagName+','+im.getAttribute('width')+','+im.getAttribute('height')", "IMG,3,4"),
5456        ("new Audio('a.mp3').getAttribute('src')", "a.mp3"),
5457        // `document.createEvent` + `initEvent`(DOM Level 2)。
5458        ("var ce=document.createEvent('Event'); ce.initEvent('x',true,false); ce.type+','+ce.bubbles+','+ce.cancelable", "x,true,false"),
5459        // Uint8Array.fill — 破壊的に埋めて this を返す。
5460        ("var a=new Uint8Array(4); a.fill(7,1,3); a.join(',')", "0,7,7,0"),
5461        // Uint8Array — byteLength / BYTES_PER_ELEMENT / buffer.byteLength。
5462        ("var a=new Uint8Array(5); a.byteLength+','+a.BYTES_PER_ELEMENT+','+a.buffer.byteLength", "5,1,5"),
5463        // ArrayBuffer — byteLength と、そこから Uint8Array を構築。
5464        ("var b=new ArrayBuffer(8); new Uint8Array(b).length+','+b.byteLength", "8,8"),
5465        // ArrayBuffer.prototype.resize/transfer/resizable/maxByteLength(ES2024)。
5466        // 以前は丸ごと未対応で、非 resizable なバッファしか作れなかった。
5467        (
5468            "var b=new ArrayBuffer(4,{maxByteLength:16}); b.resizable+','+b.maxByteLength+','+b.byteLength",
5469            "true,16,4",
5470        ),
5471        ("var b=new ArrayBuffer(4); b.resizable+','+b.maxByteLength", "false,4"),
5472        // resize は byteLength をその場で伸縮させる(新規領域はゼロ埋め)。
5473        (
5474            "var b=new ArrayBuffer(4,{maxByteLength:16}); b.resize(8); var u=new Uint8Array(b); b.byteLength+','+u.length",
5475            "8,8",
5476        ),
5477        // maxByteLength を超える resize は RangeError 相当の例外。
5478        (
5479            "var b=new ArrayBuffer(4,{maxByteLength:8}); try { b.resize(9); 'no throw'; } catch(e) { 'threw'; }",
5480            "threw",
5481        ),
5482        // 非 resizable なバッファへの resize は TypeError 相当の例外。
5483        (
5484            "var b=new ArrayBuffer(4); try { b.resize(2); 'no throw'; } catch(e) { 'threw'; }",
5485            "threw",
5486        ),
5487        // transfer は同じ byteLength の新バッファを返し、元のバッファを detach する(byteLength→0)。
5488        // 注: この処理系の ArrayBuffer/TypedArray は実メモリを共有しない独立コピー簡易実装
5489        // (DataView 等と同じ既存の割り切り)のため、TypedArray 経由で書いた値の引き継ぎまでは検証しない。
5490        (
5491            "var b=new ArrayBuffer(4); var b2=b.transfer(); b.byteLength+','+b2.byteLength",
5492            "0,4",
5493        ),
5494        // detach 後の再 transfer/resize は例外。
5495        (
5496            "var b=new ArrayBuffer(4); b.transfer(); try { b.transfer(); 'no throw'; } catch(e) { 'threw'; }",
5497            "threw",
5498        ),
5499        // transferToFixedLength は常に非 resizable な結果を返す。
5500        (
5501            "var b=new ArrayBuffer(4,{maxByteLength:8}); var b2=b.transferToFixedLength(); b2.resizable",
5502            "false",
5503        ),
5504        // `structuredClone(resizableArrayBuffer)`が`resizable`/`maxByteLength`
5505        // を引き継がず非resizableな複製に化けていたバグ(丸ごと未対応
5506        // だった。2026-07-17 発見・実装)。
5507        (
5508            "var b=new ArrayBuffer(4,{maxByteLength:16}); var c=structuredClone(b); \
5509             c.resizable+','+c.maxByteLength+','+c.byteLength",
5510            "true,16,4",
5511        ),
5512        (
5513            "var b=new ArrayBuffer(4,{maxByteLength:16}); var c=structuredClone(b); \
5514             c.resize(8); c.byteLength",
5515            "8",
5516        ),
5517        // Uint8Array.prototype.toBase64/toHex + 静的 fromBase64/fromHex(ES2024/2025)。
5518        ("new Uint8Array([72,101,108,108,111]).toBase64()", "SGVsbG8="),
5519        ("Array.from(Uint8Array.fromBase64('SGVsbG8=')).join(',')", "72,101,108,108,111"),
5520        ("new Uint8Array([222,173,190,239]).toHex()", "deadbeef"),
5521        ("Array.from(Uint8Array.fromHex('deadbeef')).join(',')", "222,173,190,239"),
5522        // 往復(バイト列 -> base64/hex -> バイト列)が元に戻ることを確認。
5523        (
5524            "var a=new Uint8Array([1,2,3,255,0]); Array.from(Uint8Array.fromBase64(a.toBase64())).join(',')",
5525            "1,2,3,255,0",
5526        ),
5527        (
5528            "var a=new Uint8Array([1,2,3,255,0]); Array.from(Uint8Array.fromHex(a.toHex())).join(',')",
5529            "1,2,3,255,0",
5530        ),
5531        // fromHex: 不正な16進文字列(奇数長)は例外を投げる。
5532        (
5533            "try { Uint8Array.fromHex('abc'); 'no-throw' } catch(e) { 'caught:' + e.name }",
5534            "caught:SyntaxError",
5535        ),
5536        // setFromBase64/setFromHex(ES2024/2025)— 既存バッファへインプレース書き込み。
5537        (
5538            "var a=new Uint8Array(5); var r=a.setFromBase64('SGVsbG8='); Array.from(a).join(',')+'|'+r.read+'|'+r.written",
5539            "72,101,108,108,111|8|5",
5540        ),
5541        (
5542            "var a=new Uint8Array(4); var r=a.setFromHex('deadbeef'); Array.from(a).join(',')+'|'+r.read+'|'+r.written",
5543            "222,173,190,239|8|4",
5544        ),
5545        (
5546            "try { new Uint8Array(1).setFromHex('zz'); 'no-throw' } catch(e) { 'caught:' + e.name }",
5547            "caught:SyntaxError",
5548        ),
5549        // TextEncoder — Uint8Array を返し、UTF-8 バイト値が正しい。
5550        ("var e=new TextEncoder().encode('AB'); e.length+','+e[0]+','+e[1]", "2,65,66"),
5551        // TextEncoder→TextDecoder 往復。
5552        ("new TextDecoder().decode(new TextEncoder().encode('hello'))", "hello"),
5553        // `TextEncoder.prototype.encodeInto(source, destination)` が丸ごと
5554        // 未対応だった(`encode()` は既存だが、この性能向けバリアントが欠けていた)。
5555        (
5556            "var buf=new Uint8Array(5); var r=new TextEncoder().encodeInto('Hi', buf); \
5557             r.read+','+r.written+','+buf[0]+','+buf[1]",
5558            "2,2,72,105",
5559        ),
5560        // 宛先バッファが足りない場合はコードポイント境界で打ち切る(マルチバイト
5561        // 文字を途中で分割しない)。
5562        (
5563            "var buf=new Uint8Array(1); var r=new TextEncoder().encodeInto('AB', buf); \
5564             r.read+','+r.written",
5565            "1,1",
5566        ),
5567        // Int8Array — 符号付きラップ(200 は -56、-100 はそのまま)。
5568        ("var a=new Int8Array([200,-100]); a.join(',')", "-56,-100"),
5569        // Uint8ClampedArray — 飽和(クランプ、ラップではない)。
5570        ("var a=new Uint8ClampedArray([300,-50,128.6]); a.join(',')", "255,0,129"),
5571        // ToUint8Clamp は同点を偶数丸め(banker's rounding)する仕様
5572        // (Math.round の四捨五入とは異なる)。
5573        ("var a=new Uint8ClampedArray([0.5,1.5,2.5,3.5]); a.join(',')", "0,2,2,4"),
5574        // Int16Array / Uint16Array — 幅16bitのラップ。
5575        ("var a=new Int16Array([40000]); a[0]", "-25536"),
5576        // 索引代入 `ta[i]=v` はコンストラクタ/`set`/`fill` と違って型変換
5577        // (ラップ/クランプ)が一切効かず生の数値がそのまま入るバグだった。
5578        ("var a=new Int8Array(1); a[0]=200; a[0]", "-56"),
5579        ("var a=new Uint8ClampedArray(1); a[0]=300; a[0]", "255"),
5580        ("var a=new Uint8ClampedArray(1); a[0]=-50; a[0]", "0"),
5581        ("var a=new Int16Array(1); a[0]=40000; a[0]", "-25536"),
5582        ("var a=new Uint16Array([70000]); a[0]", "4464"),
5583        // Int32Array / Uint32Array — 幅32bitのラップ。
5584        ("var a=new Int32Array([4294967295]); a[0]", "-1"),
5585        ("var a=new Uint32Array([-1]); a[0]", "4294967295"),
5586        // Float32Array — 単精度への丸め込み(倍精度のままではない)。
5587        ("var a=new Float32Array([0.1]); a[0] !== 0.1", "true"),
5588        // Float16Array / DataView getFloat16 / setFloat16 (ES2025)。
5589        ("var a=new Float16Array([1.5]); a[0] === 1.5", "true"),
5590        ("var dv=new DataView(new ArrayBuffer(2)); dv.setFloat16(0, 2.5); dv.getFloat16(0)", "2.5"),
5591        // Float64Array — 倍精度はそのまま保持。
5592        ("var a=new Float64Array([0.1]); a[0] === 0.1", "true"),
5593        // 各 TypedArray の BYTES_PER_ELEMENT。
5594        ("new Int16Array(1).BYTES_PER_ELEMENT+','+new Float64Array(1).BYTES_PER_ELEMENT", "2,8"),
5595        // 複数バイト型 TypedArray(Int16Array / Int32Array / Float32Array)と Uint8Array の同一 ArrayBuffer 共有。
5596        (
5597            "var buf=new ArrayBuffer(8); var u8=new Uint8Array(buf); var i16=new Int16Array(buf); var i32=new Int32Array(buf, 4, 1); \
5598             i16[0]=-1; i16[1]=258; i32[0]=0x01020304; \
5599             u8[0]+','+u8[1]+','+u8[2]+','+u8[3]+','+u8[4]+','+u8[7]+','+i16.subarray(1,2)[0]",
5600            "255,255,2,1,4,1,258",
5601        ),
5602        (
5603            "var a=new Int32Array([10, 20, 30]); var sub=a.subarray(1, 3); sub[0]=99; a[1]+','+sub.byteOffset+','+sub.byteLength",
5604            "99,4,8",
5605        ),
5606        // TypedArray.from(静的)と set/slice/fill の型別クロスチェック。
5607        ("Int32Array.from([1,2,3]).join(',')", "1,2,3"),
5608        ("var a=new Uint16Array(3); a.set([1,2],1); a.join(',')", "0,1,2"),
5609        ("var a=new Int8Array([1,2,3,4]); a.slice(1,3).join(',')", "2,3"),
5610        ("var a=new Uint32Array(3); a.fill(5); a.join(',')", "5,5,5"),
5611        // `toSorted`/`toReversed`/`toSpliced`/`with`(ES2023)が TypedArray に対しては
5612        // 常に普通の配列を返すバグだった(`structuredClone(TypedArray)` と同種)。
5613        // 型変換(ラップ)も維持されることを確認する。
5614        (
5615            "var a=new Int8Array([200,3,1]); var b=a.toSorted(); b.join(',')+','+b.BYTES_PER_ELEMENT",
5616            "-56,1,3,1",
5617        ),
5618        (
5619            "var a=new Int8Array([1,2,200]); var b=a.toReversed(); b.join(',')+','+b.BYTES_PER_ELEMENT",
5620            "-56,2,1,1",
5621        ),
5622        (
5623            "var a=new Int8Array([1,2,3]); var b=a.with(1,200); b.join(',')+','+b.BYTES_PER_ELEMENT",
5624            "1,-56,3,1",
5625        ),
5626        // `map`/`filter` も同じ理由で TypedArray に対しては常に普通の配列を返す
5627        // バグだった。callback の戻り値が有効域外でも型ごとの変換(ラップ)が働く。
5628        (
5629            "var a=new Int8Array([1,2,3]); var b=a.map(x => x + 200); b.join(',')+','+b.BYTES_PER_ELEMENT",
5630            "-55,-54,-53,1",
5631        ),
5632        (
5633            "var a=new Int8Array([1,2,3,4]); var b=a.filter(x => x % 2 === 0); b.join(',')+','+b.BYTES_PER_ELEMENT",
5634            "2,4,1",
5635        ),
5636        // DataView(ES2015)が丸ごと未対応で `new DataView(buf)` が
5637        // `DataView is not defined` になっていた。
5638        (
5639            "var dv=new DataView(new ArrayBuffer(4)); dv.setUint8(0,255); dv.getUint8(0)",
5640            "255",
5641        ),
5642        // デフォルトはビッグエンディアン。
5643        (
5644            "var dv=new DataView(new ArrayBuffer(4)); dv.setUint32(0,0x01020304); dv.getUint8(0)+','+dv.getUint8(3)",
5645            "1,4",
5646        ),
5647        // littleEndian=true を渡すとバイト順が反転する。
5648        (
5649            "var dv=new DataView(new ArrayBuffer(4)); dv.setUint32(0,0x01020304,true); dv.getUint8(0)+','+dv.getUint8(3)",
5650            "4,1",
5651        ),
5652        // 符号付き/符号無しの往復(16bit)。
5653        ("var dv=new DataView(new ArrayBuffer(2)); dv.setInt16(0,-1); dv.getUint16(0)", "65535"),
5654        // Float64 の往復(丸めなし)。
5655        ("var dv=new DataView(new ArrayBuffer(8)); dv.setFloat64(0,3.5); dv.getFloat64(0)", "3.5"),
5656        // 範囲外アクセスは例外。
5657        (
5658            "try { new DataView(new ArrayBuffer(1)).getUint32(0); 'no throw'; } catch(e) { 'threw'; }",
5659            "threw",
5660        ),
5661        // Blob(File API の基礎コンテナ)が丸ごと未対応で `new Blob([...])` が
5662        // `Blob is not defined` になっていた。
5663        ("new Blob(['hello', ' ', 'world']).size", "11"),
5664        ("new Blob(['abc'], {type:'text/plain'}).type", "text/plain"),
5665        ("await new Blob(['hello world']).text()", "hello world"),
5666        ("await new Blob(['hello world']).slice(0,5).text()", "hello"),
5667        // `Blob.arrayBuffer()` が返す ArrayBuffer は実バイト列を持ち、そこから作った
5668        // DataView で正しく読み戻せる(`Blob`→`ArrayBuffer`→`DataView` の実用連携)。
5669        (
5670            "var buf = await new Blob(['A']).arrayBuffer(); new DataView(buf).getUint8(0)",
5671            "65",
5672        ),
5673        // `Blob.prototype.bytes()`(ES2024。丸ごと未対応だった。`await blob.
5674        // arrayBuffer()`→`new Uint8Array(...)` の2手間を1メソッドで済ませる。
5675        // 2026-07-15 発見・実装)。
5676        // 注: `instanceof Uint8Array` では検証しない — 調査の結果、この処理系の
5677        // TypedArray コンストラクタ群は `.prototype` を一切持たず `instanceof` が
5678        // 常に `false` を返す既存の別バグと判明(`Array`/`Map` 等 TypedArray 以外の
5679        // 組み込み型も含め instanceof 自体の自己テストがコードベースに1件も無く、
5680        // 広範な既知の未検証領域)。`BYTES_PER_ELEMENT`(Uint8Array 固有の値)で
5681        // 型を検証し、この既存バグを新規追跡項目として TODO.md へ記録した。
5682        (
5683            "var u = await new Blob(['AB']).bytes(); u.BYTES_PER_ELEMENT",
5684            "1",
5685        ),
5686        ("var u = await new Blob(['AB']).bytes(); u[0]+','+u[1]", "65,66"),
5687        // `File`(`Blob` を継承し `name`/`lastModified` を追加する File API の
5688        // 基礎コンストラクタ)が丸ごと未対応で `File is not defined` になっていた。
5689        ("new File(['hi'], 'a.txt').name", "a.txt"),
5690        ("new File(['hi'], 'a.txt', {type:'text/plain'}).type", "text/plain"),
5691        ("new File(['hello'], 'a.txt').size", "5"),
5692        ("await new File(['hello'], 'a.txt').text()", "hello"),
5693        // `Blob` 由来のメソッド(`slice`)もそのまま継承する。
5694        ("await new File(['hello world'], 'a.txt').slice(0,5).text()", "hello"),
5695        // `lastModified` は明示指定を尊重する。
5696        ("new File(['x'], 'a.txt', {lastModified: 12345}).lastModified", "12345"),
5697        // `File.webkitRelativePath`(丸ごと未対応だった。実際のディレクトリ
5698        // 選択UIが無いため常に空文字列の誠実な簡略実装。2026-07-17 発見・
5699        // 実装)。
5700        ("new File(['x'], 'a.txt').webkitRelativePath", ""),
5701        // `structuredClone(File)`が`Blob`分岐に落ちて`name`/`lastModified`
5702        // が失われ、素の`Blob`へ格下げされていたバグ(丸ごと未対応
5703        // だった。2026-07-17 発見・実装)。
5704        (
5705            "var c=structuredClone(new File(['hi'], 'a.txt', {lastModified: 12345})); \
5706             c.name + ',' + c.lastModified",
5707            "a.txt,12345",
5708        ),
5709        (
5710            "await structuredClone(new File(['hello'], 'a.txt')).text()",
5711            "hello",
5712        ),
5713        // 素の`Blob`(`name`無し)は引き続き`name`を持たない`Blob`のまま
5714        // 複製される(回帰確認)。
5715        ("structuredClone(new Blob(['x'])).name", "undefined"),
5716        // `FileReader` が丸ごと未対応だった(`blob.text()` 等の Promise 版は
5717        // 既に対応済みだったが、古典的なイベントベースの `readAsText`+`onload`
5718        // という書き方自体が丸ごと存在しなかった)。
5719        (
5720            "var r=new FileReader(); var out; r.onload=function(e){ out=e.target.result; }; \
5721             r.readAsText(new Blob(['hello'])); out",
5722            "hello",
5723        ),
5724        (
5725            "var r=new FileReader(); r.readAsText(new Blob(['x'])); r.readyState",
5726            "2",
5727        ),
5728        (
5729            "var r=new FileReader(); var buf; r.onload=function(e){ buf=e.target.result; }; \
5730             r.readAsArrayBuffer(new Blob(['A'])); new DataView(buf).getUint8(0)",
5731            "65",
5732        ),
5733        (
5734            "var r=new FileReader(); var url; r.onload=function(e){ url=e.target.result; }; \
5735             r.readAsDataURL(new Blob(['hi'], {type:'text/plain'})); url",
5736            "data:text/plain;base64,aGk=",
5737        ),
5738        // `addEventListener('load', ...)` 経由でも `onload` と同じく発火する
5739        // (`on<type>` 単一リスナ方式を共有しているため)。
5740        (
5741            "var r=new FileReader(); var fired=false; r.addEventListener('load', ()=>fired=true); \
5742             r.readAsText(new Blob(['x'])); fired",
5743            "true",
5744        ),
5745        // `Notification`(丸ごと未対応だった。通知 UI 自体が無いこの OS では
5746        // 実際の表示は行わず JS 側の契約のみ満たす簡略実装)。
5747        ("Notification.permission", "granted"),
5748        ("await Notification.requestPermission()", "granted"),
5749        (
5750            "var n = new Notification('hi', {body: 'world'}); n.title + ':' + n.body",
5751            "hi:world",
5752        ),
5753        ("typeof new Notification('x').close", "function"),
5754        // `data`/`requireInteraction`/`silent`/`dir`/`lang`(丸ごと未対応
5755        // だった。`title`/`body`/`icon`/`tag`は既に対応済みだったが、同じ
5756        // コンストラクタoptionsの残りが漏れていた。2026-07-17 発見・実装)。
5757        (
5758            "var n = new Notification('x', {data: {id: 5}, requireInteraction: true, silent: true}); \
5759             n.data.id + ',' + n.requireInteraction + ',' + n.silent",
5760            "5,true,true",
5761        ),
5762        ("new Notification('x').dir", "auto"),
5763        ("new Notification('x').data", "null"),
5764        ("typeof new Notification('x').removeEventListener", "function"),
5765        // Promise.withResolvers(ES2024)
5766        (
5767            "var {promise, resolve} = Promise.withResolvers(); resolve(5); await promise",
5768            "5",
5769        ),
5770        (
5771            "var {promise, reject} = Promise.withResolvers(); reject('e'); await promise.catch(e => 'caught:' + e)",
5772            "caught:e",
5773        ),
5774        // Promise.try(ES2025): 同期の戻り値/例外/Promise 戻り値をすべて統一的に扱う
5775        ("await Promise.try(() => 42)", "42"),
5776        (
5777            "await Promise.try(() => { throw 'boom' }).catch(e => 'caught:' + e)",
5778            "caught:boom",
5779        ),
5780        ("await Promise.try(() => Promise.resolve('ok'))", "ok"),
5781        ("await Promise.try((a, b) => a + b, 1, 2)", "3"),
5782        // String.prototype.isWellFormed / toWellFormed(ES2024)
5783        ("'abc'.isWellFormed()", "true"),
5784        ("'abc'.toWellFormed()", "abc"),
5785        // using 宣言(Explicit Resource Management、ES2023→ES2026ベースライン)
5786        (
5787            "var log=''; { using r = {[Symbol.dispose]: () => log+='d'}; log+='a' } log+='b'; log",
5788            "adb",
5789        ),
5790        // 複数 using は宣言の逆順で dispose される(LIFO)。
5791        (
5792            "var log=''; { using a = {[Symbol.dispose]: () => log+='A'}; using b = {[Symbol.dispose]: () => log+='B'} } log",
5793            "BA",
5794        ),
5795        // return で早期脱出しても dispose は呼ばれる(戻り値確定後に外側の log へ副作用)。
5796        (
5797            "var log=''; function f(){ { using r = {[Symbol.dispose]: () => log+='d'}; return 'a' } } var res=f(); log+res",
5798            "da",
5799        ),
5800        // await using は Symbol.asyncDispose の戻り値を await する。
5801        (
5802            "async function f(){ var log=''; { await using r = {[Symbol.asyncDispose]: async () => { log+='d' }}; log+='a' } return log } await f()",
5803            "ad",
5804        ),
5805        // Array.fromAsync(ES2024/2025): 同期イテラブル + 各要素の Promise を await。
5806        (
5807            "(await Array.fromAsync([Promise.resolve(1), 2, Promise.resolve(3)])).join(',')",
5808            "1,2,3",
5809        ),
5810        // mapFn 付き。
5811        ("(await Array.fromAsync([1,2,3], x => x * 10)).join(',')", "10,20,30"),
5812        // 複数 using の dispose がいずれも例外を投げると SuppressedError へ集約される
5813        // (LIFO: 後から宣言した b が先に dispose される → error=A(最後に投げた), suppressed=B)。
5814        (
5815            "var caught=null; try { { using a = {[Symbol.dispose]: () => { throw 'A' }}; using b = {[Symbol.dispose]: () => { throw 'B' }} } } catch(e) { caught = e } caught.name + ':' + caught.error + ':' + caught.suppressed",
5816            "SuppressedError:A:B",
5817        ),
5818        // for await...of: 同期イテラブル + 各要素の Promise を await するフォールバック。
5819        (
5820            "async function f(){ var out=''; for await (const x of [Promise.resolve(1), 2, Promise.resolve(3)]) { out += x } return out } await f()",
5821            "123",
5822        ),
5823        // for await...of: Symbol.asyncIterator を実装した独自オブジェクトを手動駆動。
5824        (
5825            "async function f(){ var obj={}; obj[Symbol.asyncIterator]=function(){ var i=0; return {next:function(){ i++; if (i<=3) { return Promise.resolve({value:i,done:false}); } return Promise.resolve({value:undefined,done:true}); }}; }; var out=''; for await (const x of obj){ out += x } return out } await f()",
5826            "123",
5827        ),
5828        // async generator インスタンスは Symbol.asyncIterator を公開すべき
5829        // (Generator.prototype[Symbol.asyncIterator] は自分自身を返す仕様)。
5830        // 以前は generator_method に asyncIterator/iterator の登録が無く、for await が
5831        // 常に eager-drain フォールバックへ落ちていた(値は一致するが例外伝播が違った)。
5832        (
5833            "async function* g(){ yield 1; yield 2; yield 3; } typeof g()[Symbol.asyncIterator]",
5834            "function",
5835        ),
5836        (
5837            "async function* g(){ yield 1; yield 2; yield 3; } var it=g(); it[Symbol.asyncIterator]() === it",
5838            "true",
5839        ),
5840        (
5841            "async function* g(){ yield 1; yield 2; yield 3; } async function f(){ var out=''; for await (const x of g()) { out += x } return out } await f()",
5842            "123",
5843        ),
5844        // 通常の(非 async)generator は Symbol.asyncIterator を公開してはいけない
5845        // (for await のフォールバックが正しく同期経路を通ることの確認)。
5846        (
5847            "function* g(){ yield 1; } typeof g()[Symbol.asyncIterator]",
5848            "undefined",
5849        ),
5850        // async generator が途中で例外を投げた場合、for await はそれを正しく伝播する
5851        // (eager-drain フォールバックはこれを黙って握り潰していた)。
5852        (
5853            "async function* g(){ yield 1; throw 'boom'; } async function f(){ var out=''; try { for await (const x of g()) { out += x } } catch(e) { out += ':' + e } return out } await f()",
5854            "1:boom",
5855        ),
5856        // 非宣言形式の for-of(x は既存変数): 配列を反復。
5857        ("var x; var out=''; for (x of [1,2,3]) { out += x } out", "123"),
5858        // 非宣言形式は既存の外側変数へ代入する(ループ後もその値が残る)。
5859        ("var x=0; for (x of [1,2,3]) {} x", "3"),
5860        // 非宣言形式の for-in(k は既存変数)。
5861        ("var k; var out=''; for (k in {a:1,b:2}) { out += k } out", "ab"),
5862        // 非宣言形式 + 配列分割代入 for-of。
5863        (
5864            "var a,b; var out=''; for ([a,b] of [[1,2],[3,4]]) { out += a+','+b+';' } out",
5865            "1,2;3,4;",
5866        ),
5867        // 非宣言形式 + オブジェクト分割代入 for-of。
5868        (
5869            "var a,b; var out=''; for ({a,b} of [{a:1,b:2},{a:3,b:4}]) { out += a+','+b+';' } out",
5870            "1,2;3,4;",
5871        ),
5872        // 非宣言形式 + メンバー式 for-of(obj.prop)。
5873        ("var obj={p:0}; for (obj.p of [1,2,3]) {} obj.p", "3"),
5874        // 非宣言形式 + 添字式 for-of(arr[0])。
5875        ("var arr=[0]; for (arr[0] of [7,8,9]) {} arr[0]", "9"),
5876        // New Set Methods(ES2024/2025)。仕様上第一引数は `Set` に限らず任意の
5877        // set-like(iterable)を受け付けるべきだが、以前は `&mut Interp` を持たない
5878        // `iterable_values` にフォールバックしており Generator を渡すと常に空扱いに
5879        // なるバグだった(`iterable_values`/`this_items` 系の横展開監査で見落とし)。
5880        (
5881            "function* g(){yield 3;yield 4;} [...new Set([1,2,3]).union(g())].sort().join(',')",
5882            "1,2,3,4",
5883        ),
5884        (
5885            "function* g(){yield 2;yield 3;} [...new Set([1,2,3]).intersection(g())].sort().join(',')",
5886            "2,3",
5887        ),
5888        ("[...new Set([1,2,3]).union(new Set([3,4,5]))].sort().join(',')", "1,2,3,4,5"),
5889        ("[...new Set([1,2,3]).intersection(new Set([2,3,4]))].sort().join(',')", "2,3"),
5890        ("[...new Set([1,2,3]).difference(new Set([2,3]))].join(',')", "1"),
5891        (
5892            "[...new Set([1,2,3]).symmetricDifference(new Set([2,3,4]))].sort().join(',')",
5893            "1,4",
5894        ),
5895        ("new Set([1,2]).isSubsetOf(new Set([1,2,3]))", "true"),
5896        ("new Set([1,2,3]).isSupersetOf(new Set([1,2]))", "true"),
5897        ("new Set([1,2]).isDisjointFrom(new Set([3,4]))", "true"),
5898        ("new Set([1,2]).isDisjointFrom(new Set([2,3]))", "false"),
5899        // Iterator helpers(ES2025): generator に対する map/filter/take/drop/flatMap/toArray/
5900        // forEach/some/every/find/reduce。無限イテレータには非対応の簡略実装(要素を全展開してから処理)。
5901        ("function* g(){ yield 1; yield 2; yield 3; } g().map(x=>x*2).join(',')", "2,4,6"),
5902        (
5903            "function* g(){ yield 1; yield 2; yield 3; yield 4; } g().filter(x=>x%2===0).join(',')",
5904            "2,4",
5905        ),
5906        (
5907            "function* g(){ yield 1; yield 2; yield 3; yield 4; yield 5; } g().take(2).join(',')",
5908            "1,2",
5909        ),
5910        (
5911            "function* g(){ yield 1; yield 2; yield 3; yield 4; yield 5; } g().drop(3).join(',')",
5912            "4,5",
5913        ),
5914        (
5915            "function* g(){ yield 1; yield 2; } g().flatMap(x=>[x,x*10]).join(',')",
5916            "1,10,2,20",
5917        ),
5918        ("function* g(){ yield 1; yield 2; } g().toArray().join(',')", "1,2"),
5919        (
5920            "function* g(){ yield 1; yield 2; yield 3; } var s=0; g().forEach(x=>s+=x); s",
5921            "6",
5922        ),
5923        ("function* g(){ yield 1; yield 2; yield 3; } g().some(x=>x>2)", "true"),
5924        ("function* g(){ yield 1; yield 2; yield 3; } g().every(x=>x>0)", "true"),
5925        ("function* g(){ yield 1; yield 2; yield 3; } g().find(x=>x>1)", "2"),
5926        (
5927            "function* g(){ yield 1; yield 2; yield 3; } g().reduce((a,x)=>a+x,0)",
5928            "6",
5929        ),
5930        // Iterator.from(ES2025): 任意のイテラブル(配列/Set/Generator)を Iterator helpers
5931        // 一式にアクセスできる形でラップする。map/filter 等は Array.prototype 経由、
5932        // take/drop/toArray は Iterator helpers 経由(Array に無いメソッドのため)。
5933        ("Iterator.from([1,2,3]).map(x=>x*2).join(',')", "2,4,6"),
5934        ("Iterator.from([1,2,3,4,5]).take(2).join(',')", "1,2"),
5935        ("Iterator.from([1,2,3,4,5]).drop(3).join(',')", "4,5"),
5936        ("Iterator.from(new Set([1,2,3])).toArray().join(',')", "1,2,3"),
5937        (
5938            "function* g(){ yield 1; yield 2; yield 3; } Iterator.from(g()).take(2).join(',')",
5939            "1,2",
5940        ),
5941        // Iterator.concat(ES2025 Standard): 複数のイテラブル(配列、Set、Generator等)をシームレスに結合する。
5942        ("Iterator.concat([1,2], new Set([3,4]), [5]).toArray().join(',')", "1,2,3,4,5"),
5943        ("Iterator.concat(['a','b'], ['c']).take(2).toArray().join(',')", "a,b"),
5944        // `instanceof`(ES1 以来の基礎演算子)が `BinaryOp::InstanceOf => Value::Bool(false)`
5945        // という未実装のプレースホルダのまま放置され、常に false を返す重大バグだった。
5946        // OrdinaryHasInstance 相当(`r.prototype` を起点に `l` のプロトタイプ連鎖を辿る)を実装。
5947        ("function Foo(){} new Foo() instanceof Foo", "true"),
5948        ("function Foo(){} function Bar(){} new Foo() instanceof Bar", "false"),
5949        ("class Animal{} class Dog extends Animal{} new Dog() instanceof Animal", "true"),
5950        ("class Animal{} class Dog extends Animal{} new Dog() instanceof Dog", "true"),
5951        ("1 instanceof Object", "false"),
5952        // 組み込みの `Object`/`Array` コンストラクタは(他のビルトインメソッド解決と同様に
5953        // ObjKind による特殊扱いで実装されており)実際の `.prototype` オブジェクトを
5954        // 持たないため、リテラルとの `instanceof` は常に false になる簡略実装の既知の限界。
5955        // ユーザー定義の function/class コンストラクタ(実際に `.prototype` を持つ)が
5956        // 主要なユースケースであり、そちらは上のテストの通り正しく動作する。
5957        ("({}) instanceof Object", "true"),
5958        ("[] instanceof Array", "true"),
5959        // グローバルな `Error` コンストラクタ自体が長期間欠落しており(TypeError/RangeError/
5960        // SyntaxError というサブタイプだけが存在し基底の `Error` が無い状態だった)、
5961        // `new Error("msg")` は「Error is not defined」で ReferenceError になっていた。
5962        // 合わせて各サブタイプの `.prototype` を `Error.prototype` を proto に持つ形へ
5963        // 再構成し、`instanceof` の実装と対で `new TypeError() instanceof Error` 等が
5964        // 正しく true になるようにした。
5965        ("new Error('boom').message", "boom"),
5966        ("new Error('boom').name", "Error"),
5967        ("new Error('boom') instanceof Error", "true"),
5968        // `Error.prototype.stack`(丸ごと未対応だった)。実際のコールフレーム
5969        // 一覧は再現できないため、V8 の1行目と同じ `"name: message"` 形式の
5970        // 簡略実装(詳細は `builtins::build_error_stack` 参照)。
5971        ("new Error('boom').stack", "Error: boom"),
5972        ("new TypeError('x').stack", "TypeError: x"),
5973        ("typeof new Error().stack === 'string' && new Error().stack.length > 0", "true"),
5974        (
5975            "(function(){ try { null.foo; } catch(e) { return typeof e.stack; } })()",
5976            "string",
5977        ),
5978        ("new TypeError('x') instanceof Error", "true"),
5979        ("new TypeError('x') instanceof TypeError", "true"),
5980        ("new RangeError('x') instanceof TypeError", "false"),
5981        ("new Uint8Array(1) instanceof Uint8Array", "true"),
5982        ("new Int8Array(1) instanceof Int8Array", "true"),
5983        ("new Uint8Array(1) instanceof Int8Array", "false"),
5984        ("Object.getPrototypeOf(new Uint8Array(1)) === Uint8Array.prototype", "true"),
5985        ("Uint8Array.prototype.constructor === Uint8Array", "true"),
5986        (
5987            "try { null.x } catch(e) { e instanceof Error }",
5988            "true",
5989        ),
5990        // ユーザー定義のカスタムエラークラス(`class MyError extends Error`)は、`super(msg)`
5991        // が到達するネイティブ `Error` コンストラクタが `this`(サブクラスのインスタンス。
5992        // proto は MyError.prototype → Error.prototype と連鎖)へ直接 message を書き込む
5993        // ことに依存しており、今回の一連の修正で自然に動くようになった実用パターン。
5994        (
5995            "class MyError extends Error { constructor(m){ super(m); this.name='MyError'; } } var e = new MyError('bad'); e.message + '/' + e.name",
5996            "bad/MyError",
5997        ),
5998        (
5999            "class MyError extends Error { constructor(m){ super(m); } } new MyError('x') instanceof Error",
6000            "true",
6001        ),
6002        (
6003            "class MyError extends Error { constructor(m){ super(m); } } new MyError('x') instanceof MyError",
6004            "true",
6005        ),
6006        // **重要**: `Symbol.hasInstance`(ES2015。`class Foo { static
6007        // [Symbol.hasInstance](x){...} }` によるカスタム `instanceof` 判定)が丸ごと
6008        // 未対応で、常にプロトタイプ連鎖の照合に決め打ちされていた。
6009        (
6010            "class Even { static [Symbol.hasInstance](n){ return typeof n === 'number' && n % 2 === 0; } } (4 instanceof Even) + ',' + (3 instanceof Even)",
6011            "true,false",
6012        ),
6013        (
6014            "class AlwaysTrue { static [Symbol.hasInstance](x){ return true; } } ({} instanceof AlwaysTrue)",
6015            "true",
6016        ),
6017        // `Error.isError(value)`(ES2025)が丸ごと欠落していた。`instanceof Error` と違い
6018        // `Symbol.hasInstance`/`Error.prototype` の上書きに影響されず組込み proto を直接見る。
6019        ("Error.isError(new Error('x'))", "true"),
6020        ("Error.isError(new TypeError('x'))", "true"),
6021        (
6022            "class MyError extends Error { constructor(m){ super(m); } } Error.isError(new MyError('x'))",
6023            "true",
6024        ),
6025        ("Error.isError({message:'x'})", "false"),
6026        ("Error.isError(42)", "false"),
6027        ("Error.isError(undefined)", "false"),
6028        // `new Error(msg, {cause})`(ES2022)が丸ごと未対応で、`err.cause` が常に
6029        // `undefined` になっていた(例外を包んで再送出する定番イディオムで使われる)。
6030        ("new Error('wrap', {cause: 'orig'}).cause", "orig"),
6031        ("typeof new Error('x').cause", "undefined"),
6032        ("new TypeError('t', {cause: 42}).cause", "42"),
6033        (
6034            "try { throw new Error('inner') } catch(e) { new Error('outer', {cause: e}).cause.message }",
6035            "inner",
6036        ),
6037        // `RegExp.escape(str)`(ES2025)が丸ごと未対応だった。ユーザー入力を
6038        // `new RegExp(...)` へそのまま渡す前に構文文字を無害化する定番イディオム。
6039        ("RegExp.escape('a.b*c')", "a\\.b\\*c"),
6040        ("new RegExp(RegExp.escape('1+1=2')).test('1+1=2')", "true"),
6041        (
6042            "new RegExp('^' + RegExp.escape('a.b') + '$').test('aXb')",
6043            "false",
6044        ),
6045        // `RegExp.prototype.compile()`(レガシーだが仕様に残るメソッド。丸ごと
6046        // 未対応だった)。`this` を新しいオブジェクトを作らずその場で差し替える。
6047        ("var r=/a/; r.compile('b'); r.test('b')", "true"),
6048        ("var r=/a/i; r.compile('a'); r.flags", ""),
6049        ("var r=/a/; r.compile('a','gi'); r.flags", "gi"),
6050        ("var r=/a/g; r.lastIndex=3; r.compile('b'); r.lastIndex", "0"),
6051        ("var r=/x/; var r2=r.compile('y'); r===r2", "true"),
6052        // `CSS.escape(str)`(CSSOM。丸ごと未対応だった。`CSS` 名前空間自体が
6053        // 存在しなかった)。
6054        ("CSS.escape('a.b')", "a\\.b"),
6055        ("CSS.escape('.foo#bar')", "\\.foo\\#bar"),
6056        ("CSS.escape('123')", "\\31 23"),
6057        ("CSS.escape('-1')", "-\\31 "),
6058        ("CSS.escape('-')", "\\-"),
6059        ("CSS.escape('abc')", "abc"),
6060        // `CSS.supports(conditionText)`/`CSS.supports(property, value)`
6061        // (CSSOM。丸ごと未対応だった。`@supports` の条件式評価をそのまま
6062        // 再利用するため、`not`/`and`/`or` の論理結合も正しく評価される)。
6063        ("CSS.supports('(display: grid)')", "true"),
6064        ("CSS.supports('display', 'grid')", "true"),
6065        ("CSS.supports('not (display: grid)')", "false"),
6066        (
6067            "CSS.supports('(display: grid) and (gap: 1rem)')",
6068            "true",
6069        ),
6070        (
6071            "CSS.supports('not (display: grid) or (gap: 1rem)')",
6072            "true",
6073        ),
6074        // `<audio>`/`<video>` の `.play()`/`.pause()`/`.load()`/`.canPlayType()`
6075        // (HTMLMediaElement。丸ごと未対応だった)。
6076        (
6077            "typeof document.createElement('audio').play().then",
6078            "function",
6079        ),
6080        ("typeof document.createElement('video').pause()", "undefined"),
6081        ("typeof document.createElement('audio').load()", "undefined"),
6082        ("document.createElement('video').canPlayType('video/mp4')", "maybe"),
6083        ("document.createElement('video').canPlayType('video/mp4; codecs=\"avc1.42E01E\"')", "probably"),
6084        ("document.createElement('video').canPlayType('video/ogg')", ""),
6085        // ARIA 反映 IDL 属性(`.role`/`.ariaLabel`/`.ariaChecked` 等)が丸ごと
6086        // 未対応だった。
6087        ("document.createElement('div').role", "null"),
6088        (
6089            "var e=document.createElement('div'); e.role='button'; e.getAttribute('role')",
6090            "button",
6091        ),
6092        (
6093            "var e=document.createElement('div'); e.setAttribute('aria-label','x'); e.ariaLabel",
6094            "x",
6095        ),
6096        (
6097            "var e=document.createElement('div'); e.ariaExpanded='true'; \
6098             e.getAttribute('aria-expanded')",
6099            "true",
6100        ),
6101        (
6102            "var e=document.createElement('div'); e.ariaLabel='x'; e.ariaLabel=null; \
6103             e.hasAttribute('aria-label')",
6104            "false",
6105        ),
6106        // 表・リスト系の残りの ARIA 反映 IDL 属性(丸ごと未対応だった。
6107        // 2026-07-15 発見・実装)。
6108        (
6109            "var e=document.createElement('div'); e.ariaColCount='3'; \
6110             e.getAttribute('aria-colcount')",
6111            "3",
6112        ),
6113        (
6114            "var e=document.createElement('div'); e.setAttribute('aria-rowindex','2'); \
6115             e.ariaRowIndex",
6116            "2",
6117        ),
6118        (
6119            "var e=document.createElement('div'); e.ariaSetSize='5'; e.ariaPosInSet='2'; \
6120             e.ariaSetSize + ',' + e.ariaPosInSet",
6121            "5,2",
6122        ),
6123        (
6124            "var e=document.createElement('div'); e.ariaLevel='1'; e.getAttribute('aria-level')",
6125            "1",
6126        ),
6127        // `String.prototype.repeat(count)` が仕様上必須の「負値/+Infinity で RangeError」
6128        // を投げず黙って空文字列に丸めていたバグ。
6129        ("'ab'.repeat(3)", "ababab"),
6130        ("'x'.repeat(0)", ""),
6131        (
6132            "try { 'x'.repeat(-1); 'no-throw' } catch(e) { 'threw' }",
6133            "threw",
6134        ),
6135        (
6136            "try { 'x'.repeat(Infinity); 'no-throw' } catch(e) { 'threw' }",
6137            "threw",
6138        ),
6139        // `eval`/`Function`(ES1 の最基礎機能の2つ)が丸ごと欠落していた
6140        // (`eval is not a function`/`Function is not defined`)。
6141        ("eval('1 + 2 * 3')", "7"),
6142        ("eval(42)", "42"),
6143        ("var x = 10; eval('x = x + 5'); x", "15"),
6144        ("new Function('a', 'b', 'return a + b')(3, 4)", "7"),
6145        ("new Function('return 1 + 1')()", "2"),
6146        (
6147            "typeof new Function('a', 'return a * 2')",
6148            "function",
6149        ),
6150        // Iterator Helpers(ES2025)が丸ごと未対応だった。`arr.values()` 等が返す軽量
6151        // イテレータに `map`/`filter`/`take`/`drop`/`toArray`/`forEach`/`reduce` を追加。
6152        ("[1,2,3].values().map(x => x * 2).toArray().join(',')", "2,4,6"),
6153        ("[1,2,3,4].values().filter(x => x % 2 === 0).toArray().join(',')", "2,4"),
6154        ("[1,2,3,4,5].values().take(2).toArray().join(',')", "1,2"),
6155        ("[1,2,3,4,5].values().drop(3).toArray().join(',')", "4,5"),
6156        (
6157            "[1,2,3].values().map(x => x + 1).filter(x => x > 2).toArray().join(',')",
6158            "3,4",
6159        ),
6160        (
6161            "var s=''; [1,2,3].values().forEach(x => s += x); s",
6162            "123",
6163        ),
6164        ("[1,2,3,4].values().reduce((a,b) => a + b)", "10"),
6165        ("[1,2,3].values().reduce((a,b) => a + b, 10)", "16"),
6166        // `some`/`every`/`find`(同じ ES2025 Iterator Helpers 提案に含まれる残り3つ
6167        // が丸ごと未対応だった。`map`/`filter`/`take`/`drop`/`toArray`/`forEach`/
6168        // `reduce` は既に対応済み)。
6169        ("[1,2,3].values().some(x => x > 2)", "true"),
6170        ("[1,2,3].values().some(x => x > 5)", "false"),
6171        ("[1,2,3].values().every(x => x > 0)", "true"),
6172        ("[1,2,3].values().every(x => x > 1)", "false"),
6173        ("[1,2,3,4].values().find(x => x % 2 === 0)", "2"),
6174        ("typeof [1,2,3].values().find(x => x > 5)", "undefined"),
6175        // `flatMap`(ES2025 Iterator Helpers 提案の最後の1つが丸ごと未対応だった)。
6176        (
6177            "[1,2,3].values().flatMap(x => [x, x * 10]).toArray().join(',')",
6178            "1,10,2,20,3,30",
6179        ),
6180        // `Iterator.prototype.flatMap` のマッパー戻り値が配列以外の iterable(Generator 等)
6181        // でも展開されるべき(以前は実配列以外を無条件で空扱いする同型のバグがあった)。
6182        (
6183            "function* dup(x){ yield x; yield x*10; } [1,2].values().flatMap(x => dup(x)).toArray().join(',')",
6184            "1,10,2,20",
6185        ),
6186        // `Object.getPrototypeOf`/`Object.setPrototypeOf`(ES5/ES6。`Reflect` 版は既に
6187        // あったが、実用上はるかに一般的なこちらの静的メソッドが欠落していた)。
6188        (
6189            "function Foo(){} Object.getPrototypeOf(new Foo()) === Foo.prototype",
6190            "true",
6191        ),
6192        (
6193            "var a={}; var b={x:1}; Object.setPrototypeOf(a,b); a.x",
6194            "1",
6195        ),
6196        // `Object.setPrototypeOf` は循環参照を検証しないため、循環したプロトタイプ
6197        // 連鎖を持つオブジェクトへのプロパティ読み書き/`in`/`for...in` が無限ループ
6198        // (QEMU 起動ハング)になり得たバグ。
6199        (
6200            "var a={}; Object.setPrototypeOf(a,a); a.nope",
6201            "undefined",
6202        ),
6203        (
6204            "var a={}; var b={}; Object.setPrototypeOf(a,b); Object.setPrototypeOf(b,a); a.nope",
6205            "undefined",
6206        ),
6207        (
6208            "var a={}; Object.setPrototypeOf(a,a); ('nope' in a)",
6209            "false",
6210        ),
6211        (
6212            "var a={}; Object.setPrototypeOf(a,a); a.x=1; a.x",
6213            "1",
6214        ),
6215        (
6216            "var a={}; Object.setPrototypeOf(a,a); var ks=[]; for (var k in a) { ks.push(k); } ks.length",
6217            "0",
6218        ),
6219        // `obj.__proto__`(Annex B のレガシーアクセサ。`Object.getPrototypeOf`/
6220        // `setPrototypeOf` は既に対応済みだったが、実務コードで極めて広く使われる
6221        // こちらの糖衣構文自体が丸ごと未対応だった)。
6222        ("var a={}; var b={x:1}; a.__proto__ = b; a.x", "1"),
6223        ("var b={x:1}; var a=Object.create(b); a.__proto__ === b", "true"),
6224        // 【2026-11-16】`({}).__proto__` は `Object.prototype`(V8 と同じ。以前は null を期待していた)。
6225        ("({}).__proto__ === Object.prototype", "true"),
6226        // 原型を null にした後の `a.__proto__` は V8 では undefined(`__proto__` は Object.prototype の
6227        // アクセサで、それを継がなくなる)。この処理系は null を返す(既知の差)。
6228        ("var a={}; a.__proto__ = null; a.__proto__", "null"),
6229        // オブジェクトリテラル内の `__proto__: value`(算出キーでない場合)は
6230        // 通常のプロパティではなく [[Prototype]] を設定する特別構文(Annex B.3.1)。
6231        ("var p={x:5}; var o={__proto__: p}; o.x", "5"),
6232        ("var p={x:5}; var o={__proto__: p}; Object.keys(o).includes('__proto__')", "false"),
6233        // 算出キー `{['__proto__']: v}` は通常の own プロパティのまま(特別扱いしない)。
6234        ("var o={['__proto__']: 5}; o.__proto__", "5"),
6235        // `Object.prototype.isPrototypeOf`/`propertyIsEnumerable`。
6236        ("function Foo(){} Foo.prototype.isPrototypeOf(new Foo())", "true"),
6237        ("({}).isPrototypeOf({})", "false"),
6238        ("({x:1}).propertyIsEnumerable('x')", "true"),
6239        ("({x:1}).propertyIsEnumerable('y')", "false"),
6240        // `Function.prototype.call`/`apply`/`bind`(ES3/ES5)が丸ごと欠落していた
6241        // (`Reflect.apply` はあったが、はるかに一般的なこちらのインスタンスメソッドが無かった)。
6242        ("function f(a,b){ return this.x+a+b; } f.call({x:10}, 1, 2)", "13"),
6243        ("function f(a,b){ return this.x+a+b; } f.apply({x:10}, [1,2])", "13"),
6244        // `Function.prototype.apply` の第2引数も `Reflect.apply` と同じく array-like
6245        // 全般(非配列)を受け付けるべきだが、以前は `iterable_values` を使っており
6246        // 素の array-like を渡すと引数が消える同型のバグだった。
6247        (
6248            "function f(a,b){ return this.x+a+b; } f.apply({x:10}, {0:1,1:2,length:2})",
6249            "13",
6250        ),
6251        (
6252            "function f(a,b){ return this.x+a+b; } var g = f.bind({x:10}, 1); g(2)",
6253            "13",
6254        ),
6255        (
6256            "function f(){ return this.x; } var g = f.bind({x:5}); g.call({x:99})",
6257            "5",
6258        ),
6259        // `new.target`(ES6 MetaProperty)が未実装だった。`new` 経由の呼び出しでは
6260        // コンストラクタ自身、通常呼び出しでは undefined になる。
6261        // `new Foo()` はコンストラクタが(オブジェクトではなく)真偽値を return しても
6262        // 仕様どおり無視され `this`(構築済みインスタンス)を返すため、`new.target` の値は
6263        // 外側の変数に代入して確認する。
6264        (
6265            "var r; function Foo(){ r = new.target === Foo; } new Foo(); r",
6266            "true",
6267        ),
6268        ("function Foo(){ return new.target === Foo; } Foo()", "false"),
6269        (
6270            "function Foo(){ return typeof new.target; } Foo()",
6271            "undefined",
6272        ),
6273        (
6274            "class Foo { constructor(){ this.isNew = new.target === Foo; } } new Foo().isNew",
6275            "true",
6276        ),
6277        // アロー関数は `this` と同様に `new.target` もレキシカルに周囲から継承する
6278        // (アロー自身は `new` できず独自のフレームを持たないため)。
6279        (
6280            "var r; function Foo(){ var f = () => { r = new.target === Foo; }; f(); } new Foo(); r",
6281            "true",
6282        ),
6283        // `catch` 節の分割代入パターン(ES2015)。以前は `catch_param` が単なる識別子
6284        // 文字列で、パターン(`{message}` 等)を受け付けられなかった。
6285        (
6286            "try { throw {message:'boom', code:42}; } catch({message, code}) { message + '/' + code; }",
6287            "boom/42",
6288        ),
6289        (
6290            "try { throw [1,2,3]; } catch([a,,c]) { a + '/' + c; }",
6291            "1/3",
6292        ),
6293        ("try { throw 'x'; } catch(e) { e; }", "x"),
6294        // クラスの算出メソッド名 `[expr](){}` が未対応だった(パーサがキーとして
6295        // 識別子/文字列/数値/`[`を含む未知トークンを読み飛ばすだけで、`[Symbol.iterator]`
6296        // のようなよくあるパターンが正しくパースできなかった)。
6297        (
6298            "class C { ['foo' + 'bar'](){ return 42; } } new C().foobar()",
6299            "42",
6300        ),
6301        // 上の算出メソッド名対応と組み合わせ、`for...of` がユーザー定義の
6302        // `[Symbol.iterator]()` を実装したカスタムイテラブル(class)を正しく駆動できる
6303        // ようにした(従来は Array/Set/Map/Generator/文字列以外は「オブジェクト自身の
6304        // プロパティ値」を無条件に列挙するだけで、Symbol.iterator 自体を一切見ていなかった)。
6305        (
6306            "class Range { constructor(n){ this.n = n; } [Symbol.iterator](){ var i=0, n=this.n; return { next(){ return i<n ? {value:i++, done:false} : {value:undefined, done:true}; } }; } } var s=''; for (const x of new Range(4)) { s += x; } s",
6307            "0123",
6308        ),
6309        (
6310            "class Range { constructor(n){ this.n = n; } [Symbol.iterator](){ var i=0, n=this.n; return { next(){ return i<n ? {value:i++, done:false} : {value:undefined, done:true}; } }; } } [...new Range(3)].join(',')",
6311            "0,1,2",
6312        ),
6313        // `[Symbol.iterator]` 等の偽装 Symbol キーが `Object.keys`/`values`/`entries`/
6314        // `for...in`/`JSON.stringify` に漏れて列挙されてしまうバグの検証
6315        // (`Object.assign`/スプレッド構文は仕様どおり対象のままなので混同しないこと)。
6316        (
6317            "var o={a:1}; o[Symbol.iterator]=function(){}; Object.keys(o).join(',')",
6318            "a",
6319        ),
6320        (
6321            "var o={a:1}; o[Symbol.iterator]=function(){}; Object.values(o).join(',')",
6322            "1",
6323        ),
6324        (
6325            "var o={a:1}; o[Symbol.iterator]=function(){}; JSON.stringify(o)",
6326            "{\"a\":1}",
6327        ),
6328        (
6329            "var o={a:1}; o[Symbol.iterator]=function(){}; var k=''; for (const x in o) { k+=x; } k",
6330            "a",
6331        ),
6332        // `Date` が丸ごと未実装だった(`performance.now()` はあったが実時刻を持たない
6333        // 単純カウンタで、`Date` 自体はグローバルに存在しなかった)。実時刻は NTP 同期済みの
6334        // カーネル壁時計(`kernel::timer::get_unix_time()`)を利用する。
6335        (
6336            "new Date(2024, 0, 15, 10, 30, 45, 500).toISOString()",
6337            "2024-01-15T10:30:45.500Z",
6338        ),
6339        ("new Date(0).toISOString()", "1970-01-01T00:00:00.000Z"),
6340        // 束縛関数の new(ES5 の `new (Function.prototype.bind.apply(C, [null].concat(args)))`)。
6341        ("function ZB(a,b){this.s=a+b;} ZB.prototype.get=function(){return this.s;}; var zb=new (Function.prototype.bind.apply(ZB,[null].concat([2,3]))); [zb instanceof ZB, zb.get()].join()", "true,5"),
6342        ("function ZC(a,b){this.v=a*10+b;} var ZCB=ZC.bind({},4); new ZCB(2).v", "42"),
6343        // toUTCString/toGMTString(cookie の expires= に使われる。未実装だった)。
6344        ("new Date(0).toUTCString()", "Thu, 01 Jan 1970 00:00:00 GMT"),
6345        ("new Date(2024, 1, 29, 7, 5, 9).toGMTString()", "Thu, 29 Feb 2024 07:05:09 GMT"),
6346        ("new Date(NaN).toUTCString()", "Invalid Date"),
6347        // `toDateString`/`toTimeString`/`toLocaleDateString`/`toLocaleTimeString` は
6348        // 以前すべて `toString`(フルISO日時文字列)にエイリアスされており、日付のみ/
6349        // 時刻のみを返すべきところに他方の情報が混入していた。
6350        (
6351            "new Date(2024, 0, 15, 10, 30, 45, 500).toDateString()",
6352            "2024-01-15",
6353        ),
6354        (
6355            "new Date(2024, 0, 15, 10, 30, 45, 500).toTimeString()",
6356            "10:30:45",
6357        ),
6358        (
6359            "new Date(2024, 0, 15).toLocaleDateString()",
6360            "2024-01-15",
6361        ),
6362        ("new Date(2024, 0, 15).toLocaleTimeString()", "00:00:00"),
6363        ("new Date(2024, 0, 1).getFullYear()", "2024"),
6364        ("new Date(2024, 5, 15).getMonth()", "5"),
6365        ("new Date(2024, 0, 1).getDay()", "1"), // 2024-01-01 は月曜日
6366        // getTimezoneOffset()(丸ごと未対応だった)。UTC を常にローカルとみなす簡略実装のため常に0。
6367        ("typeof new Date().getTimezoneOffset()", "number"),
6368        ("new Date().getTimezoneOffset()", "0"),
6369        // `Date.prototype.set*` が `setTime` も含めて1つも実装されておらず、getter
6370        // しか無い丸ごと未対応バグだった(`setFullYear`/`setDate` 等の定番書き換え
6371        // イディオムが軒並み `undefined is not a function` になっていた)。
6372        (
6373            "var d=new Date(2024,0,15); d.setFullYear(2025); d.getFullYear()+'-'+(d.getMonth()+1)+'-'+d.getDate()",
6374            "2025-1-15",
6375        ),
6376        // `getYear`/`setYear`(Annex B.2.4/B.2.5。2桁年時代の遺産)が丸ごと未対応だった。
6377        ("new Date(2024,0,1).getYear()", "124"),
6378        // `setYear(y)` は `0<=y<=99` なら `1900+y` を、それ以外は `y` をそのまま
6379        // フルイヤーとして使う仕様どおりの奇妙な後方互換ロジック。
6380        ("var d=new Date(2024,0,1); d.setYear(5); d.getFullYear()", "1905"),
6381        ("var d=new Date(2024,0,1); d.setYear(2030); d.getFullYear()", "2030"),
6382        (
6383            "var d=new Date(2024,0,15); d.setMonth(5); d.getMonth()",
6384            "5",
6385        ),
6386        (
6387            "var d=new Date(2024,0,15); d.setDate(d.getDate()+1); d.getDate()",
6388            "16",
6389        ),
6390        // setDate は月境界を仕様どおり繰り上げる。
6391        (
6392            "var d=new Date(2024,0,31); d.setDate(d.getDate()+1); (d.getMonth()+1)+'-'+d.getDate()",
6393            "2-1",
6394        ),
6395        (
6396            "var d=new Date(2024,0,15,10,20,30); d.setHours(23); d.getHours()+':'+d.getMinutes()+':'+d.getSeconds()",
6397            "23:20:30",
6398        ),
6399        (
6400            "var d=new Date(2024,0,15,10,20,30); d.setMinutes(5); d.getMinutes()",
6401            "5",
6402        ),
6403        (
6404            "var d=new Date(2024,0,15,10,20,30); d.setSeconds(59); d.getSeconds()",
6405            "59",
6406        ),
6407        (
6408            "var d=new Date(2024,0,15); d.setMilliseconds(123); d.getMilliseconds()",
6409            "123",
6410        ),
6411        (
6412            "var d=new Date(0); d.setTime(5000); d.getTime()",
6413            "5000",
6414        ),
6415        // set* の戻り値は仕様どおり新しい getTime() と同じ。
6416        (
6417            "var d=new Date(0); var r=d.setFullYear(2000); r === d.getTime()",
6418            "true",
6419        ),
6420        // `Date` は `to_number()` に `ObjKind::DateObj` 特殊扱いを追加したことで、
6421        // `.getTime()` を明示せずとも算術/比較演算がそのまま動く
6422        // (この処理系はオブジェクト全般の `valueOf`/`Symbol.toPrimitive` は汎用サポートしない
6423        // ため、これは `Date` だけの特殊扱い)。
6424        ("new Date(1000) - new Date(0)", "1000"),
6425        ("new Date(0) < new Date(1000)", "true"),
6426        ("+new Date(500)", "500"),
6427        ("typeof Date.now()", "number"),
6428        // `delete`(ES1 以来の基礎演算子)が AST/パーサ/インタプリタのどこにも存在せず、
6429        // 丸ごと未実装だった(`delete` トークン自体はレキサーが認識するのに、パーサが
6430        // どの式としても解釈しない状態)。
6431        ("var o = {x:1}; delete o.x; 'x' in o", "false"),
6432        ("var o = {x:1, y:2}; delete o.x; o.y", "2"),
6433        ("var k='x'; var o = {x:1}; delete o[k]; 'x' in o", "false"),
6434        ("var a=[1,2,3]; delete a[1]; a[1]", "undefined"),
6435        ("var a=[1,2,3]; delete a[1]; a.length", "3"),
6436        ("delete 5", "true"),
6437        // カンマ演算子 — 以前はパーサが先行する式を単に上書きして AST から消してしまい、
6438        // その式の副作用(関数呼び出し・代入等)が一切実行されない重大なバグだった。
6439        ("var s=''; (s+='a', s+='b', s+='c'); s", "abc"),
6440        ("var x=(1,2,3); x", "3"),
6441        (
6442            "var s=''; for (var i=0,j=10; i<3; i++,j--) { s += i+':'+j+' '; } s",
6443            "0:10 1:9 2:8 ",
6444        ),
6445        ("var a; var b; (a=1, b=a+1); a+','+b", "1,2"),
6446        // `generator.throw(err)`(ES2015)が丸ごと未実装だった(`next`/`return` はあったが
6447        // `throw` だけが欠落)。中断中の yield 位置に例外を注入する。
6448        (
6449            "function* g(){ try { yield 1; yield 2; } catch(e) { yield 'caught:'+e; } } var it=g(); it.next(); it.throw('boom').value",
6450            "caught:boom",
6451        ),
6452        (
6453            "function* g(){ yield 1; yield 2; } var it=g(); it.next(); var r; try { it.throw('x'); } catch(e) { r = 'propagated:'+e; } r",
6454            "propagated:x",
6455        ),
6456        // `String.prototype.codePointAt`(ES2015)/`localeCompare`(ES3)が丸ごと未実装だった。
6457        ("'A'.codePointAt(0)", "65"),
6458        ("'ABC'.codePointAt(5)", "undefined"),
6459        ("'a'.localeCompare('b')", "-1"),
6460        ("'b'.localeCompare('a')", "1"),
6461        ("'a'.localeCompare('a')", "0"),
6462        // `String.prototype.substr`(ES3 由来の Annex B 非推奨メソッド)が `slice`/
6463        // `substring` はあったのに欠落していた。古いコードで依然として広く使われる。
6464        ("'Hello World'.substr(6)", "World"),
6465        ("'Hello World'.substr(0, 5)", "Hello"),
6466        ("'Hello World'.substr(-5)", "World"),
6467        ("'Hello World'.substr(-5, 3)", "Wor"),
6468        // `static { ... }`(ES2022 静的初期化ブロック)が未実装だった。パーサはメソッド名
6469        // として識別子/文字列/数値/`[computed]` しか認識せず、`{` が来ると読み飛ばして
6470        // 続行する未実装フォールバックに落ちていた。
6471        (
6472            "class C { static x; static { C.x = 1 + 2; } } C.x",
6473            "3",
6474        ),
6475        (
6476            "class C { static x = 10; static { C.x += 5; } } C.x",
6477            "15",
6478        ),
6479        // 複数の static ブロックは宣言順に実行される。
6480        (
6481            "class C { static log=''; static { C.log+='a'; } static { C.log+='b'; } } C.log",
6482            "ab",
6483        ),
6484        // `Array.prototype.flat(depth)` が `depth` 引数を完全に無視し、常に1段しか
6485        // 展開しないバグだった。`.flat(Infinity)`(深いネスト解除の定番イディオム)も
6486        // 動作していなかった。
6487        ("[1,[2,3]].flat().join(',')", "1,2,3"),
6488        ("[1,[2,[3,[4]]]].flat(2).join(',')", "1,2,3,4"),
6489        ("[1,[2,[3,[4,[5]]]]].flat(Infinity).join(',')", "1,2,3,4,5"),
6490        // `.flat(Infinity)` は循環参照する配列(`a.push(a)`)に対しては祖先追跡
6491        // ガードが無いと無限再帰になり、この no_std 環境ではスタック
6492        // オーバーフロー(クラッシュ/ハング)に直結し得るバグだった(2026-07-13。
6493        // `Value::to_js_string` で修正済みの循環参照系と同種)。クラッシュ/
6494        // ハングせず完走することを確認する(既に祖先に現れた配列はそれ以上
6495        // 展開されずそのまま結果に含まれるため、要素数は打ち切り位置に依存)。
6496        ("var a=[1]; a.push(a); a.flat(Infinity); 'ok'", "ok"),
6497        // depth=0 は展開しない(トップレベルの要素数がそのまま length に残ることで確認)。
6498        ("[1,[2,[3]]].flat(0).length", "2"),
6499        // `Object.freeze()` が明示的な no-op(同一オブジェクトを返すだけ)だった。
6500        // `Object.isFrozen()` 自体も丸ごと欠落していた。
6501        ("var o={x:1}; Object.freeze(o); o.x=2; o.x", "1"),
6502        ("var o={x:1}; Object.freeze(o); o.y=2; 'y' in o", "false"),
6503        ("var o={x:1}; Object.freeze(o); delete o.x; o.x", "1"),
6504        ("var o={x:1}; Object.isFrozen(o)", "false"),
6505        ("var o={x:1}; Object.freeze(o); Object.isFrozen(o)", "true"),
6506        ("Object.isFrozen(5)", "true"),
6507        // `Object.seal`/`isSealed`/`preventExtensions`/`isExtensible` も丸ごと欠落していた。
6508        ("var o={x:1}; Object.seal(o); o.x=2; o.x", "2"),
6509        ("var o={x:1}; Object.seal(o); o.y=2; 'y' in o", "false"),
6510        ("var o={x:1}; Object.seal(o); delete o.x; 'x' in o", "true"),
6511        ("var o={x:1}; Object.isSealed(o)", "false"),
6512        ("var o={x:1}; Object.seal(o); Object.isSealed(o)", "true"),
6513        (
6514            "var o={x:1}; Object.preventExtensions(o); o.y=2; 'y' in o",
6515            "false",
6516        ),
6517        (
6518            "var o={x:1}; Object.preventExtensions(o); o.x=5; delete o.x; 'x' in o",
6519            "false",
6520        ),
6521        ("var o={x:1}; Object.isExtensible(o)", "true"),
6522        (
6523            "var o={x:1}; Object.preventExtensions(o); Object.isExtensible(o)",
6524            "false",
6525        ),
6526        // `Array.isArray` は仕様上 Proxy を透過して target を見る必要があるが、
6527        // 以前は Proxy でラップした配列が false 判定になっていた。
6528        ("Array.isArray(new Proxy([1,2], {}))", "true"),
6529        ("Array.isArray(new Proxy({}, {}))", "false"),
6530        // TypedArray も内部表現は ObjKind::Array を流用するため、`_ta_kind` タグを
6531        // 見ずに判定すると `Array.isArray(new Int8Array(...))` が仕様に反して
6532        // `true` になるバグだった(TypedArray は Array exotic object ではない)。
6533        ("Array.isArray(new Int8Array([1,2]))", "false"),
6534        ("Array.isArray([1,2])", "true"),
6535        // `Object.keys`/`values`/`entries` は Proxy を素通しできず(Proxy 自身は props を
6536        // 持たないため)常に空を返すバグだった。target フォワードのみの Proxy では
6537        // 正しく動くようにした(ownKeys トラップの呼び出しまでは非対応)。
6538        ("Object.keys(new Proxy({a:1,b:2}, {})).sort().join(',')", "a,b"),
6539        ("Object.values(new Proxy({a:1,b:2}, {})).sort().join(',')", "1,2"),
6540        (
6541            "Object.entries(new Proxy({a:1}, {})).map(e=>e[0]+':'+e[1]).join(',')",
6542            "a:1",
6543        ),
6544        // `JSON.stringify` も同じ Proxy 透過漏れで、Proxy を渡すと常に `{}` になっていた。
6545        ("JSON.stringify(new Proxy({a:1,b:2}, {}))", "{\"a\":1,\"b\":2}"),
6546        // `for...of`/スプレッドも同じ Proxy 透過漏れで、target フォワードのみの Proxy が
6547        // 配列/Set/Map を包んでいても何も反復しないバグだった(`iterate_values()` が自身の
6548        // `ObjKind` だけを見て Proxy を Array 等として認識できていなかった)。
6549        (
6550            "var s=''; for (const x of new Proxy([1,2,3], {})) { s += x; } s",
6551            "123",
6552        ),
6553        ("[...new Proxy([1,2,3], {})].join(',')", "1,2,3"),
6554        // `Object.assign` も同じ系統のバグを2つ抱えていた: (1) ソースが Proxy だと
6555        // 何もコピーされない、(2) ソースが配列だと要素が `ObjKind::Array` 側にあり
6556        // `props` には無いため、これも何もコピーされない。
6557        (
6558            "var t = Object.assign({}, new Proxy({a:1,b:2}, {})); t.a+','+t.b",
6559            "1,2",
6560        ),
6561        (
6562            "var t = Object.assign({}, [10,20,30]); t[0]+','+t[1]+','+t[2]",
6563            "10,20,30",
6564        ),
6565        // `Reflect.deleteProperty` は `delete` 演算子と同じ凍結/封印済みオブジェクト保護を
6566        // 適用すべきだが、以前は一切チェックせず常に削除・成功させていた(非対称だった)。
6567        (
6568            "var o={x:1}; Object.freeze(o); Reflect.deleteProperty(o,'x')",
6569            "false",
6570        ),
6571        ("var o={x:1}; Reflect.deleteProperty(o,'x')", "true"),
6572        // `Reflect.set` も同様に、以前は常に `true` を返しており、凍結済みオブジェクトへの
6573        // 書込みが黙殺されていても呼び出し元からは成功したように見えていた。
6574        (
6575            "var o={x:1}; Object.freeze(o); Reflect.set(o,'x',2)",
6576            "false",
6577        ),
6578        ("var o={x:1}; Reflect.set(o,'x',2); o.x", "2"),
6579        // `Array.prototype.includes` は SameValueZero で比較すべきところ `===` を使っており、
6580        // `[NaN].includes(NaN)` が false になるバグだった(`indexOf` は `===` のままで正しい)。
6581        ("[NaN].includes(NaN)", "true"),
6582        ("[NaN].indexOf(NaN)", "-1"),
6583        ("[1,2,NaN].includes(NaN)", "true"),
6584        ("[1,2,3].includes(2)", "true"),
6585        ("[1,2,3].includes(5)", "false"),
6586        // 高階配列メソッドの第2引数 `thisArg` が `map`/`filter`/`forEach`/`find` 系
6587        // すべてで無視されていた(コールバックの `this` を常に `undefined` 決め打ちしていた)。
6588        (
6589            "var ctx={mul:10}; [1,2,3].map(function(x){return x*this.mul;}, ctx).join(',')",
6590            "10,20,30",
6591        ),
6592        (
6593            "var ctx={min:2}; [1,2,3].filter(function(x){return x>this.min;}, ctx).join(',')",
6594            "3",
6595        ),
6596        (
6597            "var ctx={sum:0}; [1,2,3].forEach(function(x){this.sum+=x;}, ctx); ctx.sum",
6598            "6",
6599        ),
6600        (
6601            "var ctx={target:2}; [1,2,3].find(function(x){return x===this.target;}, ctx)",
6602            "2",
6603        ),
6604        (
6605            "var ctx={target:5}; [1,2,3].some(function(x){return x===this.target;}, ctx)",
6606            "false",
6607        ),
6608        (
6609            "var ctx={min:0}; [1,2,3].every(function(x){return x>this.min;}, ctx)",
6610            "true",
6611        ),
6612        // 同じ `thisArg` 無視バグが `Map.prototype.forEach`/`Set.prototype.forEach`/
6613        // `Array.from` の第3引数にもあった。
6614        (
6615            "var ctx={sum:0}; var m=new Map([['a',1],['b',2]]); m.forEach(function(v){this.sum+=v;}, ctx); ctx.sum",
6616            "3",
6617        ),
6618        (
6619            "var ctx={sum:0}; var s=new Set([1,2,3]); s.forEach(function(v){this.sum+=v;}, ctx); ctx.sum",
6620            "6",
6621        ),
6622        (
6623            "var ctx={mul:2}; Array.from([1,2,3], function(x){return x*this.mul;}, ctx).join(',')",
6624            "2,4,6",
6625        ),
6626        // `JSON.stringify` の第3引数 `space`(インデント整形。デバッグ出力の定番
6627        // イディオム `JSON.stringify(obj, null, 2)`)が完全に無視されていた。
6628        (
6629            "JSON.stringify({a:1,b:2}, null, 2)",
6630            "{\n  \"a\": 1,\n  \"b\": 2\n}",
6631        ),
6632        ("JSON.stringify([1,2], null, 2)", "[\n  1,\n  2\n]"),
6633        ("JSON.stringify({}, null, 2)", "{}"),
6634        ("JSON.stringify([], null, 2)", "[]"),
6635        ("JSON.stringify({a:1}, null, '\\t')", "{\n\t\"a\": 1\n}"),
6636        // space 省略時は従来どおりコンパクト出力のまま。
6637        ("JSON.stringify({a:1,b:2})", "{\"a\":1,\"b\":2}"),
6638        // `JSON.stringify` は BigInt を直列化できず本来 TypeError を投げるべきだが、
6639        // 以前は静かに省略していた(`undefined`/関数と同じ扱いになっていたバグ)。
6640        (
6641            "try { JSON.stringify(10n); 'no-throw' } catch(e) { 'caught:' + e.name }",
6642            "caught:Error",
6643        ),
6644        (
6645            "try { JSON.stringify({a:10n}); 'no-throw' } catch(e) { 'caught' }",
6646            "caught",
6647        ),
6648        // `replacer` 引数(キーの絞り込み用配列 / 値差し替え関数)も同様に丸ごと未対応だった。
6649        ("JSON.stringify({a:1,b:2,c:3}, ['a','c'])", "{\"a\":1,\"c\":3}"),
6650        (
6651            "JSON.stringify({a:1,b:2}, function(k,v){ return typeof v === 'number' ? v*10 : v; })",
6652            "{\"a\":10,\"b\":20}",
6653        ),
6654        // replacer 配列はオブジェクトのキー絞り込みのみに適用され、配列要素自体は
6655        // 絞り込まれない(仕様どおり)。
6656        ("JSON.stringify([1,2,3], ['a'])", "[1,2,3]"),
6657        // `JSON.parse` の第2引数 `reviver`(キーをボトムアップで巡る変換関数)も
6658        // 同様に丸ごと未対応だった。
6659        (
6660            "JSON.parse('{\"a\":1,\"b\":2}', function(k,v){ return typeof v === 'number' ? v*10 : v; }).a",
6661            "10",
6662        ),
6663        (
6664            "var r = JSON.parse('{\"a\":1,\"b\":2}', function(k,v){ return k==='b' ? undefined : v; }); 'b' in r",
6665            "false",
6666        ),
6667        (
6668            "JSON.parse('[1,2,3]', function(k,v){ return typeof v === 'number' ? v+1 : v; }).join(',')",
6669            "2,3,4",
6670        ),
6671        ("JSON.parse('{\"a\":1}').a", "1"),
6672        // `String.prototype.replaceAll` が RegExp パターン(`g` フラグ必須)・関数
6673        // リプレーサのどちらも未対応だった(RegExp を渡すと文字列表現 "/pat/flags" として
6674        // 扱われ無変換になっていた)。
6675        ("'aaa'.replaceAll(/a/g, 'b')", "bbb"),
6676        (
6677            "try { 'aaa'.replaceAll(/a/, 'b'); 'no-throw' } catch(e) { 'threw' }",
6678            "threw",
6679        ),
6680        (
6681            "'a1b2'.replaceAll(/[0-9]/g, function(m){ return '['+m+']'; })",
6682            "a[1]b[2]",
6683        ),
6684        ("'aXaXa'.replaceAll('X', function(){ return '-'; })", "a-a-a"),
6685        ("'abc'.replaceAll('x', 'y')", "abc"),
6686        // 同一の `var` 文の中で、前の宣言子を後の初期化子が参照できるか。
6687        // jQuery 1.8.2 の先頭が
6688        // `var ...,h=[],p="1.8.2",d=h.concat,...,w=p.trim,...` という形で、
6689        // ここが順に評価されないと `p` が undefined になり
6690        // 「Cannot read properties of undefined (reading 'trim')」で落ちる。
6691        ("var a1 = 1, b1 = a1 + 1; b1", "2"),
6692        ("var s1 = 'xy', t1 = s1.length; t1", "2"),
6693        ("var h1 = [], p1 = '1.8.2', w1 = p1.trim; typeof w1", "function"),
6694        ("var q1 = [], r1 = q1.push; typeof r1", "function"),
6695        // `String.prototype` が丸ごと無く、プロトタイプから直接読む形が
6696        // undefined になっていた。jQuery 1.8.2 の `o=String.prototype.trim`
6697        // で本体が実行時に落ちていた。
6698        ("typeof String.prototype", "object"),
6699        ("typeof String.prototype.trim", "function"),
6700        ("typeof String.prototype.slice", "function"),
6701        ("String.prototype.trim.call('  x  ')", "x"),
6702        ("String.prototype.toUpperCase.call('ab')", "AB"),
6703        // 実体からの解決は従来どおり。
6704        ("'  y '.trim()", "y"),
6705        // 素のオブジェクト/配列/関数から、プロトタイプ経由で
6706        // メソッドを**値として**読めるか。jQuery は
6707        // `core_toString = class2type.toString`(`class2type = {}`)のように
6708        // 読んでから `.call(...)` する。読めないと
6709        // 「Cannot read properties of undefined (reading 'call')」になる。
6710        ("typeof ({}).toString", "function"),
6711        ("typeof ({}).hasOwnProperty", "function"),
6712        ("typeof [].slice", "function"),
6713        ("typeof [].concat", "function"),
6714        ("typeof (function(){}).call", "function"),
6715        ("typeof (function(){}).apply", "function"),
6716        ("({}).toString.call([])", "[object Array]"),
6717        // `Array.prototype` はオブジェクトとしては在ったがメソッドが空だった。
6718        // jQuery 1.8.2 の
6719        // `j=Array.prototype.push,k=Array.prototype.slice,l=Array.prototype.indexOf`
6720        // で undefined になり、続く `k.call(...)` で落ちていた。
6721        ("typeof Array.prototype.push", "function"),
6722        ("typeof Array.prototype.slice", "function"),
6723        ("typeof Array.prototype.indexOf", "function"),
6724        ("Array.prototype.slice.call([1,2,3], 1).join(',')", "2,3"),
6725        ("Array.prototype.indexOf.call([4,5,6], 5)", "1"),
6726        // `Object.prototype` 側も jQuery が読む 2 つを確かめる。
6727        ("typeof Object.prototype.toString", "function"),
6728        ("typeof Object.prototype.hasOwnProperty", "function"),
6729        // jQuery 1.8.2 の機能検出は、**切り離された**要素へ innerHTML を入れ、
6730        // そこから要素を取り出して `style` を触る。この一連が通らないと
6731        // 「Cannot read properties of undefined (reading 'style')」になる。
6732        ("var d = document.createElement('div'); typeof d", "object"),
6733        ("var d2 = document.createElement('div'); typeof d2.style", "object"),
6734        (
6735            "var d3 = document.createElement('div'); d3.innerHTML = \"<a href='/a'>a</a>\";              d3.getElementsByTagName('a').length",
6736            "1",
6737        ),
6738        (
6739            "var d4 = document.createElement('div'); d4.innerHTML = \"<a href='/a'>a</a>\";              typeof d4.getElementsByTagName('a')[0]",
6740            "object",
6741        ),
6742        (
6743            "var d5 = document.createElement('div'); d5.innerHTML = \"<a href='/a'>a</a>\";              typeof d5.getElementsByTagName('a')[0].style",
6744            "object",
6745        ),
6746        (
6747            "var d6 = document.createElement('div');              d6.innerHTML = '<table></table><a href=\"/a\">a</a>';              d6.getElementsByTagName('*').length > 0",
6748            "true",
6749        ),
6750        (
6751            "var d7 = document.createElement('div'); d7.style.cssText = 'top:1px';              typeof d7.style.cssText",
6752            "string",
6753        ),
6754        (
6755            "var d8 = document.createElement('div'); d8.setAttribute('className','t');              d8.getAttribute('className')",
6756            "t",
6757        ),
6758        // jQuery 1.8.2 の機能検出が実際に入れる HTML。先頭の空白 2 つ・
6759        // 自己閉じの `<link/>`・`<table></table>` が `<a>` の前に来る。
6760        // ここで `<a>` が取れないと `d.style` で落ちる。
6761        // どの要素が原因かを分けて確かめる。
6762        (
6763            "var e1 = document.createElement('div'); e1.innerHTML = '<link/><a href=\"/a\">a</a>';              e1.getElementsByTagName('a').length",
6764            "1",
6765        ),
6766        (
6767            "var e2 = document.createElement('div');              e2.innerHTML = '<table></table><a href=\"/a\">a</a>';              e2.getElementsByTagName('a').length",
6768            "1",
6769        ),
6770        (
6771            "var e3 = document.createElement('div'); e3.innerHTML = '  <a href=\"/a\">a</a>';              e3.getElementsByTagName('a').length",
6772            "1",
6773        ),
6774        (
6775            "var e4 = document.createElement('div');              e4.innerHTML = '<input type=\"checkbox\"/><a href=\"/a\">a</a>';              e4.getElementsByTagName('a').length",
6776            "1",
6777        ),
6778        // jQuery が入れる文字列そのもの。
6779        (
6780            "var e5 = document.createElement('div');              e5.innerHTML = '  <link/><table></table><a href=\"/a\">a</a><input type=\"checkbox\"/>';              e5.getElementsByTagName('a').length",
6781            "1",
6782        ),
6783        (
6784            "var e6 = document.createElement('div');              e6.innerHTML = '  <link/><table></table><a href=\"/a\">a</a><input type=\"checkbox\"/>';              e6.getElementsByTagName('*').length > 0",
6785            "true",
6786        ),
6787        // jQuery は IIFE の中で `e = a.document`(`a = window`)として
6788        // **`window.document` 経由**で触る。グローバルの `document` を
6789        // 直接使う経路とは別なので、そちらも確かめる。
6790        ("typeof window.document", "object"),
6791        // グローバルにあるのに `window.` 経由で読めない漏れ。
6792        // jQuery 1.8.2 は `a.navigator.userAgent`(`a` は window)と書く。
6793        ("typeof window.navigator", "object"),
6794        ("typeof window.navigator.userAgent", "string"),
6795        ("window.navigator === navigator", "true"),
6796        ("typeof window.location", "object"),
6797        ("typeof window.JSON", "object"),
6798        ("typeof window.Math", "object"),
6799        ("typeof window.XMLHttpRequest", "function"),
6800        // `window.x = ...` の後に素の `x` で読めること。
6801        // jQuery 1.8.2 は最後に `a.jQuery = a.$ = p`(`a` は window)で
6802        // 自分を公開するので、これが無いと **jQuery が完走しても
6803        // `$ is not defined`** になる。
6804        ("window.myGlobal1 = 42; myGlobal1", "42"),
6805        ("window.myFn1 = function(){ return 'z'; }; myFn1()", "z"),
6806        ("window.mySelf1 = window; typeof mySelf1.document", "object"),
6807        // スコープの変数が優先される(window 側で影を作らない)。
6808        ("window.shadow1 = 'w'; var shadow1 = 'v'; shadow1", "v"),
6809        // `Object.prototype.toString` はプリミティブの種別を返す。
6810        // 全部 `[object Object]` だと、jQuery の `jQuery.extend(true, ...)` が
6811        // 文字列を「素のオブジェクト」と誤判定して `{}` に置き換える
6812        // (実際に `s.type`("GET")が壊れ `$.getJSON` が落ちていた)。
6813        ("Object.prototype.toString.call('x')", "[object String]"),
6814        ("Object.prototype.toString.call(1)", "[object Number]"),
6815        ("Object.prototype.toString.call(true)", "[object Boolean]"),
6816        ("Object.prototype.toString.call(null)", "[object Null]"),
6817        ("Object.prototype.toString.call(undefined)", "[object Undefined]"),
6818        ("Object.prototype.toString.call({})", "[object Object]"),
6819        ("Object.prototype.toString.call([])", "[object Array]"),
6820        ("Object.prototype.toString.call(function(){})", "[object Function]"),
6821        ("window.document === document", "true"),
6822        ("typeof window.document.createElement", "function"),
6823        (
6824            "var w1 = window.document.createElement('div'); typeof w1.style",
6825            "object",
6826        ),
6827        (
6828            "var w2 = window.document.createElement('div');              w2.innerHTML = '  <link/><table></table><a href=\"/a\">a</a><input type=\"checkbox\"/>';              typeof w2.getElementsByTagName('a')[0]",
6829            "object",
6830        ),
6831        // 関数の引数として渡した window から辿る形(jQuery の IIFE と同じ)。
6832        (
6833            "(function(a){ var e = a.document, n = e.createElement('div');              n.setAttribute('className','t');              n.innerHTML = '  <link/><table></table><a href=\"/a\">a</a><input type=\"checkbox\"/>';              var d = n.getElementsByTagName('a')[0]; return typeof d; })(window)",
6834            "object",
6835        ),
6836        // `replaceAll`/`matchAll` が独自の `[Symbol.replace]`/`[Symbol.matchAll]` へ
6837        // 委譲していなかった(`replace`/`match`/`search`/`split` は委譲済みだった)。
6838        // 【順序】`g` フラグの検査が**先**、委譲はその後。逆にすると
6839        // 非 g の RegExp が委譲側へ流れて TypeError が出なくなる。
6840        (
6841            "var o = {}; o[Symbol.replace] = function(s, r){ return 'X' + s + r; };              'ab'.replaceAll(o, 'Z')",
6842            "XabZ",
6843        ),
6844        (
6845            "var o = {}; o[Symbol.matchAll] = function(s){ return ['m:' + s]; };              'ab'.matchAll(o)[0]",
6846            "m:ab",
6847        ),
6848        // 委譲を足しても、非 g の RegExp は従来どおり TypeError のまま。
6849        (
6850            "try { 'aaa'.matchAll(/a/); 'no-throw' } catch(e) { 'threw' }",
6851            "threw",
6852        ),
6853        // `String.prototype.split` の第2引数 `limit` が完全に無視されていた。
6854        ("'a,b,c,d'.split(',', 2).join('|')", "a|b"),
6855        ("'a,b,c'.split(',', 0).length", "0"),
6856        ("'a1b2c3'.split(/[0-9]/, 2).join('|')", "a|b"),
6857        ("'a,b,c'.split(',').join('|')", "a|b|c"),
6858        // `matchAll` は `g` フラグ必須(無ければ TypeError)だが、以前は無条件に
6859        // 全件マッチを返していた。
6860        (
6861            "try { 'aa'.matchAll(/a/); 'no-throw' } catch(e) { 'threw' }",
6862            "threw",
6863        ),
6864        (
6865            "[...'a1b2'.matchAll(/[0-9]/g)].map(m=>m[0]).join(',')",
6866            "1,2",
6867        ),
6868        // `structuredClone` は循環参照(自己参照)を扱えず無限再帰(この no_std 環境では
6869        // クラッシュ/ハングになり得る)に陥るバグだった。
6870        (
6871            "var a={x:1}; a.self=a; var c=structuredClone(a); c.self===c",
6872            "true",
6873        ),
6874        ("var a={x:1}; a.self=a; var c=structuredClone(a); c.x", "1"),
6875        // 同一オブジェクトへの複数参照は複製後も共有構造として保たれる(仕様どおり)。
6876        (
6877            "var shared={v:1}; var o={a:shared,b:shared}; var c=structuredClone(o); c.a===c.b",
6878            "true",
6879        ),
6880        // `JSON.stringify` にも同じ「循環参照で無限再帰」バグがあった。仕様どおり
6881        // TypeError を投げるようにした(同一オブジェクトへの非循環な複数参照=
6882        // 構造共有は問題なく直列化できることも確認)。
6883        (
6884            "try { var a={}; a.self=a; JSON.stringify(a); 'no-throw' } catch(e) { 'threw' }",
6885            "threw",
6886        ),
6887        // 深いネスト(30段超)でもスタックオーバーフローせずTypeErrorをスローするかの保護テスト
6888        (
6889            "var cur={}; for(var i=0;i<40;i++){ cur={child:cur}; } try { JSON.stringify(cur); 'no-throw' } catch(e) { 'depth-exceeded' }",
6890            "depth-exceeded",
6891        ),
6892        (
6893            "var shared={v:1}; JSON.stringify({a:shared,b:shared})",
6894            "{\"a\":{\"v\":1},\"b\":{\"v\":1}}",
6895        ),
6896        // `console.log` の表示整形(`display_value`)にも同じ「循環参照で無限再帰」
6897        // バグがあった。`console.log(a)`(`a.self=a`)は特に日常的にありうる操作のため、
6898        // 一番踏みやすいケースだった(クラッシュ/ハングせず完走することを確認)。
6899        (
6900            "var a={}; a.self=a; console.log(a); 'ok'",
6901            "ok",
6902        ),
6903        (
6904            "var a=[1,2]; a.push(a); console.log(a); 'ok'",
6905            "ok",
6906        ),
6907        // `console.log` の表示整形(`display_value_inner`)が `Proxy` を
6908        // `Array`/`Plain` 以外への素通しフォールバックに落としており、
6909        // `[ 1, 2, 3 ]` のような角括弧付き表示にならず素の `"1,2,3"` に
6910        // なっていた(`Value::to_js_string` の Proxy 素通しバグ修正と同時に
6911        // 発見。target へ委譲して同じ表示ロジックへ再帰するよう修正)。
6912        (
6913            "console.log(new Proxy([1,2,3], {})); 'ok'",
6914            "ok",
6915        ),
6916        // `Value::to_js_string`(`Array.prototype.join`/`toString`・テンプレート
6917        // リテラル補間・暗黙の文字列連結が共通で使う変換)にも同じ「循環参照で
6918        // 無限再帰」バグが残っていた(`structuredClone`/`JSON.stringify`/
6919        // `console.log` は既に修正済みだったが、この経路だけ未点検だった)。
6920        // `a.push(a); a.join()` はクラッシュ/ハングせず完走し、循環要素は
6921        // 仕様どおり空文字列として扱われることを確認する。
6922        // 【2026-11-17】V8 は循環する要素(a 自身)を "" にするので "1,"(以前は 1 段だけ中を展開した "1,1," を期待していた)。
6923        ("var a=[1]; a.push(a); a.join()", "1,"),
6924        ("var a=[1]; a.push(a); String(a); 'ok'", "ok"),
6925        ("var a=[1]; a.push(a); `${a}`; 'ok'", "ok"),
6926        // `Number.prototype.toString(radix)` が `radix` 引数を完全に無視し常に10進表示
6927        // だった(`n.toString(16)` 等の定番イディオムが動かなかった)。
6928        ("(255).toString(16)", "ff"),
6929        ("(8).toString(2)", "1000"),
6930        ("(255).toString()", "255"),
6931        ("(-255).toString(16)", "-ff"),
6932        ("(0).toString(2)", "0"),
6933        (
6934            "try { (1).toString(1); 'no-throw' } catch(e) { 'threw' }",
6935            "threw",
6936        ),
6937        // `parseInt` が `radix` 未指定時に `0x` 接頭辞を自動検出せず、明示的に
6938        // `radix=16` を渡しても `0x` を読み飛ばさないバグだった。
6939        ("parseInt('0xFF')", "255"),
6940        ("parseInt('0xFF', 16)", "255"),
6941        ("parseInt('FF', 16)", "255"),
6942        ("parseInt('10')", "10"),
6943        ("parseInt('-0x10')", "-16"),
6944        ("parseInt('10', 2)", "2"),
6945        // `Number.parseFloat`/`Number.parseInt`(ES2015)は仕様上グローバル
6946        // `parseFloat`/`parseInt` と同一の関数オブジェクトでなければならないが、
6947        // 以前は別々に構築されており `===` が `false` になっていた。
6948        ("Number.parseFloat === parseFloat", "true"),
6949        ("Number.parseInt === parseInt", "true"),
6950        ("Number.parseFloat.name", "parseFloat"),
6951        ("Number.parseInt.name", "parseInt"),
6952        // `JSON.stringify` は `Date` の `toJSON`(ISO 文字列)相当を特殊扱いする。
6953        // 以前は Date インスタンスが(`toJSON` を汎用的にチェックしないため)
6954        // プロパティなしの `{}` として直列化されてしまっていた。
6955        (
6956            "JSON.stringify(new Date(0))",
6957            "\"1970-01-01T00:00:00.000Z\"",
6958        ),
6959        (
6960            "JSON.stringify({d: new Date(0)})",
6961            "{\"d\":\"1970-01-01T00:00:00.000Z\"}",
6962        ),
6963        // 文字列化(テンプレートリテラル補間・暗黙の文字列連結)でも `[object Object]` ではなく
6964        // ISO 形式が出るようにした(`Value::to_js_string()` に `ObjKind::DateObj` 分岐を追加)。
6965        ("'' + new Date(0)", "1970-01-01T00:00:00.000Z"),
6966        ("`date=${new Date(0)}`", "date=1970-01-01T00:00:00.000Z"),
6967        // Object.defineProperty / Property attributes (writable, configurable, enumerable)
6968        (
6969            "var o={}; Object.defineProperty(o, 'x', {value: 1, writable: false, configurable: false, enumerable: false}); o.x = 2; o.x",
6970            "1",
6971        ),
6972        (
6973            "var o={}; Object.defineProperty(o, 'x', {value: 1, writable: false, configurable: false, enumerable: false}); delete o.x",
6974            "false",
6975        ),
6976        (
6977            "var o={}; Object.defineProperty(o, 'x', {value: 1, writable: false, configurable: false, enumerable: false}); Object.keys(o).length",
6978            "0",
6979        ),
6980        (
6981            "var o={}; Object.defineProperty(o, 'x', {value: 1, writable: false, configurable: false, enumerable: false}); var keys=[]; for(var k in o){ keys.push(k); } keys.length",
6982            "0",
6983        ),
6984        (
6985            "var o={}; Object.defineProperty(o, 'x', {value: 1, writable: false, configurable: false, enumerable: false}); JSON.stringify(o)",
6986            "{}",
6987        ),
6988        (
6989            "var o={}; Object.defineProperty(o, 'x', {value: 1, writable: false, configurable: false, enumerable: false}); ({...o}).x",
6990            "undefined",
6991        ),
6992        (
6993            "var o={}; Object.defineProperty(o, 'x', {value: 1, writable: false, configurable: false, enumerable: false}); Object.assign({}, o).x",
6994            "undefined",
6995        ),
6996        (
6997            "var o={}; Object.defineProperty(o, 'x', {value: 1, writable: false, configurable: false, enumerable: false}); Reflect.deleteProperty(o, 'x')",
6998            "false",
6999        ),
7000        // `DataView.prototype.getBigInt64`/`.getBigUint64`/`.setBigInt64`/
7001        // `.setBigUint64`(ES2020)が丸ごと未対応だった。64bit整数はNumberの
7002        // 安全整数範囲(2^53)を超えうるためBigIntで往復する必要がある。
7003        // 2026-07-18 発見・実装)。
7004        (
7005            "var b=new ArrayBuffer(8); var v=new DataView(b); v.setBigInt64(0, 123456789012345n); v.getBigInt64(0).toString()",
7006            "123456789012345",
7007        ),
7008        (
7009            "var b=new ArrayBuffer(8); var v=new DataView(b); v.setBigInt64(0, -1n); v.getBigInt64(0).toString()",
7010            "-1",
7011        ),
7012        (
7013            "var b=new ArrayBuffer(8); var v=new DataView(b); v.setBigUint64(0, -1n); v.getBigUint64(0).toString()",
7014            "18446744073709551615",
7015        ),
7016        (
7017            "var b=new ArrayBuffer(8); var v=new DataView(b); v.setBigInt64(0, 1n, true); v.getBigInt64(0, true).toString()",
7018            "1",
7019        ),
7020        // `JSON.rawJSON`/`JSON.isRawJSON`(ES2025)が丸ごと未対応だった。
7021        // Numberの精度で表現できない巨大な整数をJSON文字列へ精度損失無しで
7022        // 埋め込むための機能。2026-07-18 発見・実装)。
7023        (
7024            "JSON.stringify({n: JSON.rawJSON('123456789012345678901234567890')})",
7025            "{\"n\":123456789012345678901234567890}",
7026        ),
7027        ("JSON.isRawJSON(JSON.rawJSON('42'))", "true"),
7028        ("JSON.isRawJSON({rawJSON: '42'})", "false"),
7029        ("JSON.isRawJSON(42)", "false"),
7030        (
7031            "(function(){ try { JSON.rawJSON(' 1'); return 'no-throw'; } catch(e) { return e instanceof Error; } })()",
7032            "true",
7033        ),
7034        (
7035            "(function(){ try { JSON.rawJSON('not json'); return 'no-throw'; } catch(e) { return e instanceof Error; } })()",
7036            "true",
7037        ),
7038        // `button.command`/`.commandForElement`(Invoker Commands API)が
7039        // 丸ごと未対応だった。`popoverTargetAction`/`.popoverTargetElement`と
7040        // 全く同じ反映・idref解決パターンで実装(クリック時の実際の
7041        // `CommandEvent`発火/組込み動作は本サイクルでは未対応。
7042        // 2026-07-18 発見・実装)。
7043        (
7044            "var b=document.createElement('button'); b.command='show-modal'; b.command",
7045            "show-modal",
7046        ),
7047        (
7048            "document.createElement('button').commandForElement",
7049            "null",
7050        ),
7051        // `commandForElement`セッターの往復(`b.commandForElement = 要素`→
7052        // `commandfor`属性へidを反映)。この方向はDOMツリーへの接続を
7053        // 要さない(`popoverTargetElement`と同じ、対象要素のidを直接
7054        // 読むだけの実装)ため、`document.getElementById`のアタッチ要件
7055        // (共有テストフィクスチャ`wrap`が本テストスイート内の別テストで
7056        // 未接続化され得る既知の不安定要素)に依存しない自己完結した形に
7057        // している。逆方向(属性→要素解決)は`popoverTargetElement`と
7058        // 全く同じ`get_element_by_id`経路を再利用しているため別途検証済み。
7059        (
7060            "var t=document.createElement('div'); t.setAttribute('id','cfe-target'); var b=document.createElement('button'); b.commandForElement=t; b.getAttribute('commandfor')",
7061            "cfe-target",
7062        ),
7063        // プレーンオブジェクトのプロパティ列挙順序(ECMA-262
7064        // `OrdinaryOwnPropertyKeys`)が丸ごと未対応だった(`Obj.props`が
7065        // `BTreeMap`のため常に文字列の辞書式順序になっていた、
7066        // architecture-level の既知ギャップ)。`BTreeMap`→`IndexMap`移行
7067        // (挿入順保持。2026-07-18完了)に続けて、`Object.keys`/`.values`/
7068        // `.entries`へ「正整数キー→数値昇順」「残り→挿入順」の2段階
7069        // 並べ替え(`spec_key_order`)を配線し、仕様どおりの列挙順序を
7070        // 完成させた。2026-07-21 に `for...in`/`JSON.stringify`/スプレッド構文/
7071        // `Object.assign` 等すべての列挙箇所への同ロジック横展開を完了。
7072        (
7073            "Object.keys({y:1,x:2,a:3}).join(',')",
7074            "y,x,a",
7075        ),
7076        (
7077            "var o={}; delete o.x; o.b=1; o.a=2; o.c=3; delete o.a; o.a=4; Object.keys(o).join(',')",
7078            "b,c,a",
7079        ),
7080        (
7081            "Object.keys({2:'b',1:'a',10:'c'}).join(',')",
7082            "1,2,10",
7083        ),
7084        (
7085            "Object.keys({10:'c',y:1,2:'b',x:2}).join(',')",
7086            "2,10,y,x",
7087        ),
7088        (
7089            "Object.values({10:'c',y:1,2:'b',x:2}).join(',')",
7090            "b,c,1,2",
7091        ),
7092        (
7093            "var res=[]; for(var k in {10:'c',y:1,2:'b',x:2}){ res.push(k); } res.join(',')",
7094            "2,10,y,x",
7095        ),
7096        (
7097            "JSON.stringify({10:'c',y:1,2:'b',x:2})",
7098            "{\"2\":\"b\",\"10\":\"c\",\"y\":1,\"x\":2}",
7099        ),
7100        (
7101            "Object.keys({...{10:'c',y:1,2:'b',x:2}}).join(',')",
7102            "2,10,y,x",
7103        ),
7104        (
7105            "Object.keys(Object.assign({}, {10:'c',y:1,2:'b',x:2})).join(',')",
7106            "2,10,y,x",
7107        ),
7108        (
7109            "Object.entries({2:'b',y:1,1:'a'}).map(e=>e.join(':')).join(',')",
7110            "1:a,2:b,y:1",
7111        ),
7112        // `01`(先頭ゼロ)は仕様上「配列インデックス」ではなく通常の文字列
7113        // キー扱いのため数値昇順の対象外(挿入順のまま)。
7114        (
7115            "Object.keys({'01':'x', 1:'y'}).join(',')",
7116            "1,01",
7117        ),
7118        // ECMAScript Internationalization API (Intl)
7119        (
7120            "typeof Intl",
7121            "object",
7122        ),
7123        (
7124            "Intl.getCanonicalLocales('ja-JP').join(',')",
7125            "ja-JP",
7126        ),
7127        // `ja-JP`も`en-US`と同じ3桁カンマ区切り書式を使う言語のため`"123,456"`が
7128        // 正しい期待値(この処理系はロケール別の書式データベースを持たず全て
7129        // 同じ簡略書式を使うため、ロケール文字列自体は解析結果に影響しない)。
7130        // 元は書式化ロジック実装前の無加工出力`"123456"`をそのまま期待値に
7131        // していた誤り(2026-07-18 発見・修正)。
7132        (
7133            "new Intl.NumberFormat('ja-JP').format(123456)",
7134            "123,456",
7135        ),
7136        (
7137            "new Intl.DateTimeFormat('ja-JP').resolvedOptions().locale",
7138            "ja-JP",
7139        ),
7140        (
7141            "new Intl.Collator().compare('a', 'b')",
7142            "-1",
7143        ),
7144        (
7145            "new Intl.PluralRules().select(1)",
7146            "one",
7147        ),
7148        (
7149            "new Intl.RelativeTimeFormat().format(-1, 'day')",
7150            "1 days ago",
7151        ),
7152        (
7153            "new Intl.ListFormat().format(['a', 'b'])",
7154            "a, b",
7155        ),
7156        (
7157            "new Intl.DisplayNames(['en'], {type: 'language'}).of('ja')",
7158            "ja",
7159        ),
7160        // RegExp u/v flags & Unicode property escapes
7161        (
7162            "new RegExp('a', 'u').unicode",
7163            "true",
7164        ),
7165        (
7166            "new RegExp('a', 'v').unicodeSets",
7167            "true",
7168        ),
7169        (
7170            "/\\p{Letter}/u.test('A')",
7171            "true",
7172        ),
7173        (
7174            "/\\p{Number}/u.test('9')",
7175            "true",
7176        ),
7177        // Generator.prototype.return(v) & try...finally
7178        (
7179            "var finRan = false; function* g() { try { yield 1; } finally { finRan = true; } } var it = g(); it.next(); it.return(42); finRan",
7180            "true",
7181        ),
7182        // `Object.create(null)`/`Object.groupBy()`/`Object.setPrototypeOf(obj,null)`が
7183        // 実際には`Object.prototype`のメソッド(`hasOwnProperty`/`toString`等)を
7184        // 引き続き持ってしまうバグ(`proto: None`だけでは「明示的にnull
7185        // プロトタイプ」なのか「単に通常オブジェクトでチェーンが尽きた」のか
7186        // 区別できず、`get_property`の共通メソッドフォールバックが無条件に
7187        // 適用されていた)。`null_proto`フラグを新設して修正(2026-07-18
7188        // 発見・実装)。
7189        (
7190            "typeof Object.create(null).hasOwnProperty",
7191            "undefined",
7192        ),
7193        (
7194            "typeof Object.create(null).toString",
7195            "undefined",
7196        ),
7197        (
7198            "Object.getPrototypeOf(Object.create(null))",
7199            "null",
7200        ),
7201        // 通常のオブジェクトリテラルは引き続き`Object.prototype`のメソッドを
7202        // 継承する(`null_proto`の導入で既存の通常オブジェクトの挙動を
7203        // 壊していないことの回帰確認)。
7204        (
7205            "typeof {}.hasOwnProperty",
7206            "function",
7207        ),
7208        (
7209            "typeof Object.groupBy([1,2,3], x=>x%2).hasOwnProperty",
7210            "undefined",
7211        ),
7212        (
7213            "var o={}; Object.setPrototypeOf(o, null); typeof o.toString",
7214            "undefined",
7215        ),
7216        // `setPrototypeOf`で実オブジェクトへ戻せば`null_proto`が解除され、
7217        // 継承したメソッドが再び見えることの確認。
7218        (
7219            "var o={}; Object.setPrototypeOf(o, null); Object.setPrototypeOf(o, Object.prototype); typeof o.hasOwnProperty",
7220            "function",
7221        ),
7222        // `crypto.subtle.digest('SHA-256', data)`が丸ごと未対応だった
7223        // (`Float16Array`/`oklch()`と同格の「1ビットの誤りが静かに間違った
7224        // 結果を生み続けるリスク」と判断し従来は着手見送りだったが、SHA-256は
7225        // NIST/RFC公開の既知の正解値で完全一致検証できる純粋なビット演算
7226        // アルゴリズムのため浮動小数点近似とは性質が異なり、リスク評価を
7227        // 見直し実装した。以下はFIPS 180-4/一般に広く知られる既知の正解値
7228        // (Known Answer Test)。2026-07-18 発見・実装)。
7229        (
7230            "await crypto.subtle.digest('SHA-256', new TextEncoder().encode('')).then(buf => Array.from(new Uint8Array(buf)).map(b=>b.toString(16).padStart(2,'0')).join(''))",
7231            "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
7232        ),
7233        (
7234            "await crypto.subtle.digest('SHA-256', new TextEncoder().encode('abc')).then(buf => Array.from(new Uint8Array(buf)).map(b=>b.toString(16).padStart(2,'0')).join(''))",
7235            "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad",
7236        ),
7237        (
7238            "await crypto.subtle.digest('SHA-256', new TextEncoder().encode('The quick brown fox jumps over the lazy dog')).then(buf => Array.from(new Uint8Array(buf)).map(b=>b.toString(16).padStart(2,'0')).join(''))",
7239            "d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592",
7240        ),
7241        // `algorithm`引数を`{name: "SHA-256"}`形式(実ブラウザでも有効な
7242        // もう一方の呼び出し形式)で渡しても同じ結果になることの確認。
7243        (
7244            "await crypto.subtle.digest({name: 'SHA-256'}, new TextEncoder().encode('abc')).then(buf => Array.from(new Uint8Array(buf)).map(b=>b.toString(16).padStart(2,'0')).join(''))",
7245            "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad",
7246        ),
7247        // 未対応アルゴリズム名は仕様どおりPromiseのreject(例外)で通知される。
7248        (
7249            "await crypto.subtle.digest('SHA-1', new TextEncoder().encode('x')).then(() => 'resolved', () => 'rejected')",
7250            "rejected",
7251        ),
7252        // `TextDecoder.decode(arrayBuffer)`(TypedArrayビューではなく生の
7253        // `ArrayBuffer`を直接渡す、仕様上有効な呼び出し形式)が常に空文字列を
7254        // 返すバグだった(`crypto.subtle.digest`実装の検証中に発見した
7255        // `new Uint8Array(arrayBuffer)`のゼロ埋めバグと同系統の「生の
7256        // ArrayBufferから実データを読む経路」の欠落)。2026-07-18 発見・実装。
7257        (
7258            "new TextDecoder().decode(new TextEncoder().encode('hello').buffer)",
7259            "hello",
7260        ),
7261        (
7262            "new TextDecoder().decode(new Uint8Array([65,116,109,79,83]).buffer)",
7263            "AtmOS",
7264        ),
7265        // `DataView` を `TextDecoder.decode` や `crypto.subtle.digest` や
7266        // `new Uint8Array(dataView)` に渡した際、`_dv_bytes` が参照されず
7267        // 全ゼロ埋めになるバグを修正(2026-07-21 発見・実装)。
7268        (
7269            "new TextDecoder().decode(new DataView(new TextEncoder().encode('AtmOS').buffer))",
7270            "AtmOS",
7271        ),
7272        (
7273            "await crypto.subtle.digest('SHA-256', new DataView(new TextEncoder().encode('abc').buffer)).then(buf => Array.from(new Uint8Array(buf)).map(b=>b.toString(16).padStart(2,'0')).join(''))",
7274            "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad",
7275        ),
7276        (
7277            "new Uint8Array(new DataView(new Uint8Array([65,66,67]).buffer)).join('')",
7278            "656667",
7279        ),
7280        // `String.prototype.normalize()` 日本語ひらがな・カタカナの濁点・半濁点の分解(NFD)・合成(NFC)
7281        (
7282            "'が'.normalize('NFD') === 'か\\u3099'",
7283            "true",
7284        ),
7285        (
7286            "'か\\u3099'.normalize('NFC')",
7287            "が",
7288        ),
7289        (
7290            "'パ'.normalize('NFD') === 'ハ\\u309A'",
7291            "true",
7292        ),
7293        (
7294            "'ハ\\u309A'.normalize('NFC')",
7295            "パ",
7296        ),
7297        // `structuredClone` 極端な深いネストの保護(DataCloneError 例外の返却)。
7298        // 元は閾値1000・ネスト1100段でテストしていたが、これ自体が
7299        // ブート時点の64KB初期コアスタックを枯渇させ、QEMU起動が丸ごと
7300        // 無応答になる重大な回帰を引き起こしていた(実測で深さ80段でも
7301        // 無応答、50段は安全と確認)。`deep_clone_value`の閾値を30へ
7302        // 引き下げ、ネスト段数も安全に確認できた範囲内の40へ縮小する
7303        // (2026-07-18 発見・修正)。
7304        (
7305            "var a = []; var cur = a; for (var i = 0; i < 40; i++) { var n = []; cur.push(n); cur = n; } try { structuredClone(a); 'ok'; } catch (e) { e.name; }",
7306            "DataCloneError",
7307        ),
7308        // `structuredClone` フラットな大配列(要素数>30のオブジェクト配列)が
7309        // 累積オブジェクト数(seen.len())ではなく再帰深さ(depth)で判定され
7310        // 正しく複製されることの検証(seen.len() ガード時代の過剰エラーバグ防止)。
7311        (
7312            "var a = []; for (var i = 0; i < 50; i++) { a.push({v: i}); } var c = structuredClone(a); c.length === 50 && c[49].v === 49",
7313            "true",
7314        ),
7315        // `JSON.parse`(`os_lib::json::parse`のRust側相互再帰パーサ)にも
7316        // `structuredClone`と同種のRustネイティブ再帰スタックオーバーフロー
7317        // リスクがあったため、同じ閾値30の深さガードを新設(2026-07-21)。
7318        // 20階層のネストは閾値内で安全にパースできる。
7319        (
7320            "(function(){ var s = '['.repeat(20) + '0' + ']'.repeat(20); try { JSON.parse(s); return 'ok'; } catch (e) { return 'error'; } })()",
7321            "ok",
7322        ),
7323        // GlobalEventHandlers (onchange / onclick 等) の属性・プロパティ統合テスト
7324        (
7325            "var d=document.createElement('div'); var r='none'; d.onchange=function(){r='ok';}; d.dispatchEvent(new Event('change')); r",
7326            "ok",
7327        ),
7328        // outerHTML セッターのテスト
7329        (
7330            "var p=document.createElement('div'); p.innerHTML='<span id=x>old</span>'; var s=p.children[0]; s.outerHTML='<b id=y>new</b>'; p.children[0].tagName+','+p.children[0].id",
7331            "B,y",
7332        ),
7333        // SharedWorker (WHATWG HTML § 10.1.2) のグローバル・コンストラクタ・MessagePort 統合テスト
7334        (
7335            "typeof SharedWorker === 'function' && typeof window.SharedWorker === 'function'",
7336            "true",
7337        ),
7338        (
7339            "var sw = new SharedWorker('test.js', 'test_worker'); typeof sw.port === 'object' && typeof sw.port.postMessage === 'function' && typeof sw.port.start === 'function' && typeof sw.port.close === 'function'",
7340            "true",
7341        ),
7342        // 【2026-11-02】バイトコード(`interp/bytecode.rs`)。何度も呼ばれて変換された本体が
7343        // 構文木の評価と同じ結果になること。
7344        ("function f(){ { function g(){return 1} } return g(); } for(var k=0;k<20;k++) f(); f()", "1"),
7345        ("function f(){ for(var i=0;i<3;i++){ if(i==1){ function g(){return i} return g(); } } } for(var k=0;k<20;k++) f(); f()", "1"),
7346        ("function f(){ var h; h = function(){}; return h.name; } for(var k=0;k<20;k++) f(); f()", "h"),
7347        ("function f(){ var n=0; for(var i=0;i<5;i++){ try { if(i==2) break; n++; } finally { n+=10; } } return n; } for(var k=0;k<20;k++) f(); f()", "32"),
7348        ("function f(){ var n=0; for(var i=0;i<3;i++){ try { continue; } finally { n++; } } return n; } for(var k=0;k<20;k++) f(); f()", "3"),
7349        ("function f(){ outer: for(var i=0;i<3;i++){ for(var j=0;j<3;j++){ if(j==1) continue outer; if(i==2) break outer; } } return i+','+j; } for(var k=0;k<20;k++) f(); f()", "2,0"),
7350        ("function f(){ var a=[]; for(let i=0;i<3;i++){ a.push(function(){return i}); } return a[2](); } for(var k=0;k<20;k++) f(); f()", "2"),
7351        ("function f(){ var i=0; do { i++; if(i==2) continue; if(i==4) break; } while(i<9); return i; } for(var k=0;k<20;k++) f(); f()", "4"),
7352        ("function f(a){ return (a&&a.b||'d') + (a??'x'); } for(var k=0;k<20;k++) f(); f()", "dx"),
7353        ("function f(){ try { return zzNeverDefinedBc; } catch(e) { return e.message; } } for(var k=0;k<20;k++) f(); f()", "zzNeverDefinedBc is not defined"),
7354        ("function f(x){ if(x===undefined) x=5; return 1 + (x ? f(x-1) : 0); } for(var k=0;k<20;k++) f(); f()", "6"),
7355        // 【2026-11-02】内部で投げる例外の種類。
7356        ("try { zzNoSuchVarErr; } catch(e) { e.name + ',' + (e instanceof ReferenceError) + ',' + e.message; }", "ReferenceError,true,zzNoSuchVarErr is not defined"),
7357        ("try { null.x; } catch(e) { e.name + ',' + (e instanceof TypeError); }", "TypeError,true"),
7358        ("var e=new ReferenceError('m'); e.name + ',' + e.message + ',' + (e instanceof Error)", "ReferenceError,m,true"),
7359        ("new EvalError('a').name + ',' + new URIError('b').name", "EvalError,URIError"),
7360        ("try { undefined.x; } catch(e) { e instanceof Error; }", "true"),
7361        ("try { 1n / 0n; } catch(e) { e.name; }", "RangeError"),
7362        ("try { 1 instanceof 2; } catch(e) { e.name; }", "TypeError"),
7363        // 【2026-11-02】DOM ノードの JS のオブジェクトはノードごとに 1 個。
7364        ("var p=document.createElement('div'); var d=document.createElement('div'); p.appendChild(d); d.id='wq1'; var m=new WeakMap(); m.set(p.querySelector('#wq1'), 5); m.get(d)", "5"),
7365        ("var p=document.createElement('div'); var d=document.createElement('div'); p.appendChild(d); var s=new Set([d, p.lastChild, p.firstChild]); s.size", "1"),
7366        ("var h=document.createElement('div'); var r=h.attachShadow({mode:'open'}); (h.shadowRoot===r)+','+r.mode", "true,open"),
7367        // 【2026-11-02】型付き配列の検索。
7368        ("var u=new Uint8Array([1,2,3,2]); u.indexOf(2)+','+u.indexOf(2,2)+','+u.indexOf(9)+','+u.indexOf(300)+','+u.indexOf('2')", "1,3,-1,-1,-1"),
7369        ("var u=new Int8Array([1,-1]); u.indexOf(-1)+','+u.indexOf(255)+','+u.includes(-1)", "1,-1,true"),
7370        ("var u=new Uint8Array(new ArrayBuffer(4),2,2); u[1]=7; u.indexOf(7)+','+u.indexOf(0,1)", "1,-1"),
7371        ("var u=new Uint16Array([1,300]); u.indexOf(300)+','+u.includes(2)", "1,false"),
7372        ("var u=new Float32Array([1.5,NaN]); u.indexOf(1.5)+','+u.indexOf(NaN)+','+u.includes(NaN)", "0,-1,true"),
7373        ("Array.prototype.indexOf.call(new Uint8Array([5,6]),6)+','+Array.prototype.join.call(new Uint8Array([5,6]),'-')", "1,5-6"),
7374        // 【2026-11-02】文字列の添字と長さは UTF-16 の単位。
7375        ("'😀'.length", "2"),
7376        ("'a😀b'.length", "4"),
7377        ("'😀'.charCodeAt(0) + ',' + '😀'.charCodeAt(1)", "55357,56832"),
7378        ("'😀'.codePointAt(0) + ',' + 'a😀'.codePointAt(1)", "128512,128512"),
7379        ("'a😀b'.charAt(3) + 'a😀b'[3] + 'a😀b'.at(-1)", "bbb"),
7380        ("'a😀b'.slice(1,3) + ',' + 'a😀b'.substring(3) + ',' + 'a😀b'.substr(1,2)", "😀,b,😀"),
7381        ("'a😀b'.indexOf('b') + ',' + 'a😀b😀'.lastIndexOf('😀') + ',' + 'a😀b'.indexOf('b', 3)", "3,4,3"),
7382        ("'😀b'.search(/b/) + ',' + /b/.exec('😀b').index", "2,2"),
7383        ("'日本語'.length + 'é'.length + '日本語'.slice(1) + '日本語'.charCodeAt(1)", "4本語26412"),
7384        ("'😀'.padStart(3,'x')", "x😀"),
7385        // `delete` は代入だけで作ったグローバル変数を消す。宣言された変数は消えない。
7386        ("gxDel=1; var r=delete gxDel; r + ',' + typeof gxDel", "true,undefined"),
7387        ("var vDel=1; (delete vDel) + ',' + vDel", "false,1"),
7388        ("function f(){ var a=1; return (delete a) + ',' + a; } f()", "false,1"),
7389        ("window.wDel=1; (delete wDel) + ',' + typeof wDel", "true,undefined"),
7390        ("gxBc=1; function f(){ return gxBc; } for(var k=0;k<20;k++) f(); delete gxBc; var r; try { r=f(); } catch(e) { r=e.name; } r", "ReferenceError"),
7391        // 変数の場所の覚えは、同じ本体でも閉包ごとの束縛を読み書きする。
7392        ("function mk(v){ return function(){ return v++; }; } var a=mk(1), b=mk(10); for(var k=0;k<20;k++) a(); a()+','+b()", "21,10"),
7393        ("function f(n){ function g(){ return n; } return n>0 ? f(n-1)+g() : g(); } for(var k=0;k<20;k++) f(2); f(3)", "6"),
7394        ("function f(x){ { let x=2; } var y=x; { const y=3; } return x+y; } for(var k=0;k<20;k++) f(1); f(1)", "2"),
7395        // 【2026-11-03】プロトタイプ連鎖の PropSlot キャッシュと StoreMember / StoreIndex バイトコード。
7396        ("class Base { inc(d) { this.v = this.v + d; return this.v; } } class Sub extends Base { constructor(v) { super(); this.v = v; this.arr = [0, 0]; } step(i, d) { this.arr[i] = this.inc(d); return this.arr[i]; } } var s = new Sub(10); for (var k = 0; k < 25; k++) s.step(k & 1, 2); s.v + ',' + s.arr[0] + ',' + s.arr[1]", "60,60,58"),
7397        // ---- 2026-11-17: Chrome(V8)との差分試験の続き(構文エラー・正規表現・日付・文字列の元・Map/Set の forEach など)----
7398        // 期待値は Node v22(V8、TZ=UTC)で確かめた値。
7399        (r#"var r=[];for(var s of ['-2 ** 2','typeof 1 ** 2','--0','++"a"']){try{eval(s);r.push('ok')}catch(e){r.push(e.name)}}r.join()"#, r#"SyntaxError,SyntaxError,SyntaxError,SyntaxError"#),
7400        (r#"(-2) ** 2 + ',' + 2 ** -1 + ',' + (-2) ** 3"#, r#"4,0.5,-8"#),
7401        (r#"017 + ',' + 08 + ',' + 0o17"#, r#"15,8,15"#),
7402        (r#"var r;try{eval('var 1x')}catch(e){r=e.name}r"#, r#"SyntaxError"#),
7403        (r#"/\p{Script=Hiragana}+/u.exec('abあいう')[0] + ',' + 'abCD12'.match(/[\p{Lu}\d]+/u)[0] + ',' + /\p{L}/u.test('1')"#, r#"あいう,CD12,false"#),
7404        (r#"'a\u00a0\u3000\ufeffb'.split(/\s+/).length + ',' + /a.b/.test('a\u2028b') + ',' + /^b/m.test('a\rb')"#, r#"2,false,true"#),
7405        (r#"'abc'.replace(/(a)(b)?(z)?/, '[$1|$2|$3|$4]') + ',' + 'x'.replace(/(x)/,'$01$10$2')"#, r#"[a|b||$4]c,xx0$2"#),
7406        (r#"var r=/b/g;r.lastIndex=5;'abc'.replace(r,'x')+','+r.lastIndex+','+/a/gimsuyd.flags"#, r#"axc,0,dgimsuy"#),
7407        (r#"RegExp.prototype.toString.call({source:'s',flags:'f'})"#, r#"/s/f"#),
7408        (r#"[Math.hypot(), Math.hypot(NaN,Infinity), Math.hypot(1e200,1e200), Math.hypot(3,4), Math.SQRT1_2].join()"#, r#"0,Infinity,1.414213562373095e+200,5,0.7071067811865476"#),
7409        (r#"(123n).toString(16) + ',' + (-255n).toString(2) + ',' + (10n).toString()"#, r#"7b,-11111111,10"#),
7410        (r#"var o={__proto__:null}; [o.toString, Object.getPrototypeOf(o)].join()"#, r#","#),
7411        (r#"var s=new Set([1,2,3]);var r=[];s.forEach(v=>{r.push(v);if(v==1)s.add(9)});var m=new Map([[1,1],[2,2],[3,3]]);m.forEach((v,k)=>{r.push(k);if(k==1){m.delete(2);m.set(4,4)}});r.join()"#, r#"1,2,3,9,1,3,4"#),
7412        (r#"var o={toString(){return 'T'}};[o]+'' + ',' + [1,[o,2]].join('-') + ',' + [o,o].join()"#, r#"T,1-T,2,T,T"#),
7413        (r#"JSON.stringify([Object.assign({a:1},null,'xy'), {...'ab', ...[9]}, Object.entries('ab'), Object.values('ab')])"#, r#"[{"0":"x","1":"y","a":1},{"0":9,"1":"b"},[["0","a"],["1","b"]],["a","b"]]"#),
7414        (r#"[Date.UTC(99,0), Date.UTC(), Date.UTC(275760,8,13,0,0,0,1), Date.UTC(2020, NaN)].join()"#, r#"915148800000,NaN,NaN,NaN"#),
7415        (r#"[new Date(1.9).getTime(), new Date(8.64e15+1).getTime(), String(new Date(NaN)), new Date(Date.UTC(-1,0)).toISOString(), new Date(Date.UTC(10000,0)).toISOString()].join()"#, r#"1,NaN,Invalid Date,-000001-01-01T00:00:00.000Z,+010000-01-01T00:00:00.000Z"#),
7416        (r#"['2000-01-01 00:00:00Z','Jan 1, 2000 00:00:00 UTC','1 January 2000 UTC','2020-01-01T25:00:00Z','20200101','Mon Jan 03 2000 10:00:00 GMT+0900 (JST)'].map(Date.parse).join()"#, r#"946684800000,946684800000,946684800000,NaN,NaN,946861200000"#),
7417        (r#"var d=new Date(0);[d==d.toString(), d==d.valueOf(), typeof (d+1)].join()"#, r#"true,false,string"#),
7418        (r#"JSON.stringify([undefined,function(){},Symbol()]) + JSON.stringify({f:Symbol('x'),g:1})"#, r#"[null,null,null]{"g":1}"#),
7419        (r#"var e=[Object.getPrototypeOf(TypeError)===Error, Object.getPrototypeOf(RangeError)===Error, new TypeError('m') instanceof Error]; var o={}; e.concat([Object(o)===o, new Object(o)===o, typeof Object(null)]).join()"#, r#"true,true,true,true,true,object"#),
7420        (r#"var s=['banana','Apple','cherry','apple','Banana'].sort((a,b)=>a.localeCompare(b)); s.join()+'|'+'Hello'.localeCompare('b')+','+'é'.localeCompare('f')+','+new Intl.Collator().compare('a','B')"#, r#"apple,Apple,banana,Banana,cherry|1,-1,-1"#),
7421    ];
7422    let mut passed = 0;
7423    let mut total = cases.len();
7424    for (src, expect) in cases {
7425        let mut rt = JsRuntime::new();
7426        match rt.eval(src) {
7427            Ok(v) if &v.to_js_string() == expect => passed += 1,
7428            Ok(v) => crate::println!(
7429                "JS_SELFTEST FAIL: `{}` => `{}` (want `{}`)",
7430                src,
7431                v.to_js_string(),
7432                expect
7433            ),
7434            Err(e) => crate::println!("JS_SELFTEST ERR:  `{}` => {}", src, e),
7435        }
7436    }
7437
7438    // 【2026-10-20】文書の読み込み状態: loading の間に登録したリスナは段階に達したときに呼ばれる。
7439    {
7440        total += 1;
7441        let mut rt = JsRuntime::new();
7442        rt.set_document_ready_state("loading");
7443        let _ = rt.eval(
7444            "var log = [document.readyState]; document.addEventListener('readystatechange', function(){ log.push('rsc:' + document.readyState); }); \
7445             document.addEventListener('DOMContentLoaded', function(){ log.push('dcl'); }); window.addEventListener('load', function(){ log.push('load'); });",
7446        );
7447        rt.set_document_ready_state("interactive");
7448        rt.set_document_ready_state("complete");
7449        match rt.eval("window.addEventListener('load', function(){ log.push('late'); }); log.join(',')") {
7450            Ok(v) if v.to_js_string() == "loading,rsc:interactive,dcl,rsc:complete,load,late" => passed += 1,
7451            Ok(v) => crate::println!("JS_SELFTEST FAIL: `readyState lifecycle` => `{}`", v.to_js_string()),
7452            Err(e) => crate::println!("JS_SELFTEST ERR:  `readyState lifecycle` => {}", e),
7453        }
7454    }
7455
7456    // 【2026-10-19】循環ゴミの回収: 外から届く値は残し、届かない循環だけを解放する。
7457    {
7458        total += 1;
7459        let mut rt = JsRuntime::new();
7460        let _ = rt.eval(
7461            "var keep = (function(){ var o = {v: 42}; o.self = o; return function(){ return o.v + (o.self === o ? 0 : 1000); }; })(); \
7462             var arr = []; arr.push(arr); var m = new Map(); m.set('k', m); \
7463             for (var i = 0; i < 2000; i++) { (function(){ var a = {}; a.me = a; function g(){ return a; } a.g = g; })(); }",
7464        );
7465        // 途中で自動の回収が走っても結果が同じになるよう、回収後に生き残った数で判定する
7466        // (回収しなければ 2000 回分の a・g・スコープ=6000 個以上が残る)。
7467        let st = crate::os_lib::ecma::cycle_gc::collect(true);
7468        let live_objs = st.objs - st.garbage_objs;
7469        let live_scopes = st.scopes - st.garbage_scopes;
7470        let ok_garbage = live_objs < 2000 && live_scopes < 100;
7471        let ok_kinds = st.count_plain > 0 && st.count_func > 0 && st.count_array > 0;
7472        match rt.eval("keep() + ',' + (arr[0] === arr) + ',' + (m.get('k') === m) + ',' + (function(){ var q = {}; q.q = q; return typeof q.q; })()") {
7473            Ok(v) if v.to_js_string() == "42,true,true,object" && ok_garbage && ok_kinds => passed += 1,
7474            Ok(v) => crate::println!(
7475                "JS_SELFTEST FAIL: `cycle_gc` => `{}` {:?} (want 42,true,true,object and live < 2000 objs / < 100 scopes)",
7476                v.to_js_string(),
7477                st
7478            ),
7479            Err(e) => crate::println!("JS_SELFTEST ERR:  `cycle_gc` => {}", e),
7480        }
7481        // 2 回目はほとんど取らず、値も壊れない。
7482        total += 1;
7483        let st2 = crate::os_lib::ecma::cycle_gc::collect(true);
7484        match rt.eval("keep() + ',' + arr.length") {
7485            // 直前の確認の式(q.q = q)が作った少しのゴミだけ。
7486            Ok(v) if v.to_js_string() == "42,1" && st2.garbage_objs < 10 => passed += 1,
7487            Ok(v) => crate::println!("JS_SELFTEST FAIL: `cycle_gc 2nd` => `{}` {:?}", v.to_js_string(), st2),
7488            Err(e) => crate::println!("JS_SELFTEST ERR:  `cycle_gc 2nd` => {}", e),
7489        }
7490    }
7491
7492    // 【2026-10-24】Promise の反応・generator のスコープを通る循環も回収し、生きている Promise は壊さない。
7493    {
7494        total += 1;
7495        let mut rt = JsRuntime::new();
7496        let _ = rt.eval(
7497            "var kr; var kp = new Promise(function(res){ kr = res; }); var got = 0; kp.then(function(v){ got = v; }); \
7498             function* kg(){ var x = yield 1; yield x * 2; } var kit = kg(); kit.next(); \
7499             for (var i = 0; i < 2000; i++) { \
7500               (function(){ var r; var p = new Promise(function(res){ r = res; }); p.then(function(){ return r; }); })(); \
7501               (function(){ var it; function* g(){ yield it; } it = g(); })(); \
7502             }",
7503        );
7504        let st = crate::os_lib::ecma::cycle_gc::collect(true);
7505        let live_objs = st.objs - st.garbage_objs;
7506        let live_scopes = st.scopes - st.garbage_scopes;
7507        let ok_garbage = live_objs < 2000 && live_scopes < 100;
7508        let _ = rt.eval("kr(7);");
7509        match rt.eval("got + ',' + kit.next(5).value") {
7510            Ok(v) if v.to_js_string() == "7,10" && ok_garbage => passed += 1,
7511            Ok(v) => crate::println!(
7512                "JS_SELFTEST FAIL: `cycle_gc promise/gen` => `{}` {:?} (want 7,10 and live < 2000 objs / < 100 scopes)",
7513                v.to_js_string(),
7514                st
7515            ),
7516            Err(e) => crate::println!("JS_SELFTEST ERR:  `cycle_gc promise/gen` => {}", e),
7517        }
7518    }
7519
7520    // MutationObserver コールバックの2段階評価テスト(コールバック第2引数として observer 自身を受け取る)
7521    {
7522        total += 1;
7523        let mut rt = JsRuntime::new();
7524        let _ = rt.eval(
7525            "var moEl=document.createElement('div'); var recObs=null; \
7526             var moInst=new MutationObserver(function(recs, obs){ recObs = obs; }); \
7527             moInst.observe(moEl,{attributes:true}); \
7528             moEl.setAttribute('a','1');",
7529        );
7530        match rt.eval("recObs === moInst") {
7531            Ok(v) if v.to_js_string() == "true" => passed += 1,
7532            Ok(v) => crate::println!(
7533                "JS_SELFTEST FAIL: `MutationObserver cb obs param` => `{}` (want true)",
7534                v.to_js_string()
7535            ),
7536            Err(e) => crate::println!("JS_SELFTEST ERR:  `MutationObserver cb obs param` => {}", e),
7537        }
7538    }
7539
7540    // setInterval / clearInterval の2段階評価テスト
7541    {
7542        total += 1;
7543        let mut rt = JsRuntime::new();
7544        let _ = rt.eval("var n=0; var id=setInterval(function(){n++;}, 10);");
7545        // 【2026-10-17】タイマーは実時間で発火する。試験は仮想時刻を早送りして流す。
7546        rt.fast_forward_timers(50);
7547        match rt.eval("n > 0") {
7548            Ok(v) if v.to_js_string() == "true" => passed += 1,
7549            Ok(v) => crate::println!(
7550                "JS_SELFTEST FAIL: `setInterval` => n > 0 is `{}` (want true)",
7551                v.to_js_string()
7552            ),
7553            Err(e) => crate::println!("JS_SELFTEST ERR:  `setInterval` => {}", e),
7554        }
7555    }
7556    {
7557        total += 1;
7558        let mut rt = JsRuntime::new();
7559        let _ = rt.eval("var n=0; var id=setInterval(function(){n++;}, 10); clearInterval(id);");
7560        match rt.eval("n") {
7561            Ok(v) if v.to_js_string() == "0" => passed += 1,
7562            Ok(v) => crate::println!(
7563                "JS_SELFTEST FAIL: `clearInterval` => n is `{}` (want 0)",
7564                v.to_js_string()
7565            ),
7566            Err(e) => crate::println!("JS_SELFTEST ERR:  `clearInterval` => {}", e),
7567        }
7568    }
7569    // `setInterval`の発火回数上限(以前は8回。実サイト www.sugi-lab.net の
7570    // 統計カウンターアニメーション`increment=target/100`が最終値の8%程度で
7571    // 頭打ちになり正しい数値へ到達できないバグだった。2026-07-22発見・修正で
7572    // 200回へ引き上げ)の回帰防止テスト。target=50, increment=0.5として、
7573    // 100回の発火で正確にtargetへ到達し`clearInterval`されることを検証する
7574    // (8回上限のままなら`n`は50に到達せず4のまま止まる)。
7575    {
7576        total += 1;
7577        let mut rt = JsRuntime::new();
7578        let _ = rt.eval(
7579            "var n=0; var target=50; var inc=target/100; \
7580             var id=setInterval(function(){ \
7581                 n+=inc; \
7582                 if (n>=target) { n=target; clearInterval(id); } \
7583             }, 1);",
7584        );
7585        rt.fast_forward_timers(1000);
7586        match rt.eval("n") {
7587            Ok(v) if v.to_js_string() == "50" => passed += 1,
7588            Ok(v) => crate::println!(
7589                "JS_SELFTEST FAIL: setInterval 統計カウンター模擬 => n is `{}` (want 50)",
7590                v.to_js_string()
7591            ),
7592            Err(e) => crate::println!("JS_SELFTEST ERR:  setInterval 統計カウンター模擬 => {}", e),
7593        }
7594    }
7595    // `AbortSignal.timeout(ms)`(ES2022)の2段階評価テスト(setTimeout 経由で
7596    // マクロタスクキューが解ける必要があるため setInterval と同じ2段階構成)。
7597    {
7598        total += 1;
7599        let mut rt = JsRuntime::new();
7600        let _ = rt.eval(
7601            "var fired=false; var s=AbortSignal.timeout(0); s.addEventListener('abort', function(){fired=true;});",
7602        );
7603        // `s.reason.name`(丸ごと未対応だった。以前は既定の `AbortError` の
7604        // ままで仕様上の `TimeoutError`ではなかったバグ。2026-07-16 発見・
7605        // 実装)も合わせて検証する。
7606        match rt.eval("fired + ',' + s.reason.name") {
7607            Ok(v) if v.to_js_string() == "true,TimeoutError" => passed += 1,
7608            Ok(v) => crate::println!(
7609                "JS_SELFTEST FAIL: `AbortSignal.timeout` => `{}` (want `true,TimeoutError`)",
7610                v.to_js_string()
7611            ),
7612            Err(e) => crate::println!("JS_SELFTEST ERR:  `AbortSignal.timeout` => {}", e),
7613        }
7614    }
7615
7616    // DOM 連携(Phase 3)。小さな DOM を構築してから評価する。
7617    let dom_html = "<div id='out'>0</div><p class='msg'>hi</p><button id='b' class='x'>go</button>";
7618    let dom_cases: &[(&str, &str)] = &[
7619        // 【2026-10-20】element.attributes の getNamedItem/item/名前参照(NamedNodeMap)
7620        ("var d = document.createElement('div'); d.setAttribute('foo', 'bar'); var a = d.attributes; a.getNamedItem('foo').value + ',' + a.getNamedItem('nope') + ',' + a.item(0).name + ',' + a.item(5) + ',' + a.foo.value", "bar,null,foo,null,bar"),
7621        // 【2026-10-20】DOM ノードの __proto__ 代入(ShadyDOM の ShadowRoot 化)
7622        ("function SR(){} SR.prototype.hello = function(){ return 'hi:' + this.nodeType; }; var f = document.createDocumentFragment(); f.__proto__ = SR.prototype; f.hello() + ',' + (Object.getPrototypeOf(f) === SR.prototype) + ',' + (f.__proto__ === SR.prototype)", "hi:11,true,true"),
7623        // 【2026-10-20】ToPrimitive(利用者定義の toString/valueOf/Symbol.toPrimitive。Node で確認)
7624        ("function U(s){ this.s = s; } U.prototype.toString = function(){ return 'u:' + this.s; }; var u = new U('a'); var o = { valueOf: function(){ return 40; } }; var p = { [Symbol.toPrimitive]: function(h){ return h; } }; String(u) + ',' + (u + '!') + ',' + `${u}` + ',' + (o + 2) + ',' + (p + '') + ',' + String(p) + ',' + String({}) + ',' + ([1,2] + '')", "u:a,u:a!,u:a,42,default,string,[object Object],1,2"),
7625        // 【2026-10-20】DOM の原型の JS による上書き(Node.prototype.appendChild の包み)が組込みより先
7626        ("var orig = Node.prototype.appendChild; var n = 0; Node.prototype.appendChild = function(c){ n++; return orig.call(this, c); }; var d = document.createElement('div'); d.appendChild(document.createElement('span')); Node.prototype.appendChild = orig; d.appendChild(document.createElement('b')); n + ',' + d.children.length", "1,2"),
7627        // 【2026-10-20】ノード種別ごとの原型(DocumentFragment・Text・video)
7628        ("var f = document.createDocumentFragment(); f.appendChild(document.createElement('i')); var t = document.createTextNode('x'); (f instanceof DocumentFragment) + ',' + (f instanceof Element) + ',' + (t instanceof Text) + ',' + (t instanceof Node) + ',' + DocumentFragment.prototype.querySelectorAll.call(f, '*').length + ',' + (document.createElement('video') instanceof HTMLVideoElement)", "true,false,true,true,1,true"),
7629        // 【2026-11-19】`.style` は要素だけ。テキスト・コメント・フラグメント・シャドウルートは undefined。
7630        ("var h = document.createElement('div'); var sr = h.attachShadow({mode:'open'}); typeof document.createTextNode('x').style + ',' + typeof document.createComment('c').style + ',' + typeof document.createDocumentFragment().style + ',' + typeof sr.style + ',' + typeof h.style", "undefined,undefined,undefined,undefined,object"),
7631        // 【2026-10-20】document の nodeType/nodeName/ownerDocument
7632        ("document.nodeType + ',' + document.nodeName + ',' + document.ownerDocument + ',' + (document.createElement('div').ownerDocument === document)", "9,#document,null,true"),
7633        // 【2026-10-20】組込みの constructor(Node で確認)
7634        ("({}).constructor === Object && [].constructor === Array && (function(){}).constructor === Function && (new Map()).constructor === Map && Object.create(null).constructor === undefined", "true"),
7635        // 【2026-10-20】`in` は組込みの prototype のメンバも見る(Node で確認)
7636        ("('constructor' in {}) + ',' + ('toString' in {}) + ',' + ('push' in []) + ',' + ('call' in function(){}) + ',' + ('length' in function(){}) + ',' + ('x' in {}) + ',' + ('constructor' in Object.create(null))", "true,true,true,true,true,false,false"),
7637        // 【2026-10-20】Node/Element.prototype の DOM アクセサの記述子(ShadyDOM が写す)
7638        ("var d = document.createElement('div'); var ic = Object.getOwnPropertyDescriptor(Node.prototype, 'isConnected'); var tc = Object.getOwnPropertyDescriptor(Node.prototype, 'textContent'); var b1 = ic.get.call(d); document.getElementById('out').appendChild(d); tc.set.call(d, 'hey'); b1 + ',' + ic.get.call(d) + ',' + d.textContent + ',' + Object.getOwnPropertyDescriptor(Element.prototype, 'children').get.call(document.getElementById('out')).length", "false,true,hey,1"),
7639        // 【2026-10-20】カスタム要素のクラスの上書きが組込みより先・Element/Node.prototype の転送
7640        ("var log = []; class XI extends HTMLElement { removeAttribute(n){ log.push('rm:' + n); super.removeAttribute(n); } } customElements.define('x-i', XI); var e = document.createElement('x-i'); e.setAttribute('q', '1'); e.removeAttribute('q'); log.join(',') + '|' + e.hasAttribute('q') + ',' + (typeof Node.prototype.appendChild)", "rm:q|false,function"),
7641        ("var d = document.createElement('div'); Element.prototype.setAttribute.call(d, 'a', '1'); Node.prototype.appendChild.call(document.getElementById('out'), d); d.getAttribute('a') + ',' + (d.parentNode.id)", "1,out"),
7642        // 【2026-10-20】attributeChangedCallback(静的 getter の observedAttributes、昇格時の既存属性)
7643        ("var log = []; class XG extends HTMLElement { static get observedAttributes(){ return ['foo']; } attributeChangedCallback(n, o, v){ log.push(n + ':' + o + '>' + v); } } customElements.define('x-g', XG); var e = document.createElement('x-g'); e.setAttribute('foo', '1'); e.setAttribute('bar', '2'); e.setAttribute('foo', '3'); e.removeAttribute('foo'); log.join(',')", "foo:null>1,foo:1>3,foo:3>null"),
7644        ("var d = document.getElementById('out'); d.innerHTML = '<x-h foo=\"a\"></x-h>'; var log = []; class XH extends HTMLElement { static get observedAttributes(){ return ['foo']; } attributeChangedCallback(n, o, v){ log.push(n + ':' + o + '>' + v); } } customElements.define('x-h', XH); d.firstChild.removeAttribute('foo'); log.join(',')", "foo:null>a,foo:a>null"),
7645        // 【2026-10-20】Reflect.construct の newTarget と、ES5 版のカスタム要素(custom-elements-es5-adapter の形)
7646        ("function A(){ this.a = 1; } function B(){} B.prototype.hi = function(){ return 'hi'; }; var o = Reflect.construct(A, [], B); o.a + ',' + o.hi() + ',' + (o instanceof B)", "1,hi,true"),
7647        ("var BuiltIn = HTMLElement; HTMLElement = function(){ return Reflect.construct(BuiltIn, [], this.constructor); }; HTMLElement.prototype = BuiltIn.prototype; HTMLElement.prototype.constructor = HTMLElement; Object.setPrototypeOf(HTMLElement, BuiltIn); function XF(){ var t = HTMLElement.call(this) || this; t.z = 3; return t; } XF.prototype = Object.create(HTMLElement.prototype); XF.prototype.constructor = XF; customElements.define('x-f', XF); var e = document.createElement('x-f'); var d = document.createElement('div'); d.innerHTML = '<x-f></x-f>'; var c = d.cloneNode(true); e.tagName + ',' + e.z + ',' + (e instanceof XF) + ',' + c.firstChild.z", "X-F,3,true,3"),
7648        // 【2026-10-20】カスタム要素: 構築・昇格(define 時・innerHTML・importNode)・ライフサイクル・prototype の setter
7649        ("var log = []; class XA extends HTMLElement { constructor(){ super(); log.push('ctor'); this.v = 5; } connectedCallback(){ log.push('conn'); } disconnectedCallback(){ log.push('disc'); } get dbl(){ return this.v * 2; } } customElements.define('x-a', XA); var e = document.createElement('x-a'); log.push('created'); document.getElementById('out').appendChild(e); e.remove(); log.join(',') + '|' + (e instanceof XA) + ',' + e.dbl + ',' + (Object.getPrototypeOf(e) === XA.prototype) + ',' + e.tagName", "ctor,created,conn,disc|true,10,true,X-A"),
7650        ("var d = document.createElement('div'); document.getElementById('out').appendChild(d); d.innerHTML = '<x-b id=q></x-b>'; var log = []; class XB extends HTMLElement { constructor(){ super(); log.push('ctor:' + this.id); } connectedCallback(){ log.push('conn'); } } customElements.define('x-b', XB); log.join(',') + '|' + (document.getElementById('q') instanceof XB)", "ctor:q,conn|true"),
7651        ("class XC extends HTMLElement { constructor(){ super(); this.k = 1; } } customElements.define('x-c', XC); var d = document.createElement('div'); document.getElementById('out').appendChild(d); d.innerHTML = '<x-c></x-c>'; (d.firstChild instanceof XC) + ',' + d.firstChild.k", "true,1"),
7652        ("class XD extends HTMLElement { set foo(v){ this._f = v * 3; } get foo(){ return this._f; } } customElements.define('x-d', XD); var x = new XD(); x.foo = 2; x.tagName + ',' + x.foo + ',' + x._f", "X-D,6,6"),
7653        ("class XE extends HTMLElement { constructor(){ super(); this.up = 'yes'; } } customElements.define('x-e', XE); var t = document.createElement('template'); t.innerHTML = '<div><x-e></x-e></div>'; var c = document.importNode(t.content, true); c.querySelector('x-e').up", "yes"),
7654        // 【2026-10-22】ShadowRoot の host・mode・getElementById(Polymer / ytd-app の基盤)
7655        ("var d = document.createElement('div'); var s = d.attachShadow({mode: 'open'}); (s.host === d) + ',' + s.mode", "true,open"),
7656        ("var d = document.createElement('div'); var s = d.attachShadow({mode: 'open'}); s.innerHTML = '<span id=masthead>YouTube Header</span>'; s.getElementById('masthead').textContent", "YouTube Header"),
7657        // 【2026-10-22】adoptedCallback と document.adoptNode
7658        // 昇格したカスタム要素の組込みプロパティへの代入(2026-10-29)。原型の連鎖で `Element.prototype` の
7659        // 転送用 setter を呼び、それが同じ代入へ戻って無限に往復していた(YouTube の自動再生で RangeError)。
7660        ("class XSetId extends HTMLElement {} customElements.define('x-set-id', XSetId); var el = document.createElement('x-set-id'); \
7661          el.id = 'a1'; el.textContent = 'hi'; el.className = 'c'; el.id + ',' + el.textContent + ',' + el.className + ',' + el.getAttribute('id')", "a1,hi,c,a1"),
7662        ("var log = []; class XAdopt extends HTMLElement { adoptedCallback(){ log.push('adopted'); } } customElements.define('x-adopt', XAdopt); var el = document.createElement('x-adopt'); document.adoptNode(el); log.join(',')", "adopted"),
7663        // 【2026-10-22】Polymer / ytd-app 相当の Shadow DOM テンプレート展開と ready() 完走
7664        ("class YtdApp extends HTMLElement { connectedCallback(){ this._enableProperties(); } _enableProperties(){ this._readyClients(); } _readyClients(){ this.root = this.attachShadow({mode: 'open'}); this.root.innerHTML = '<div id=masthead>Header</div><div id=content>Videos</div>'; this.ready(); } ready(){ this.$ = {}; this.$['masthead'] = this.root.getElementById('masthead'); this.__dataReady = true; } } customElements.define('ytd-app', YtdApp); var app = document.createElement('ytd-app'); document.getElementById('out').appendChild(app); (app.__dataReady) + ',' + (app.$['masthead'].textContent) + ',' + (app.root.host === app)", "true,Header,true"),
7665        ("document.getElementById('out').textContent", "0"),
7666        ("var e=document.getElementById('out'); e.textContent='42'; e.textContent", "42"),
7667        ("document.getElementById('out').tagName", "DIV"),
7668        ("document.querySelector('.msg').textContent", "hi"),
7669        ("document.querySelectorAll('div').length", "1"),
7670        ("document.getElementById('b').classList.contains('x')", "true"),
7671        ("var e=document.getElementById('b'); e.classList.add('y'); e.classList.contains('y')", "true"),
7672        ("var e=document.getElementById('b'); e.classList.toggle('x'); e.classList.contains('x')", "false"),
7673        ("var e=document.getElementById('out'); e.style.color='red'; e.style.color", "red"),
7674        ("document.getElementById('missing') === null", "true"),
7675        ("document.getElementById('b').getAttribute('id')", "b"),
7676        // `document.children`/`.childElementCount`(`ParentNode`ミックスイン
7677        // の`Document`側配線漏れ。丸ごと未対応だった。bare `cases`配列では
7678        // `<html>`未構築のため、実際にHTMLフィクスチャがあるこちらで検証。
7679        // 2026-07-17 発見・実装)。
7680        ("document.children.length", "1"),
7681        ("document.children[0] === document.documentElement", "true"),
7682        ("document.childElementCount", "1"),
7683        // addEventListener + クリック発火(ブリッジ経由でディスパッチ)
7684        ("var n=0; document.getElementById('b').addEventListener('click', () => n++); n", "0"),
7685        // 動的ノード(createElement / appendChild / innerHTML / remove)
7686        ("document.createElement('DIV').tagName", "DIV"),
7687        ("var d=document.createElement('div'); d.textContent='hi'; d.textContent", "hi"),
7688        // textContent/innerHTML は WebIDL 上 nullable (DOMString?) につき null/undefined 代入は空文字列になる
7689        ("var d=document.createElement('div'); d.textContent='hi'; d.textContent=null; d.textContent===''", "true"),
7690        ("var d=document.createElement('div'); d.innerHTML='<b>x</b>'; d.innerHTML=undefined; d.innerHTML===''", "true"),
7691        ("var c=document.getElementById('out'); var s=document.createElement('span'); s.textContent='X'; c.appendChild(s); c.textContent", "0X"),
7692        ("var c=document.getElementById('out'); c.innerHTML='<b>Y</b>'; c.textContent", "Y"),
7693        ("var c=document.getElementById('out'); var i=document.createElement('i'); c.appendChild(i); document.querySelector('i') === null", "false"),
7694        ("var c=document.getElementById('out'); c.innerHTML='<span class=z>1</span><span class=z>2</span>'; document.querySelectorAll('.z').length", "2"),
7695        ("var c=document.getElementById('out'); var t=document.createTextNode('TT'); c.appendChild(t); c.textContent", "0TT"),
7696        ("var c=document.getElementById('out'); c.appendChild(document.createElement('em')); document.querySelector('em').remove(); document.querySelector('em') === null", "true"),
7697        // `ariaActiveDescendantElement`(ARIA Element Reflection。
7698        // `aria-activedescendant`のidref文字列ではなく実際のElement参照を
7699        // 返す/設定する。`popoverTargetElement`と同じidref解決パターン。
7700        // 丸ごと未対応だった。既にDOMツリーに接続されたフィクスチャ要素
7701        // (`get_element_by_id`は接続済みノードしか見ない)が必要なため、
7702        // bare `cases`配列ではなくこちらのfixture付き配列で検証。
7703        // 2026-07-18 発見・実装)。
7704        (
7705            "var a=document.createElement('div'); var b=document.getElementById('out'); a.ariaActiveDescendantElement=b; a.getAttribute('aria-activedescendant')+'|'+(a.ariaActiveDescendantElement===b)",
7706            "out|true",
7707        ),
7708        // `ariaLabelledByElements`/`ariaDescribedByElements`等(ARIA Element
7709        // Reflection、複数形)が丸ごと未対応だった。空白区切りidref属性を
7710        // 実際のElement参照の配列として読み書きする。単数形の
7711        // `ariaActiveDescendantElement`と同じ理由で接続済みfixture要素が
7712        // 必要。2026-07-18 発見・実装)。
7713        (
7714            "var a=document.createElement('div'); var b1=document.getElementById('out'); var b2=document.getElementById('b'); a.ariaLabelledByElements=[b1,b2]; a.getAttribute('aria-labelledby')+'|'+a.ariaLabelledByElements.length+'|'+(a.ariaLabelledByElements[0]===b1)+'|'+(a.ariaLabelledByElements[1]===b2)",
7715            "out b|2|true|true",
7716        ),
7717        (
7718            "document.createElement('div').ariaDescribedByElements.length",
7719            "0",
7720        ),
7721        // `parent.moveBefore(movedNode, referenceNode)`(丸ごと未対応
7722        // だった。この処理系には保持すべき「生きた状態」自体が無いため、
7723        // `insertBefore`と同じdetach+挿入の簡略実装で仕様どおり動作する。
7724        // 2026-07-18 発見・実装)。
7725        (
7726            "var p1=document.createElement('div'); var p2=document.createElement('div'); var m=document.createElement('span'); p1.appendChild(m); var r=document.createElement('b'); p2.appendChild(r); p2.moveBefore(m, r); m.parentNode===p2 && p2.firstChild===m && p1.children.length",
7727            "0",
7728        ),
7729        (
7730            "var p=document.createElement('div'); var a=document.createElement('i'); var b=document.createElement('b'); p.appendChild(a); p.appendChild(b); p.moveBefore(b, a); p.firstChild===b",
7731            "true",
7732        ),
7733        (
7734            "var p1=document.createElement('div'); var p2=document.createElement('div'); var m=document.createElement('span'); var other=document.createElement('b'); p1.appendChild(m); p2.appendChild(other); try { p1.moveBefore(m, other); 'no-throw'; } catch(e) { e.name; }",
7735            "NotFoundError",
7736        ),
7737    ];
7738    total += dom_cases.len();
7739    for (src, expect) in dom_cases {
7740        let mut rt = JsRuntime::new();
7741        rt.dom()
7742            .borrow_mut()
7743            .build_from(&crate::os_lib::dom::parse_html(dom_html));
7744        match rt.eval(src) {
7745            Ok(v) if &v.to_js_string() == expect => passed += 1,
7746            Ok(v) => crate::println!(
7747                "JS_SELFTEST FAIL: `{}` => `{}` (want `{}`)",
7748                src,
7749                v.to_js_string(),
7750                expect
7751            ),
7752            Err(e) => crate::println!("JS_SELFTEST ERR:  `{}` => {}", src, e),
7753        }
7754    }
7755
7756    // 要素 DOM API(hasAttribute/removeAttribute/matches/closest/element querySelector/ナビ)。
7757    let dom2_html = "<div id='wrap' class='container'><p id='t' class='a b' data-k='v'>x</p><span id='s'>y</span></div>";
7758    let dom2_cases: &[(&str, &str)] = &[
7759        ("document.getElementById('t').hasAttribute('class')", "true"),
7760        ("document.getElementById('t').hasAttribute('nope')", "false"),
7761        ("document.getElementById('t').getAttribute('data-k')", "v"),
7762        ("var e=document.getElementById('t'); e.removeAttribute('class'); e.hasAttribute('class')", "false"),
7763        ("document.getElementById('t').matches('.a')", "true"),
7764        ("document.getElementById('t').matches('.z')", "false"),
7765        ("document.getElementById('t').matches('p')", "true"),
7766        ("document.getElementById('t').closest('.container').id", "wrap"),
7767        ("document.getElementById('t').closest('#wrap').id", "wrap"),
7768        ("document.getElementById('t').closest('p').id", "t"),
7769        ("document.getElementById('t').closest('.nope') === null", "true"),
7770        ("document.getElementById('wrap').querySelector('.a').id", "t"),
7771        ("document.getElementById('wrap').querySelector('span').id", "s"),
7772        ("document.getElementById('wrap').querySelectorAll('*').length", "2"),
7773        // コンパウンドセレクタ(タグ+クラス、以前は文字列全体をタグ名として比較しており
7774        // 常に false になっていた)。
7775        ("document.getElementById('t').matches('p.a')", "true"),
7776        ("document.getElementById('t').matches('p.z')", "false"),
7777        ("document.getElementById('t').matches('p.a.b')", "true"),
7778        // 属性セレクタ(以前は丸ごと未対応で常に false になっていた)。
7779        ("document.getElementById('t').matches('[data-k]')", "true"),
7780        ("document.getElementById('t').matches('[data-k=v]')", "true"),
7781        ("document.getElementById('t').matches('[data-k=x]')", "false"),
7782        ("document.getElementById('t').matches('[data-k^=v]')", "true"),
7783        // 結合子(子孫/子、以前は丸ごと未対応で常に false になっていた)。
7784        ("document.getElementById('t').matches('#wrap p')", "true"),
7785        ("document.getElementById('t').matches('#wrap > p')", "true"),
7786        ("document.getElementById('t').matches('#wrap > span')", "false"),
7787        // 一般兄弟結合子(`p ~ span`)。
7788        ("document.getElementById('s').matches('p ~ span')", "true"),
7789        ("document.getElementById('s').matches('span ~ span')", "false"),
7790        // querySelector(All) でも同じコンパウンド/属性セレクタが機能する。
7791        ("document.getElementById('wrap').querySelector('p.a').id", "t"),
7792        ("document.getElementById('wrap').querySelectorAll('[data-k]').length", "1"),
7793        // `:not()` 疑似クラス。
7794        ("document.getElementById('t').matches(':not(span)')", "true"),
7795        ("document.getElementById('t').matches(':not(p)')", "false"),
7796        ("document.getElementById('t').matches('p:not(.z)')", "true"),
7797        ("document.getElementById('t').matches('p:not(.a)')", "false"),
7798        ("document.getElementById('wrap').querySelectorAll(':not(span)').length", "1"),
7799        // `:scope` 疑似クラス(Selectors Level 4。丸ごと未対応だった)。
7800        // `element.querySelector(All)`/`matches`/`closest` における `:scope` は
7801        // 呼び出し元の要素自身を指す。
7802        ("document.getElementById('wrap').querySelectorAll(':scope > p').length", "1"),
7803        ("document.getElementById('wrap').querySelectorAll(':scope > p')[0].id", "t"),
7804        ("document.getElementById('wrap').querySelector(':scope > span').id", "s"),
7805        ("document.getElementById('wrap').querySelectorAll(':scope > .nope').length", "0"),
7806        ("document.getElementById('t').matches(':scope')", "true"),
7807        ("document.getElementById('t').closest(':scope').id", "t"),
7808        // 位置系疑似クラス(`:first-child`/`:last-child`/`:only-child`/`:nth-child()`)。
7809        ("document.getElementById('t').matches(':first-child')", "true"),
7810        ("document.getElementById('t').matches(':last-child')", "false"),
7811        ("document.getElementById('s').matches(':last-child')", "true"),
7812        ("document.getElementById('t').matches(':only-child')", "false"),
7813        ("document.getElementById('t').matches(':nth-child(1)')", "true"),
7814        ("document.getElementById('s').matches(':nth-child(2)')", "true"),
7815        ("document.getElementById('t').matches(':nth-child(odd)')", "true"),
7816        ("document.getElementById('s').matches(':nth-child(odd)')", "false"),
7817        ("document.getElementById('s').matches(':nth-child(2n)')", "true"),
7818        // `:nth-last-child()`(末尾から数える版。丸ごと未対応だった)。
7819        // #t/#s は2要素中1番目/2番目 → 末尾からは2番目/1番目。
7820        ("document.getElementById('s').matches(':nth-last-child(1)')", "true"),
7821        ("document.getElementById('t').matches(':nth-last-child(1)')", "false"),
7822        ("document.getElementById('t').matches(':nth-last-child(2)')", "true"),
7823        ("document.getElementById('s').matches(':nth-last-child(odd)')", "true"),
7824        // `:first-of-type`/`:last-of-type`/`:only-of-type`/`:nth-of-type()`(タグ名が
7825        // 同じ兄弟のみを数える点以外は `:nth-child()` 系と同じ規則)。各テストケースは
7826        // `document.getElementById` の「同一 id が複数あれば最初のものを返す」挙動と
7827        // 衝突しないよう、テストごとに固有の id を使う(以前は全ケースで同じ
7828        // p1/s1/p2/p3 を使い回しており、2回目以降は常に最初に追加した要素を
7829        // 参照してしまっていた)。
7830        (
7831            "var w=document.createElement('div'); w.innerHTML=\"<p id='ot1a'>a</p><span id='ot1b'>b</span><p id='ot1c'>c</p><p id='ot1d'>d</p>\"; document.getElementById('wrap').appendChild(w); document.getElementById('ot1a').matches(':first-of-type')",
7832            "true",
7833        ),
7834        (
7835            "var w=document.createElement('div'); w.innerHTML=\"<p id='ot2a'>a</p><span id='ot2b'>b</span><p id='ot2c'>c</p><p id='ot2d'>d</p>\"; document.getElementById('wrap').appendChild(w); document.getElementById('ot2d').matches(':last-of-type')",
7836            "true",
7837        ),
7838        (
7839            "var w=document.createElement('div'); w.innerHTML=\"<p id='ot3a'>a</p><span id='ot3b'>b</span><p id='ot3c'>c</p><p id='ot3d'>d</p>\"; document.getElementById('wrap').appendChild(w); document.getElementById('ot3c').matches(':last-of-type')",
7840            "false",
7841        ),
7842        (
7843            "var w=document.createElement('div'); w.innerHTML=\"<p id='ot4a'>a</p><span id='ot4b'>b</span><p id='ot4c'>c</p><p id='ot4d'>d</p>\"; document.getElementById('wrap').appendChild(w); document.getElementById('ot4b').matches(':only-of-type')",
7844            "true",
7845        ),
7846        (
7847            "var w=document.createElement('div'); w.innerHTML=\"<p id='ot5a'>a</p><span id='ot5b'>b</span><p id='ot5c'>c</p><p id='ot5d'>d</p>\"; document.getElementById('wrap').appendChild(w); document.getElementById('ot5a').matches(':only-of-type')",
7848            "false",
7849        ),
7850        (
7851            "var w=document.createElement('div'); w.innerHTML=\"<p id='ot6a'>a</p><span id='ot6b'>b</span><p id='ot6c'>c</p><p id='ot6d'>d</p>\"; document.getElementById('wrap').appendChild(w); document.getElementById('ot6c').matches(':nth-of-type(2)')",
7852            "true",
7853        ),
7854        (
7855            "var w=document.createElement('div'); w.innerHTML=\"<p id='ot7a'>a</p><span id='ot7b'>b</span><p id='ot7c'>c</p><p id='ot7d'>d</p>\"; document.getElementById('wrap').appendChild(w); document.getElementById('ot7a').matches(':nth-of-type(2)')",
7856            "false",
7857        ),
7858        // `:nth-last-of-type()`(末尾から数える版。丸ごと未対応だった)。
7859        // p 要素は a/c/d の3つ → 末尾からは d=1番目, c=2番目, a=3番目。
7860        (
7861            "var w=document.createElement('div'); w.innerHTML=\"<p id='ot8a'>a</p><span id='ot8b'>b</span><p id='ot8c'>c</p><p id='ot8d'>d</p>\"; document.getElementById('wrap').appendChild(w); document.getElementById('ot8d').matches(':nth-last-of-type(1)')",
7862            "true",
7863        ),
7864        (
7865            "var w=document.createElement('div'); w.innerHTML=\"<p id='ot9a'>a</p><span id='ot9b'>b</span><p id='ot9c'>c</p><p id='ot9d'>d</p>\"; document.getElementById('wrap').appendChild(w); document.getElementById('ot9a').matches(':nth-last-of-type(3)')",
7866            "true",
7867        ),
7868        // `:is()`/`:where()`(コンパウンドセレクタのリストのみ対応。結合子を含む
7869        // 複雑なセレクタは非対応)。
7870        ("document.getElementById('t').matches(':is(.z, .a)')", "true"),
7871        ("document.getElementById('t').matches(':is(.z, .y)')", "false"),
7872        ("document.getElementById('t').matches(':where(span, p.a)')", "true"),
7873        ("document.getElementById('s').matches(':is(span)')", "true"),
7874        // `:empty` / `:checked` / `:disabled` / `:enabled` 疑似クラス(Selectors Level 3/4)。
7875        (
7876            "var w=document.createElement('div'); w.innerHTML=\"<div id='em1'></div><div id='em2'>text</div><input id='ck1' type='checkbox' checked><input id='ck2' type='checkbox'><button id='ds1' disabled>x</button><button id='ds2'>y</button>\"; document.getElementById('wrap').appendChild(w); document.getElementById('em1').matches(':empty')",
7877            "true",
7878        ),
7879        (
7880            "var w=document.createElement('div'); w.innerHTML=\"<div id='em1'></div><div id='em2'>text</div><input id='ck1' type='checkbox' checked><input id='ck2' type='checkbox'><button id='ds1' disabled>x</button><button id='ds2'>y</button>\"; document.getElementById('wrap').appendChild(w); document.getElementById('em2').matches(':empty')",
7881            "false",
7882        ),
7883        (
7884            "var w=document.createElement('div'); w.innerHTML=\"<div id='em1'></div><div id='em2'>text</div><input id='ck1' type='checkbox' checked><input id='ck2' type='checkbox'><button id='ds1' disabled>x</button><button id='ds2'>y</button>\"; document.getElementById('wrap').appendChild(w); document.getElementById('ck1').matches(':checked')",
7885            "true",
7886        ),
7887        (
7888            "var w=document.createElement('div'); w.innerHTML=\"<div id='em1'></div><div id='em2'>text</div><input id='ck1' type='checkbox' checked><input id='ck2' type='checkbox'><button id='ds1' disabled>x</button><button id='ds2'>y</button>\"; document.getElementById('wrap').appendChild(w); document.getElementById('ck2').matches(':checked')",
7889            "false",
7890        ),
7891        (
7892            "var w=document.createElement('div'); w.innerHTML=\"<div id='em1'></div><div id='em2'>text</div><input id='ck1' type='checkbox' checked><input id='ck2' type='checkbox'><button id='ds1' disabled>x</button><button id='ds2'>y</button>\"; document.getElementById('wrap').appendChild(w); document.getElementById('ds1').matches(':disabled')",
7893            "true",
7894        ),
7895        (
7896            "var w=document.createElement('div'); w.innerHTML=\"<div id='em1'></div><div id='em2'>text</div><input id='ck1' type='checkbox' checked><input id='ck2' type='checkbox'><button id='ds1' disabled>x</button><button id='ds2'>y</button>\"; document.getElementById('wrap').appendChild(w); document.getElementById('ds2').matches(':disabled')",
7897            "false",
7898        ),
7899        (
7900            "var w=document.createElement('div'); w.innerHTML=\"<div id='em1'></div><div id='em2'>text</div><input id='ck1' type='checkbox' checked><input id='ck2' type='checkbox'><button id='ds1' disabled>x</button><button id='ds2'>y</button>\"; document.getElementById('wrap').appendChild(w); document.getElementById('ds1').matches(':enabled')",
7901            "false",
7902        ),
7903        (
7904            "var w=document.createElement('div'); w.innerHTML=\"<div id='em1'></div><div id='em2'>text</div><input id='ck1' type='checkbox' checked><input id='ck2' type='checkbox'><button id='ds1' disabled>x</button><button id='ds2'>y</button>\"; document.getElementById('wrap').appendChild(w); document.getElementById('ds2').matches(':enabled')",
7905            "true",
7906        ),
7907        (
7908            "var w=document.createElement('div'); w.innerHTML=\"<div id='em1'></div><div id='em2'>text</div><input id='ck1' type='checkbox' checked><input id='ck2' type='checkbox'><button id='ds1' disabled>x</button><button id='ds2'>y</button>\"; document.getElementById('wrap').appendChild(w); document.getElementById('em1').closest('.container').id",
7909            "wrap",
7910        ),
7911        ("document.getElementById('t').parentElement.id", "wrap"),
7912        ("document.getElementById('wrap').children.length", "2"),
7913        ("document.getElementById('wrap').childElementCount", "2"),
7914        // `node.hasChildNodes()`(丸ごと未対応だった。2026-07-15 発見・実装)。
7915        ("document.getElementById('wrap').hasChildNodes()", "true"),
7916        ("document.createElement('div').hasChildNodes()", "false"),
7917        // `document.createElementNS(ns, tag)`(丸ごと未対応だった。SVG 要素を
7918        // 動的生成する標準的な定番パターン。2026-07-15 発見・実装)。
7919        // `*AttributeNS` と同じく名前空間自体はモデル化せず非 NS 版へ委譲する
7920        // 簡略実装のため、生成される要素は通常の `createElement` と同じ。
7921        (
7922            "document.createElementNS('http://www.w3.org/2000/svg', 'circle').tagName",
7923            "CIRCLE",
7924        ),
7925        (
7926            "var e=document.createElementNS('http://www.w3.org/2000/svg', 'rect'); \
7927             e.setAttribute('width', '10'); e.getAttribute('width')",
7928            "10",
7929        ),
7930        ("document.getElementById('wrap').firstElementChild.id", "t"),
7931        ("document.getElementById('wrap').lastElementChild.id", "s"),
7932        ("document.getElementById('t').nextElementSibling.id", "s"),
7933        ("document.getElementById('s').previousElementSibling.id", "t"),
7934        ("document.getElementById('wrap').getAttributeNames().join(',')", "id,class"),
7935        // `element.attributes`(DOM 標準の `NamedNodeMap`。丸ごと未対応だった。
7936        // `{name,value}` オブジェクトの配列という簡略表現)。
7937        ("document.getElementById('wrap').attributes.length", "2"),
7938        ("document.getElementById('wrap').attributes[0].name", "id"),
7939        ("document.getElementById('wrap').attributes[0].value", "wrap"),
7940        // `getAttributeNode`/`setAttributeNode`/`removeAttributeNode`
7941        // (丸ごと未対応だった。2026-07-14 発見・実装)。
7942        ("document.getElementById('wrap').getAttributeNode('id').value", "wrap"),
7943        ("document.getElementById('wrap').getAttributeNode('missing')", "null"),
7944        (
7945            "var e=document.getElementById('wrap'); \
7946             e.setAttributeNode({name:'data-x', value:'1'}); e.getAttribute('data-x')",
7947            "1",
7948        ),
7949        (
7950            "var e=document.getElementById('wrap'); var a=e.getAttributeNode('id'); \
7951             e.removeAttributeNode(a); e.hasAttribute('id')",
7952            "false",
7953        ),
7954        // `document.createAttribute(name)`(丸ごと未対応だった。`Attr` ノードを
7955        // 新規に作ってから `setAttributeNode()` で取り付ける定番パターン。
7956        // 2026-07-15 発見・実装)。仕様どおり名前は小文字化される。
7957        ("document.createAttribute('DATA-X').name", "data-x"),
7958        ("document.createAttribute('data-x').value", ""),
7959        ("document.createAttribute('data-x').ownerElement", "null"),
7960        (
7961            "var e=document.getElementById('wrap'); var a=document.createAttribute('data-y'); \
7962             a.value='42'; e.setAttributeNode(a); e.getAttribute('data-y')",
7963            "42",
7964        ),
7965        // Fullscreen API(`element.requestFullscreen()`/`document.exitFullscreen()`/
7966        // `document.fullscreenElement`。丸ごと未対応だった。実際の画面占有切替は
7967        // 行わず状態のみ追跡する簡略実装)。
7968        ("document.fullscreenElement", "null"),
7969        ("document.fullscreenEnabled", "true"),
7970        (
7971            "var e=document.getElementById('wrap'); e.requestFullscreen(); document.fullscreenElement===e",
7972            "true",
7973        ),
7974        (
7975            "var e=document.getElementById('wrap'); e.requestFullscreen(); document.exitFullscreen(); document.fullscreenElement",
7976            "null",
7977        ),
7978        // Pointer Lock API(`element.requestPointerLock()`/`document.exitPointerLock()`/
7979        // `document.pointerLockElement`。丸ごと未対応だった。Fullscreen API と
7980        // 同じ「状態のみ追跡する」簡略実装)。
7981        ("document.pointerLockElement", "null"),
7982        (
7983            "var e=document.getElementById('wrap'); e.requestPointerLock(); document.pointerLockElement===e",
7984            "true",
7985        ),
7986        (
7987            "var e=document.getElementById('wrap'); e.requestPointerLock(); document.exitPointerLock(); document.pointerLockElement",
7988            "null",
7989        ),
7990        // Picture-in-Picture API(`element.requestPictureInPicture()`/
7991        // `document.exitPictureInPicture()`/`document.pictureInPictureElement`。
7992        // 丸ごと未対応だった。Fullscreen/Pointer Lock API と同じ
7993        // 「状態のみ追跡する」簡略実装)。
7994        ("document.pictureInPictureElement", "null"),
7995        ("document.pictureInPictureEnabled", "true"),
7996        (
7997            "var e=document.getElementById('wrap'); e.requestPictureInPicture(); \
7998             document.pictureInPictureElement===e",
7999            "true",
8000        ),
8001        (
8002            "var e=document.getElementById('wrap'); e.requestPictureInPicture(); \
8003             document.exitPictureInPicture(); document.pictureInPictureElement",
8004            "null",
8005        ),
8006        // `document.createTreeWalker(root)`(丸ごと未対応だった。DOM 部分木を
8007        // 走査する定番パターン。`wrap` の子は `#t`(p)/`#s`(span) の2要素)。
8008        (
8009            "document.createTreeWalker(document.getElementById('wrap')).currentNode.id",
8010            "wrap",
8011        ),
8012        (
8013            "var tw=document.createTreeWalker(document.getElementById('wrap')); \
8014             tw.firstChild(); tw.currentNode.id",
8015            "t",
8016        ),
8017        (
8018            "var tw=document.createTreeWalker(document.getElementById('wrap')); \
8019             tw.firstChild(); tw.nextSibling(); tw.currentNode.id",
8020            "s",
8021        ),
8022        (
8023            "var tw=document.createTreeWalker(document.getElementById('wrap')); \
8024             tw.firstChild(); tw.nextSibling(); tw.parentNode(); tw.currentNode.id",
8025            "wrap",
8026        ),
8027        (
8028            "var tw=document.createTreeWalker(document.getElementById('wrap')); \
8029             tw.nextNode(); tw.currentNode.id",
8030            "t",
8031        ),
8032        (
8033            "var tw=document.createTreeWalker(document.getElementById('wrap')); \
8034             var r=tw.parentNode(); r === null && tw.currentNode.id === 'wrap'",
8035            "true",
8036        ),
8037        // `document.createNodeIterator(root)`(丸ごと未対応だった。`TreeWalker` とは
8038        // 異なる「参照ノード+前後どちら側を指しているか」のポインタモデル)。
8039        (
8040            "document.createNodeIterator(document.getElementById('wrap')).nextNode().id",
8041            "wrap",
8042        ),
8043        (
8044            "var ni=document.createNodeIterator(document.getElementById('wrap')); \
8045             ni.nextNode(); ni.nextNode().id",
8046            "t",
8047        ),
8048        // `#t` の中身はテキストノード "x" のため pre-order 3件目はそのテキスト
8049        // ノード(`nodeValue` で判定。`#s` に到達するのは5件目)。
8050        (
8051            "var ni=document.createNodeIterator(document.getElementById('wrap')); \
8052             ni.nextNode(); ni.nextNode(); ni.nextNode().nodeValue",
8053            "x",
8054        ),
8055        (
8056            "var ni=document.createNodeIterator(document.getElementById('wrap')); \
8057             ni.nextNode(); ni.nextNode(); ni.nextNode(); ni.nextNode().id",
8058            "s",
8059        ),
8060        (
8061            "var ni=document.createNodeIterator(document.getElementById('wrap')); \
8062             ni.nextNode(); ni.nextNode(); ni.nextNode(); ni.nextNode(); ni.nextNode(); \
8063             ni.nextNode() === null",
8064            "true",
8065        ),
8066        (
8067            "var ni=document.createNodeIterator(document.getElementById('wrap')); \
8068             ni.nextNode(); ni.nextNode(); ni.previousNode().id",
8069            "t",
8070        ),
8071        (
8072            "var ni=document.createNodeIterator(document.getElementById('wrap')); \
8073             ni.nextNode(); ni.nextNode(); ni.previousNode(); ni.previousNode().id",
8074            "wrap",
8075        ),
8076        // `element.contentEditable`/`.isContentEditable`/`document.designMode`
8077        // (丸ごと未対応だった。属性値の反映のみを行う簡略実装)。
8078        ("document.getElementById('wrap').contentEditable", "inherit"),
8079        ("document.getElementById('wrap').isContentEditable", "false"),
8080        (
8081            "var e=document.getElementById('wrap'); e.contentEditable='true'; \
8082             e.contentEditable + ',' + e.isContentEditable",
8083            "true,true",
8084        ),
8085        (
8086            "var e=document.getElementById('wrap'); e.contentEditable='plaintext-only'; \
8087             e.contentEditable + ',' + e.isContentEditable",
8088            "plaintext-only,true",
8089        ),
8090        (
8091            "var e=document.getElementById('wrap'); e.contentEditable='bogus'; e.contentEditable",
8092            "inherit",
8093        ),
8094        ("document.designMode", "off"),
8095        // `element.spellcheck`/`.inputMode`/`.enterKeyHint`(`spellcheck`/
8096        // `inputmode`/`enterkeyhint` グローバル属性の JS プロパティ版。丸ごと
8097        // 未対応だった。属性値の反映のみを行う簡略実装。2026-07-15 発見・実装)。
8098        ("document.getElementById('wrap').spellcheck", "true"),
8099        (
8100            "var e=document.getElementById('wrap'); e.spellcheck=false; e.spellcheck",
8101            "false",
8102        ),
8103        ("document.getElementById('wrap').inputMode", ""),
8104        (
8105            "var e=document.getElementById('wrap'); e.inputMode='numeric'; e.inputMode",
8106            "numeric",
8107        ),
8108        (
8109            "var e=document.getElementById('wrap'); e.enterKeyHint='search'; e.enterKeyHint",
8110            "search",
8111        ),
8112        // `element.autocapitalize`/`.popover`(`autocapitalize`/`popover`
8113        // グローバル属性の JS プロパティ版。丸ごと未対応だった。2026-07-15
8114        // 発見・実装。`popover` は `showPopover()`等のメソッド自体は前サイクル
8115        // 実装済みだが、属性読み書き用の IDL プロパティが欠けていた)。
8116        (
8117            "var e=document.getElementById('wrap'); e.autocapitalize='words'; e.autocapitalize",
8118            "words",
8119        ),
8120        ("document.createElement('div').popover", "null"),
8121        (
8122            "var e=document.createElement('div'); e.popover='manual'; e.popover",
8123            "manual",
8124        ),
8125        (
8126            "var e=document.createElement('div'); e.popover='auto'; e.popover=null; e.popover",
8127            "null",
8128        ),
8129        // `button.popoverTargetElement`/`.popoverTargetAction`(丸ごと未対応
8130        // だった。`popovertarget` idref 属性を実際の要素へ解決する IDL 属性。
8131        // 2026-07-15 発見・実装)。
8132        (
8133            "var b=document.createElement('button'); b.setAttribute('popovertarget','wrap'); \
8134             b.popoverTargetElement === document.getElementById('wrap')",
8135            "true",
8136        ),
8137        ("document.createElement('button').popoverTargetElement", "null"),
8138        (
8139            "var b=document.createElement('button'); b.popoverTargetElement = document.getElementById('wrap'); \
8140             b.getAttribute('popovertarget')",
8141            "wrap",
8142        ),
8143        (
8144            "var b=document.createElement('button'); b.popoverTargetAction='hide'; b.popoverTargetAction",
8145            "hide",
8146        ),
8147        // `input.list`(`list` idref 属性から実際の `<datalist>` 要素を解決する
8148        // IDL 属性。丸ごと未対応だった。2026-07-15 発見・実装)。
8149        ("document.createElement('input').list", "null"),
8150        (
8151            "var i=document.createElement('input'); i.setAttribute('list','missing'); i.list",
8152            "null",
8153        ),
8154        (
8155            "var dl=document.createElement('datalist'); dl.id='opts'; \
8156             document.getElementById('wrap').appendChild(dl); \
8157             var i=document.createElement('input'); i.setAttribute('list','opts'); \
8158             i.list === dl",
8159            "true",
8160        ),
8161        (
8162            "var d=document.createElement('div'); d.id='notdl'; \
8163             document.getElementById('wrap').appendChild(d); \
8164             var i=document.createElement('input'); i.setAttribute('list','notdl'); i.list",
8165            "null",
8166        ),
8167        // `a`/`area`/`link.relList`(`rel` 属性の `DOMTokenList` 版)。
8168        ("document.createElement('a').relList.length", "0"),
8169        (
8170            "var a=document.createElement('a'); a.rel='noopener noreferrer'; \
8171             Array.from(a.relList).join(',')",
8172            "noopener,noreferrer",
8173        ),
8174        (
8175            "var a=document.createElement('a'); a.rel='noopener noreferrer'; \
8176             a.relList.contains('noreferrer')",
8177            "true",
8178        ),
8179        // `.referrerPolicy`/`.loading`/`.decoding`/`.allow`/`.sandbox`(丸ごと
8180        // 未対応だった。属性値の反映のみを行う簡略実装。2026-07-15 発見・実装)。
8181        (
8182            "var a=document.createElement('a'); a.referrerPolicy='no-referrer'; \
8183             a.referrerPolicy",
8184            "no-referrer",
8185        ),
8186        (
8187            "var i=document.createElement('img'); i.loading='lazy'; i.loading",
8188            "lazy",
8189        ),
8190        (
8191            "var i=document.createElement('img'); i.decoding='async'; i.decoding",
8192            "async",
8193        ),
8194        (
8195            "var f=document.createElement('iframe'); f.allow='camera'; f.allow",
8196            "camera",
8197        ),
8198        ("document.createElement('iframe').sandbox.length", "0"),
8199        (
8200            "var f=document.createElement('iframe'); \
8201             f.setAttribute('sandbox','allow-scripts allow-forms'); \
8202             Array.from(f.sandbox).join(',')",
8203            "allow-scripts,allow-forms",
8204        ),
8205        // `.crossOrigin`/`.fetchPriority`/`.integrity`/`script.async`/`.defer`/
8206        // `.noModule`(丸ごと未対応だった。属性値の反映のみを行う簡略実装。
8207        // 2026-07-15 発見・実装)。
8208        ("document.createElement('img').crossOrigin", "null"),
8209        (
8210            "var i=document.createElement('img'); i.crossOrigin='anonymous'; i.crossOrigin",
8211            "anonymous",
8212        ),
8213        ("document.createElement('img').fetchPriority", "auto"),
8214        (
8215            "var i=document.createElement('img'); i.fetchPriority='high'; i.fetchPriority",
8216            "high",
8217        ),
8218        (
8219            "var s=document.createElement('script'); s.integrity='sha256-x'; s.integrity",
8220            "sha256-x",
8221        ),
8222        (
8223            "var s=document.createElement('script'); s.async=true; s.async + ',' + \
8224             s.hasAttribute('async')",
8225            "true,true",
8226        ),
8227        (
8228            "var s=document.createElement('script'); s.defer=true; s.defer=false; s.defer",
8229            "false",
8230        ),
8231        (
8232            "var s=document.createElement('script'); s.noModule=true; s.noModule",
8233            "true",
8234        ),
8235        // `.srcset`/`.sizes`/`.media`/`img.useMap`/`.isMap`/`.currentSrc`
8236        // (丸ごと未対応だった。属性値の反映のみを行う簡略実装。2026-07-15
8237        // 発見・実装)。
8238        (
8239            "var i=document.createElement('img'); i.srcset='a.jpg 1x, b.jpg 2x'; i.srcset",
8240            "a.jpg 1x, b.jpg 2x",
8241        ),
8242        (
8243            "var i=document.createElement('img'); i.sizes='(max-width:600px) 480px'; i.sizes",
8244            "(max-width:600px) 480px",
8245        ),
8246        (
8247            "var l=document.createElement('link'); l.media='print'; l.media",
8248            "print",
8249        ),
8250        (
8251            "var i=document.createElement('img'); i.useMap='#m'; i.useMap",
8252            "#m",
8253        ),
8254        ("document.createElement('img').isMap", "false"),
8255        (
8256            "var i=document.createElement('img'); i.isMap=true; i.hasAttribute('ismap')",
8257            "true",
8258        ),
8259        (
8260            "var i=document.createElement('img'); i.src='a.jpg'; i.currentSrc",
8261            "a.jpg",
8262        ),
8263        // `img.complete`/`.naturalWidth`/`.naturalHeight`/`.decode()`が丸ごと
8264        // 未対応だった(2026-07-17 発見・実装。実デコード寸法を追跡する
8265        // 経路が無いため`naturalWidth`/`.naturalHeight`は常に`0`を返す
8266        // 誠実な簡略実装。`complete`は`src`の有無のみで判定)。
8267        ("document.createElement('img').complete", "false"),
8268        (
8269            "var i=document.createElement('img'); i.src='a.jpg'; i.complete",
8270            "true",
8271        ),
8272        (
8273            "var i=document.createElement('img'); i.src='a.jpg'; i.naturalWidth + ',' + i.naturalHeight",
8274            "0,0",
8275        ),
8276        (
8277            "var i=document.createElement('img'); i.src='a.jpg'; \
8278             await i.decode().then(() => 'ok')",
8279            "ok",
8280        ),
8281        (
8282            "var i=document.createElement('img'); \
8283             await i.decode().catch(e => e.name)",
8284            "EncodingError",
8285        ),
8286        // `audio`/`video.autoplay`/`.controls`/`.loop`/`.muted`/`.playsInline`/
8287        // `.preload`/`.poster`/`a.ping`/`.hreflang`(丸ごと未対応だった。属性値の
8288        // 反映のみを行う簡略実装。2026-07-15 発見・実装)。
8289        ("document.createElement('video').autoplay", "false"),
8290        (
8291            "var v=document.createElement('video'); v.autoplay=true; v.autoplay + \
8292             ',' + v.hasAttribute('autoplay')",
8293            "true,true",
8294        ),
8295        (
8296            "var v=document.createElement('video'); v.controls=true; v.controls=false; \
8297             v.controls",
8298            "false",
8299        ),
8300        (
8301            "var v=document.createElement('video'); v.loop=true; v.loop",
8302            "true",
8303        ),
8304        (
8305            "var v=document.createElement('video'); v.muted=true; v.muted",
8306            "true",
8307        ),
8308        (
8309            "var v=document.createElement('video'); v.playsInline=true; \
8310             v.hasAttribute('playsinline')",
8311            "true",
8312        ),
8313        (
8314            "var v=document.createElement('video'); v.preload='auto'; v.preload",
8315            "auto",
8316        ),
8317        (
8318            "var v=document.createElement('video'); v.poster='p.jpg'; v.poster",
8319            "p.jpg",
8320        ),
8321        (
8322            "var a=document.createElement('a'); a.ping='https://x'; a.ping",
8323            "https://x",
8324        ),
8325        (
8326            "var a=document.createElement('a'); a.hreflang='en'; a.hreflang",
8327            "en",
8328        ),
8329        // `audio`/`video.paused`/`.currentTime`/`.duration`/`.volume`/
8330        // `.playbackRate`(丸ごと未対応だった。`.play()`/`.pause()`と同じ
8331        // 状態追跡のみの簡略実装。2026-07-15 発見・実装)。
8332        ("document.createElement('video').paused", "true"),
8333        (
8334            "var v=document.createElement('video'); await v.play(); v.paused",
8335            "false",
8336        ),
8337        (
8338            "var v=document.createElement('video'); await v.play(); v.pause(); v.paused",
8339            "true",
8340        ),
8341        (
8342            "var v=document.createElement('video'); v.currentTime=12.5; v.currentTime",
8343            "12.5",
8344        ),
8345        (
8346            "var v=document.createElement('video'); Number.isNaN(v.duration)",
8347            "true",
8348        ),
8349        ("document.createElement('video').volume", "1"),
8350        (
8351            "var v=document.createElement('video'); v.volume=0.5; v.volume",
8352            "0.5",
8353        ),
8354        (
8355            "var v=document.createElement('video'); v.volume=5; v.volume",
8356            "1",
8357        ),
8358        (
8359            "var v=document.createElement('video'); v.playbackRate=2; v.playbackRate",
8360            "2",
8361        ),
8362        // `.play()`/`.pause()` の `play`/`playing`/`pause` イベント発火(丸ごと
8363        // 未対応だった。既に同じ状態なら発火しない冪等性も含む。2026-07-15
8364        // 発見・実装)。
8365        (
8366            "var v=document.createElement('video'); var log=[]; \
8367             v.addEventListener('play', ()=>log.push('play')); \
8368             v.addEventListener('playing', ()=>log.push('playing')); \
8369             await v.play(); log.join(',')",
8370            "play,playing",
8371        ),
8372        (
8373            "var v=document.createElement('video'); var n=0; \
8374             v.addEventListener('pause', ()=>n++); \
8375             await v.play(); v.pause(); v.pause(); n",
8376            "1",
8377        ),
8378        (
8379            "var v=document.createElement('video'); var n=0; \
8380             v.addEventListener('play', ()=>n++); \
8381             await v.play(); await v.play(); n",
8382            "1",
8383        ),
8384        // `.currentTime`/`.volume`/`.muted`/`.playbackRate` 代入時の
8385        // `seeked`/`volumechange`/`ratechange` イベント発火(丸ごと未対応
8386        // だった。2026-07-15 発見・実装)。
8387        (
8388            "var v=document.createElement('video'); var f=false; \
8389             v.addEventListener('seeked', ()=>f=true); v.currentTime=5; f",
8390            "true",
8391        ),
8392        (
8393            "var v=document.createElement('video'); var f=false; \
8394             v.addEventListener('volumechange', ()=>f=true); v.volume=0.3; f",
8395            "true",
8396        ),
8397        (
8398            "var v=document.createElement('video'); var f=false; \
8399             v.addEventListener('volumechange', ()=>f=true); v.muted=true; f",
8400            "true",
8401        ),
8402        (
8403            "var v=document.createElement('video'); var f=false; \
8404             v.addEventListener('ratechange', ()=>f=true); v.playbackRate=1.5; f",
8405            "true",
8406        ),
8407        // `.readyState`/`.networkState`/`.error`(丸ごと未対応だった。実際の
8408        // ネットワーク層/デコーダが無いため誠実に「何もロードしていない」
8409        // 状態を返す簡略実装。2026-07-15 発見・実装)。
8410        ("document.createElement('video').readyState", "0"),
8411        ("document.createElement('video').networkState", "0"),
8412        (
8413            "var v=document.createElement('video'); v.src='a.mp4'; v.networkState",
8414            "3",
8415        ),
8416        ("document.createElement('video').error", "null"),
8417        // `.buffered`/`.seekable`(`TimeRanges`。丸ごと未対応だった。実際には
8418        // メディアを一切ロードしないため常に空。範囲外アクセスは仕様どおり
8419        // 例外を投げる誠実な簡略実装)。`.defaultPlaybackRate` は単純な数値
8420        // 状態の保持のみ(`.playbackRate`とは独立)。2026-07-15 発見・実装。
8421        ("document.createElement('video').buffered.length", "0"),
8422        ("document.createElement('video').seekable.length", "0"),
8423        (
8424            "try { document.createElement('video').buffered.start(0); 'no-throw' } \
8425             catch(e) { 'threw' }",
8426            "threw",
8427        ),
8428        ("document.createElement('video').defaultPlaybackRate", "1"),
8429        (
8430            "var v=document.createElement('video'); v.defaultPlaybackRate=1.5; \
8431             v.defaultPlaybackRate + ',' + v.playbackRate",
8432            "1.5,1",
8433        ),
8434        // `element.getAnimations()`/`document.getAnimations()`(丸ごと未対応
8435        // だった。`.animate()` の戻り値を一切保持していないため常に空配列を
8436        // 返す誠実な簡略実装。2026-07-15 発見・実装)。
8437        (
8438            "document.createElement('div').getAnimations().length",
8439            "0",
8440        ),
8441        (
8442            "var e=document.createElement('div'); e.animate([], 100); \
8443             e.getAnimations().length",
8444            "0",
8445        ),
8446        ("document.getAnimations().length", "0"),
8447        // `Animation.reverse()`/`.finish()`/`.playbackRate`(丸ごと未対応
8448        // だった。`play`/`pause`/`cancel`と同じno-opの簡略方針。
8449        // 2026-07-17 発見・実装)。
8450        (
8451            "var a=document.createElement('div').animate([],100); \
8452             typeof a.reverse + ',' + typeof a.finish + ',' + a.playbackRate",
8453            "function,function,1",
8454        ),
8455        (
8456            "var a=document.createElement('div').animate([],100); a.reverse(); a.finish(); a.playbackRate=2; a.playbackRate",
8457            "2",
8458        ),
8459        // `script`/`style.nonce`(丸ごと未対応だった。属性値の反映のみを行う
8460        // 簡略実装。2026-07-15 発見・実装)。
8461        (
8462            "var s=document.createElement('script'); s.nonce='abc123'; s.nonce",
8463            "abc123",
8464        ),
8465        // `Selection`(`document.getSelection()`)の残りのメソッド群/
8466        // プロパティが丸ごと未対応だった。テキスト選択機構自体が無いため
8467        // 「常に何も選択していない」誠実な簡略実装。2026-07-15 発見・実装。
8468        (
8469            "var s=document.getSelection(); s.collapse(document.body, 0); \
8470             s.anchorNode + ',' + s.type",
8471            "null,None",
8472        ),
8473        (
8474            "var s=document.getSelection(); s.containsNode(document.body)",
8475            "false",
8476        ),
8477        // `Selection.removeRange(range)`が`addRange`/`removeAllRanges`の隣で
8478        // 漏れていた兄弟ギャップ(丸ごと未対応だった。2026-07-17 発見・
8479        // 実装)。
8480        (
8481            "typeof document.getSelection().removeRange",
8482            "function",
8483        ),
8484        (
8485            "document.getSelection().removeRange(document.createRange())",
8486            "undefined",
8487        ),
8488        (
8489            "try { document.getSelection().getRangeAt(0); 'no-throw' } \
8490             catch(e) { 'threw' }",
8491            "threw",
8492        ),
8493        // `Range`(`document.createRange()`)の残りのメソッド群/プロパティが
8494        // 丸ごと未対応だった。`Selection` と同方針の誠実な簡略実装。
8495        // 2026-07-15 発見・実装。
8496        (
8497            "var r=document.createRange(); r.setStart(document.body, 0); \
8498             r.collapsed + ',' + r.toString()",
8499            "true,",
8500        ),
8501        (
8502            "var r=document.createRange(); var r2=r.cloneRange(); \
8503             r2.collapsed",
8504            "true",
8505        ),
8506        (
8507            "document.createRange().isPointInRange(document.body, 0)",
8508            "false",
8509        ),
8510        ("typeof Range", "function"),
8511        ("Range.START_TO_START + ',' + Range.END_TO_START", "0,3"),
8512        (
8513            "var b=document.getElementById('wrap'); var r=new Range(); r.setStart(b, 1); r.setEnd(b, 5); \
8514             r.collapsed + ',' + r.startOffset + ',' + r.endOffset",
8515            "false,1,5",
8516        ),
8517        (
8518            "var b=document.getElementById('wrap'); var r=new Range(); r.setStart(b, 1); r.setEnd(b, 5); \
8519             var r2=r.cloneRange(); r2.collapsed + ',' + r2.startOffset + ',' + r2.endOffset",
8520            "false,1,5",
8521        ),
8522        (
8523            "var b=document.getElementById('wrap'); var r=new Range(); r.setStart(b, 1); r.setEnd(b, 5); \
8524             r.collapse(true); r.collapsed + ',' + r.startOffset + ',' + r.endOffset",
8525            "true,1,1",
8526        ),
8527        (
8528            "var b=document.getElementById('wrap'); var r=new Range(); r.setStart(b, 1); r.setEnd(b, 5); \
8529             r.isPointInRange(b, 3)",
8530            "true",
8531        ),
8532        (
8533            "var b=document.getElementById('wrap'); var r=new Range(); r.setStart(b, 1); r.setEnd(b, 5); \
8534             r.isPointInRange(b, 10)",
8535            "false",
8536        ),
8537        (
8538            "var b=document.getElementById('wrap'); var s=window.getSelection(); var r=new Range(); r.setStart(b, 2); \
8539             r.setEnd(b, 8); s.addRange(r); \
8540             s.rangeCount + ',' + s.isCollapsed + ',' + s.type",
8541            "1,false,Range",
8542        ),
8543        (
8544            "var b=document.getElementById('wrap'); var s=window.getSelection(); var r=new Range(); r.setStart(b, 2); \
8545             r.setEnd(b, 8); s.addRange(r); \
8546             window.getSelection().getRangeAt(0).startOffset",
8547            "2",
8548        ),
8549        (
8550            "var s=window.getSelection(); s.removeAllRanges(); s.rangeCount + ',' + s.type",
8551            "0,None",
8552        ),
8553        (
8554            "document.designMode='on'; document.designMode",
8555            "on",
8556        ),
8557        // `element.hasAttributes()`(丸ごと未対応だった。単一属性の有無を見る
8558        // `hasAttribute(name)` は既に対応済みだったが、こちらが漏れていた)。
8559        ("document.getElementById('wrap').hasAttributes()", "true"),
8560        ("document.createElement('div').hasAttributes()", "false"),
8561        // `node.isSameNode(other)`/`node.isEqualNode(other)` が丸ごと未対応だった。
8562        ("var e=document.getElementById('wrap'); e.isSameNode(e)", "true"),
8563        (
8564            "document.getElementById('wrap').isSameNode(document.getElementById('t'))",
8565            "false",
8566        ),
8567        (
8568            "var a=document.createElement('div'); a.id='x'; var b=document.createElement('div'); b.id='x'; a.isEqualNode(b)",
8569            "true",
8570        ),
8571        (
8572            "var a=document.createElement('div'); a.id='x'; var b=document.createElement('div'); b.id='y'; a.isEqualNode(b)",
8573            "false",
8574        ),
8575        // `node.normalize()` が丸ごと未対応だった。連続する隣接テキストノードを
8576        // 1つに連結し、空のテキストノードを取り除く。
8577        (
8578            "var d=document.createElement('div'); d.appendChild(document.createTextNode('a')); d.appendChild(document.createTextNode('b')); d.normalize(); d.childNodes.length",
8579            "1",
8580        ),
8581        (
8582            "var d=document.createElement('div'); d.appendChild(document.createTextNode('a')); d.appendChild(document.createTextNode('b')); d.normalize(); d.textContent",
8583            "ab",
8584        ),
8585        (
8586            "var d=document.createElement('div'); d.appendChild(document.createTextNode('')); d.normalize(); d.childNodes.length",
8587            "0",
8588        ),
8589        // `document.createDocumentFragment()` が丸ごと未対応だった。挿入すると
8590        // フラグメント自身ではなく中身の子要素群がそのまま移動する(実 DOM の挙動)。
8591        ("typeof document.createDocumentFragment", "function"),
8592        (
8593            "var f=document.createDocumentFragment(); f.appendChild(document.createElement('span')); f.appendChild(document.createElement('em')); var d=document.createElement('div'); d.appendChild(f); d.children.length+','+d.children[0].tagName+','+d.children[1].tagName",
8594            "2,SPAN,EM",
8595        ),
8596        // フラグメント自身は挿入後に空になる(中身だけが移動したことの確認)。
8597        (
8598            "var f=document.createDocumentFragment(); f.appendChild(document.createElement('span')); var d=document.createElement('div'); d.appendChild(f); f.childNodes.length",
8599            "0",
8600        ),
8601        // getElementsByClassName / getElementsByTagName
8602        ("document.getElementsByTagName('p').length", "1"),
8603        ("document.getElementsByClassName('a')[0].id", "t"),
8604        ("document.getElementsByTagName('span')[0].id", "s"),
8605        // 要素インスタンス版の getElementsByClassName/getElementsByTagName
8606        // (`document` 版は対応済みだったがこちらが丸ごと未対応だった)。
8607        (
8608            "document.getElementById('wrap').getElementsByClassName('a')[0].id",
8609            "t",
8610        ),
8611        (
8612            "document.getElementById('wrap').getElementsByTagName('span')[0].id",
8613            "s",
8614        ),
8615        (
8616            "document.getElementById('s').getElementsByClassName('a').length",
8617            "0",
8618        ),
8619        // getElementsByTagNameNS / getAttributeNodeNS(丸ごと未対応だった)。
8620        ("document.getElementsByTagNameNS('*', 'span')[0].id", "s"),
8621        (
8622            "document.getElementById('wrap').getElementsByTagNameNS(null, 'span')[0].id",
8623            "s",
8624        ),
8625        (
8626            "document.getElementById('wrap').getAttributeNodeNS(null, 'id').value",
8627            "wrap",
8628        ),
8629        (
8630            "document.getElementById('wrap').getAttributeNodeNS('http://www.w3.org/1999/xhtml', 'missing') === null",
8631            "true",
8632        ),
8633        // `document.getElementsByName(name)`(丸ごと未対応だった。ラジオボタン
8634        // グループ等、同じ `name` 属性を持つ要素群をまとめて取得する定番
8635        // パターン。2026-07-15 発見・実装)。
8636        (
8637            "var a=document.createElement('input'); a.setAttribute('name','q'); \
8638             var b=document.createElement('input'); b.setAttribute('name','q'); \
8639             var wrap=document.getElementById('wrap'); \
8640             wrap.appendChild(a); wrap.appendChild(b); \
8641             document.getElementsByName('q').length",
8642            "2",
8643        ),
8644        ("document.getElementsByName('no-such-name').length", "0"),
8645        // append / prepend / before / after / replaceWith
8646        ("var w=document.getElementById('wrap'); var n=document.createElement('b'); n.id='ap'; w.append(n); w.lastElementChild.id", "ap"),
8647        ("var w=document.getElementById('wrap'); var n=document.createElement('b'); n.id='pp'; w.prepend(n); w.firstElementChild.id", "pp"),
8648        ("var n=document.createElement('b'); n.id='bf'; document.getElementById('t').before(n); document.getElementById('t').previousElementSibling.id", "bf"),
8649        ("var n=document.createElement('b'); n.id='af'; document.getElementById('t').after(n); document.getElementById('t').nextElementSibling.id", "af"),
8650        ("var n=document.createElement('b'); n.id='rw'; document.getElementById('s').replaceWith(n); document.getElementById('wrap').lastElementChild.id", "rw"),
8651        ("var w=document.getElementById('wrap'); w.append('TXT'); w.textContent.indexOf('TXT') >= 0", "true"),
8652        // `element.replaceChildren(...nodes)`(`innerHTML=''; append(...)` の1行版)
8653        // が丸ごと未対応だった。既存の子は全て消え、渡した内容だけが残る。
8654        (
8655            "var w=document.getElementById('wrap'); var n=document.createElement('b'); n.id='rc'; w.replaceChildren(n); w.children.length + ',' + w.firstElementChild.id",
8656            "1,rc",
8657        ),
8658        (
8659            "var w=document.getElementById('wrap'); w.replaceChildren(); w.children.length",
8660            "0",
8661        ),
8662        // `element.scrollTo(x,y)`/`.scrollBy(x,y)`(オブジェクト引数 `{top}` 形式も
8663        // 含む)が丸ごと未対応だった。既存の `element.scrollTop` setter へ委譲する。
8664        (
8665            "var w=document.getElementById('wrap'); w.scrollTo(0, 50); w.scrollTop",
8666            "50",
8667        ),
8668        (
8669            "var w=document.getElementById('wrap'); w.scrollTo({top: 30}); w.scrollTop",
8670            "30",
8671        ),
8672        (
8673            "var w=document.getElementById('wrap'); w.scrollTop=10; w.scrollBy(0, 5); w.scrollTop",
8674            "15",
8675        ),
8676        // `element.scrollLeft` および `scrollTo`/`scrollBy`/`scroll`(水平スクロール対応)
8677        (
8678            "var w=document.getElementById('wrap'); w.scrollLeft=40; w.scrollLeft",
8679            "40",
8680        ),
8681        (
8682            "var w=document.getElementById('wrap'); w.scrollTo(80, 20); w.scrollLeft + ',' + w.scrollTop",
8683            "80,20",
8684        ),
8685        (
8686            "var w=document.getElementById('wrap'); w.scrollTo({left: 60, top: 10}); w.scrollLeft + ',' + w.scrollTop",
8687            "60,10",
8688        ),
8689        (
8690            "var w=document.getElementById('wrap'); w.scroll({left: 25, top: 35}); w.scrollLeft + ',' + w.scrollTop",
8691            "25,35",
8692        ),
8693        (
8694            "var w=document.getElementById('wrap'); w.scroll({left: 25, top: 35}); w.scrollBy(10, -5); w.scrollLeft + ',' + w.scrollTop",
8695            "35,30",
8696        ),
8697        (
8698            "var w=document.getElementById('wrap'); typeof w.scrollWidth",
8699            "number",
8700        ),
8701        // classList 追加(length / value / item / toString)
8702        ("document.getElementById('t').classList.length", "2"),
8703        ("document.getElementById('t').classList.value", "a b"),
8704        ("document.getElementById('t').classList.item(0)", "a"),
8705        ("document.getElementById('t').classList.toString()", "a b"),
8706        // insertAdjacentHTML / insertAdjacentElement / toggleAttribute
8707        ("var w=document.getElementById('wrap'); w.insertAdjacentHTML('beforeend','<i id=iah>z</i>'); document.getElementById('iah').tagName", "I"),
8708        // position 引数は仕様上 ASCII 大文字小文字を無視すべきだが、以前は完全一致
8709        // のみで `"beforeEnd"` 等を渡すと静かに no-op になっていた。
8710        ("var w=document.getElementById('wrap'); w.insertAdjacentHTML('beforeEnd','<b id=iahc>z</b>'); document.getElementById('iahc').tagName", "B"),
8711        ("var t=document.getElementById('t'); t.insertAdjacentHTML('afterend','<u id=iae>q</u>'); t.nextElementSibling.id", "iae"),
8712        ("var t=document.getElementById('t'); var n=document.createElement('b'); n.id='iel'; t.insertAdjacentElement('beforebegin', n); t.previousElementSibling.id", "iel"),
8713        ("var t=document.getElementById('t'); t.toggleAttribute('hidden'); t.hasAttribute('hidden')", "true"),
8714        ("var t=document.getElementById('t'); t.toggleAttribute('hidden'); t.toggleAttribute('hidden'); t.hasAttribute('hidden')", "false"),
8715        ("var t=document.getElementById('t'); t.toggleAttribute('hidden', true); t.hasAttribute('hidden')", "true"),
8716        ("var t=document.getElementById('t'); t.toggleAttribute('hidden', true); t.toggleAttribute('hidden', false); t.hasAttribute('hidden')", "false"),
8717        // <dialog> の show()/showModal()/close()(以前は丸ごと未対応だった)。
8718        ("var d=document.createElement('dialog'); d.open", "false"),
8719        ("var d=document.createElement('dialog'); d.show(); d.open", "true"),
8720        ("var d=document.createElement('dialog'); d.showModal(); d.open", "true"),
8721        // `.show()`と`.showModal()`が同一実装を共有しておりCSS `:modal`用の
8722        // 区別が一切無かった(2026-07-18 発見・実装)。`_modal`は
8723        // `showModal()`のみが書き込む内部専用属性で、`.show()`では
8724        // 付かず、`.close()`/`.requestClose()`でどちらも除去される。
8725        ("var d=document.createElement('dialog'); d.show(); d.hasAttribute('_modal')", "false"),
8726        ("var d=document.createElement('dialog'); d.showModal(); d.hasAttribute('_modal')", "true"),
8727        ("var d=document.createElement('dialog'); d.showModal(); d.close(); d.hasAttribute('_modal')", "false"),
8728        ("var d=document.createElement('dialog'); d.show(); d.close(); d.open", "false"),
8729        ("var d=document.createElement('dialog'); d.show(); d.close('ok'); d.returnValue", "ok"),
8730        (
8731            "var d=document.createElement('dialog'); var closed=false; d.addEventListener('close', function(){ closed=true; }); d.show(); d.close(); closed",
8732            "true",
8733        ),
8734        ("var d=document.createElement('dialog'); d.open=true; d.hasAttribute('open')", "true"),
8735        // Popover API `showPopover()`/`hidePopover()`/`togglePopover(force?)`
8736        // (丸ごと未対応だった。`<dialog>` の `open` 属性と同じ内部専用属性の
8737        // 付け外しのみの簡略実装。2026-07-15 発見・実装)。
8738        ("var e=document.createElement('div'); e.togglePopover()", "true"),
8739        (
8740            "var e=document.createElement('div'); e.togglePopover(); e.togglePopover()",
8741            "false",
8742        ),
8743        (
8744            "var e=document.createElement('div'); e.togglePopover(true); e.togglePopover(true)",
8745            "true",
8746        ),
8747        (
8748            "var e=document.createElement('div'); e.showPopover(); e.togglePopover()",
8749            "false",
8750        ),
8751        // Popover API が状態変化を`toggle`イベントとして発火していな
8752        // かった(`<dialog>.close()`は既に`"close"`イベントを発火して
8753        // いたのに同じ役目のPopover側だけ漏れていた。丸ごと未対応
8754        // だった。2026-07-17 発見・実装)。
8755        (
8756            "var e=document.createElement('div'); var n=0; \
8757             e.addEventListener('toggle', () => n++); e.showPopover(); e.hidePopover(); n",
8758            "2",
8759        ),
8760        (
8761            "var e=document.createElement('div'); var n=0; \
8762             e.addEventListener('toggle', () => n++); e.togglePopover(); n",
8763            "1",
8764        ),
8765        // `toggle`イベントの`oldState`/`newState`(仕様上の`ToggleEvent`の
8766        // 主要プロパティ。丸ごと未対応だった。2026-07-17 発見・実装)。
8767        (
8768            "var e=document.createElement('div'); var s=''; \
8769             e.addEventListener('toggle', ev => s=ev.oldState+'>'+ev.newState); \
8770             e.showPopover(); s",
8771            "closed>open",
8772        ),
8773        (
8774            "var e=document.createElement('div'); var s=''; \
8775             e.addEventListener('toggle', ev => s=ev.oldState+'>'+ev.newState); \
8776             e.showPopover(); e.hidePopover(); s",
8777            "open>closed",
8778        ),
8779        // `beforetoggle`(状態変更「前」に発火する取消可能なイベント。
8780        // `preventDefault()`で開閉を中止できる。丸ごと未対応だった。
8781        // 2026-07-17 発見・実装)。
8782        (
8783            "var e=document.createElement('div'); var n=0; \
8784             e.addEventListener('beforetoggle', () => n++); e.showPopover(); n",
8785            "1",
8786        ),
8787        (
8788            "var e=document.createElement('div'); var toggled=false; \
8789             e.addEventListener('beforetoggle', ev => ev.preventDefault()); \
8790             e.addEventListener('toggle', () => toggled=true); \
8791             e.showPopover(); toggled",
8792            "false",
8793        ),
8794        (
8795            "var e=document.createElement('div'); \
8796             e.addEventListener('beforetoggle', ev => ev.preventDefault()); \
8797             e.showPopover(); e.togglePopover()",
8798            "false",
8799        ),
8800        // `inert` グローバル真偽属性(丸ごと未対応だった)。
8801        ("var t=document.createElement('div'); t.inert", "false"),
8802        ("var t=document.createElement('div'); t.setAttribute('inert',''); t.inert", "true"),
8803        ("var t=document.createElement('div'); t.inert=true; t.hasAttribute('inert')", "true"),
8804        ("var t=document.createElement('div'); t.inert=true; t.inert=false; t.hasAttribute('inert')", "false"),
8805        // <template>.content(丸ごと未対応だった)。
8806        (
8807            "var tpl=document.createElement('template'); tpl.innerHTML='<p>hi</p>'; tpl.content.children.length",
8808            "1",
8809        ),
8810        (
8811            "var tpl=document.createElement('template'); tpl.innerHTML='<p>hi</p>'; tpl.content.firstChild.textContent",
8812            "hi",
8813        ),
8814        // 初回アクセスで子がフラグメント側へ移り、template 自身は空になる。
8815        (
8816            "var tpl=document.createElement('template'); tpl.innerHTML='<p>hi</p>'; var f=tpl.content; tpl.children.length",
8817            "0",
8818        ),
8819        // 2回目以降のアクセスでも同じフラグメントを返す(子を再度奪わない)。
8820        (
8821            "var tpl=document.createElement('template'); tpl.innerHTML='<p>hi</p>'; var f1=tpl.content; var f2=tpl.content; f1===f2",
8822            "true",
8823        ),
8824        // DocumentFragment を appendChild すると中身だけが移動する(実 DOM と同じ挙動)。
8825        (
8826            "var tpl=document.createElement('template'); tpl.innerHTML='<p>hi</p>'; var host=document.createElement('div'); host.appendChild(tpl.content); host.children.length",
8827            "1",
8828        ),
8829        // `document.importNode(externalNode, deep)`/`document.adoptNode(node)`
8830        // (丸ごと未対応だった。`<template>` の中身を取り込む定番パターン。
8831        // 2026-07-15 発見・実装)。`importNode` はコピーなので元の `.content`
8832        // には影響しない。
8833        (
8834            "var tpl=document.createElement('template'); tpl.innerHTML='<p>hi</p>'; \
8835             var imported=document.importNode(tpl.content, true); \
8836             var host=document.createElement('div'); host.appendChild(imported); \
8837             host.children.length + ',' + tpl.content.children.length",
8838            "1,1",
8839        ),
8840        (
8841            "var tpl=document.createElement('template'); tpl.innerHTML='<p>hi</p>'; \
8842             document.importNode(tpl.content, true).firstChild.textContent",
8843            "hi",
8844        ),
8845        (
8846            "var host1=document.createElement('div'); var host2=document.createElement('div'); \
8847             var child=document.createElement('span'); host1.appendChild(child); \
8848             document.adoptNode(child); host2.appendChild(child); \
8849             host1.children.length + ',' + host2.children.length",
8850            "0,1",
8851        ),
8852        // cloneNode(): .content に一度アクセス済みの <template> を複製すると、
8853        // クローン先の .content が元の(同じ)フラグメントを指したまま共有されて
8854        // しまうバグだった(複製後にクローン側の中身を変更しても元に影響しない、
8855        // という cloneNode の基本契約が破られていた)。
8856        (
8857            "var tpl=document.createElement('template'); tpl.innerHTML='<p>hi</p>'; var f=tpl.content; \
8858             var clone=tpl.cloneNode(true); clone.content===tpl.content",
8859            "false",
8860        ),
8861        (
8862            "var tpl=document.createElement('template'); tpl.innerHTML='<p>hi</p>'; var f=tpl.content; \
8863             var clone=tpl.cloneNode(true); clone.content.children.length+','+tpl.content.children.length",
8864            "1,1",
8865        ),
8866        // outerHTML/getAttributeNames() が `_content_frag`(`.content` アクセス済み
8867        // <template> が内部で持つ housekeeping 属性)等の `_` 始まり内部専用属性を
8868        // そのまま漏らしていたバグ。
8869        (
8870            "var tpl=document.createElement('template'); tpl.innerHTML='hi'; var f=tpl.content; tpl.outerHTML",
8871            "<template></template>",
8872        ),
8873        (
8874            "var tpl=document.createElement('template'); tpl.innerHTML='hi'; var f=tpl.content; \
8875             tpl.getAttributeNames().join(',')",
8876            "",
8877        ),
8878        // <progress>/<meter> の .value/.max/.min(丸ごと未対応だった。既定値は
8879        // 仕様どおり value=0/max=1/meter.min=0)。
8880        ("document.createElement('progress').value", "0"),
8881        ("document.createElement('progress').max", "1"),
8882        ("var p=document.createElement('progress'); p.setAttribute('value','30'); p.setAttribute('max','50'); p.value+'/'+p.max", "30/50"),
8883        ("var p=document.createElement('progress'); p.value=40; p.getAttribute('value')", "40"),
8884        ("document.createElement('meter').min", "0"),
8885        ("var m=document.createElement('meter'); m.setAttribute('value','5'); typeof m.value", "number"),
8886        // `input.valueAsNumber`(HTML5。丸ごと未対応だった)。
8887        ("var i=document.createElement('input'); i.type='number'; i.value='42'; i.valueAsNumber", "42"),
8888        ("var i=document.createElement('input'); i.type='text'; i.value='42'; isNaN(i.valueAsNumber)", "true"),
8889        ("var i=document.createElement('input'); i.type='number'; i.valueAsNumber=7; i.value", "7"),
8890        ("var i=document.createElement('input'); i.type='number'; i.value='5'; i.valueAsNumber=NaN; i.value", ""),
8891        // `input.valueAsDate`(HTML5。`type="date"`/`"month"` の丸ごと未対応だった。
8892        // `week`/その他の type は仕様どおり `null`)。
8893        (
8894            "var i=document.createElement('input'); i.type='date'; i.value='2024-03-15'; \
8895             i.valueAsDate.getUTCFullYear()+'-'+(i.valueAsDate.getUTCMonth()+1)+'-'+i.valueAsDate.getUTCDate()",
8896            "2024-3-15",
8897        ),
8898        ("var i=document.createElement('input'); i.type='text'; i.value='2024-03-15'; i.valueAsDate", "null"),
8899        (
8900            "var i=document.createElement('input'); i.type='date'; i.valueAsDate=new Date(Date.UTC(2024,2,15)); i.value",
8901            "2024-03-15",
8902        ),
8903        (
8904            "var i=document.createElement('input'); i.type='month'; i.valueAsDate=new Date(Date.UTC(2024,2,15)); i.value",
8905            "2024-03",
8906        ),
8907        (
8908            "var i=document.createElement('input'); i.type='date'; i.value='x'; i.valueAsDate=null; i.value",
8909            "",
8910        ),
8911        // `input[type=date/month/datetime-local].value`は仕様上、属性値が
8912        // 正しい形式でなければ空文字列を返すべきだが、`color`/`range`と同じ
8913        // バグパターンで不正な生文字列がそのまま漏れていた。
8914        (
8915            "var i=document.createElement('input'); i.type='date'; \
8916             i.setAttribute('value','not-a-date'); i.value",
8917            "",
8918        ),
8919        (
8920            "var i=document.createElement('input'); i.type='date'; \
8921             i.setAttribute('value','2026-07-18'); i.value",
8922            "2026-07-18",
8923        ),
8924        (
8925            "var i=document.createElement('input'); i.type='month'; \
8926             i.setAttribute('value','garbage'); i.value",
8927            "",
8928        ),
8929        (
8930            "var i=document.createElement('input'); i.type='datetime-local'; \
8931             i.setAttribute('value','2026-07-18T14:30'); i.value",
8932            "2026-07-18T14:30",
8933        ),
8934        // getAttributeNS/setAttributeNS/hasAttributeNS/removeAttributeNS(丸ごと
8935        // 未対応だった。名前空間は無視し非NS版と同じ属性ストアへ委譲する簡略実装)。
8936        ("var e=document.createElement('div'); e.setAttributeNS(null,'data-k','v'); e.getAttribute('data-k')", "v"),
8937        ("var e=document.createElement('div'); e.setAttribute('data-k','v'); e.getAttributeNS(null,'data-k')", "v"),
8938        ("var e=document.createElement('div'); e.setAttributeNS(null,'data-k','v'); e.hasAttributeNS(null,'data-k')", "true"),
8939        (
8940            "var e=document.createElement('div'); e.setAttributeNS(null,'data-k','v'); e.removeAttributeNS(null,'data-k'); e.hasAttribute('data-k')",
8941            "false",
8942        ),
8943        // node.getRootNode()(丸ごと未対応だった)。
8944        (
8945            "var p=document.createElement('div'); var c=document.createElement('span'); p.appendChild(c); c.getRootNode()===p",
8946            "true",
8947        ),
8948        // 接続済みツリーでは異なる要素同士でも同じルートを返す。
8949        (
8950            "document.getElementById('t').getRootNode()===document.getElementById('wrap').getRootNode()",
8951            "true",
8952        ),
8953        // 親の無い単独ノードは自分自身を返す。
8954        ("var e=document.createElement('div'); e.getRootNode()===e", "true"),
8955        // lookupNamespaceURI/lookupPrefix/isDefaultNamespace(丸ごと未対応
8956        // だった。2026-07-16 発見・実装。この処理系は XML 名前空間を一切
8957        // モデル化していないため常に「名前空間なし」を返す簡略実装)。
8958        ("var e=document.createElement('div'); e.lookupNamespaceURI('svg')", "null"),
8959        ("var e=document.createElement('div'); e.lookupPrefix('http://www.w3.org/2000/svg')", "null"),
8960        ("var e=document.createElement('div'); e.isDefaultNamespace(null)", "true"),
8961        ("var e=document.createElement('div'); e.isDefaultNamespace('http://www.w3.org/2000/svg')", "false"),
8962        // ノード読みプロパティ(nodeType / nodeName / hidden)
8963        ("document.getElementById('t').nodeType", "1"),
8964        ("document.getElementById('t').nodeName", "P"),
8965        ("document.getElementById('t').hidden", "false"),
8966        ("var e=document.getElementById('t'); e.toggleAttribute('hidden'); e.hidden", "true"),
8967        // dataset(data-* ↔ camelCase)  ※ getBoundingClientRect は別ブロックで rect を注入して検証
8968
8969        ("document.getElementById('t').dataset.k", "v"),
8970        ("var e=document.getElementById('t'); e.dataset.userId='42'; e.getAttribute('data-user-id')", "42"),
8971        ("var e=document.getElementById('t'); e.setAttribute('data-foo-bar','9'); e.dataset.fooBar", "9"),
8972        ("document.getElementById('t').dataset.missing === undefined", "true"),
8973        // `delete element.dataset.foo` は `dataset:` プロキシが `.props` を持たず実データが
8974        // DOM ノード属性側にあるため、何も起きない黙殺バグだった。
8975        (
8976            "var e=document.getElementById('t'); e.dataset.temp='x'; delete e.dataset.temp; e.dataset.temp === undefined",
8977            "true",
8978        ),
8979        (
8980            "var e=document.getElementById('t'); e.dataset.userId='42'; delete e.dataset.userId; e.hasAttribute('data-user-id')",
8981            "false",
8982        ),
8983        // `delete element.style.color` も同じ種類の黙殺バグだった。
8984        (
8985            "var e=document.getElementById('t'); e.style.color='red'; delete e.style.color; e.style.color",
8986            "",
8987        ),
8988        // `style.opacity = null` はそのプロパティを取り除く(2026-11-18)。
8989        (
8990            "var e=document.getElementById('t'); e.style.opacity='0.5'; e.style.opacity=null; e.style.opacity",
8991            "",
8992        ),
8993        // `caches` / `indexedDB` の最小の代用(2026-11-18)。
8994        (
8995            "await caches.open('x').then(c => c.match('y')).then(r => String(r)) + ',' + (indexedDB.open('x') instanceof IDBOpenDBRequest)",
8996            "undefined,true",
8997        ),
8998        (
8999            "await new Promise(function(res){ var r = indexedDB.open('x'); r.onerror = function(){ res(r.error.name); }; })",
9000            "InvalidStateError",
9001        ),
9002        // `Object.getOwnPropertyNames` は大文字の定数の名前(`_DRAWER_STATE`)を隠さない(2026-11-18)。
9003        ("Object.getOwnPropertyNames({_DRAWER_STATE:1,_a:2,_live_value:3}).join()", "_DRAWER_STATE,_a"),
9004        // insertBefore: 新ノードを s の前へ → wrap の子順が t, new, s
9005        ("var w=document.getElementById('wrap'); var n=document.createElement('b'); n.id='n'; w.insertBefore(n, document.getElementById('s')); w.children[1].id", "n"),
9006        ("var w=document.getElementById('wrap'); var n=document.createElement('b'); w.insertBefore(n, null); w.lastElementChild.tagName", "B"),
9007        // replaceChild: s を新ノードに置換
9008        ("var w=document.getElementById('wrap'); var n=document.createElement('i'); n.id='ni'; w.replaceChild(n, document.getElementById('s')); w.lastElementChild.id", "ni"),
9009        ("var w=document.getElementById('wrap'); var n=document.createElement('i'); var old=w.replaceChild(n, document.getElementById('s')); old.id", "s"),
9010        // `insertBefore`/`replaceChild`/`removeChild`は仕様上、参照ノードが
9011        // `this`の子でない場合`NotFoundError`を投げるべきだが、以前は検証が
9012        // 無く黙って末尾へ追加/何もせず成功したかのように振る舞っていた
9013        // (Table DOM/CharacterData/TypedArrayと同じ「不正な参照・範囲の
9014        // 黙殺」バグ族)。
9015        (
9016            "var w=document.getElementById('wrap'); var outsider=document.createElement('div'); \
9017             var n=document.createElement('b'); \
9018             try { w.insertBefore(n, outsider); 'no-throw' } catch(e) { e.name }",
9019            "NotFoundError",
9020        ),
9021        (
9022            "var w=document.getElementById('wrap'); var outsider=document.createElement('div'); \
9023             var n=document.createElement('b'); \
9024             try { w.replaceChild(n, outsider); 'no-throw' } catch(e) { e.name }",
9025            "NotFoundError",
9026        ),
9027        (
9028            "var w=document.getElementById('wrap'); var outsider=document.createElement('div'); \
9029             try { w.removeChild(outsider); 'no-throw' } catch(e) { e.name }",
9030            "NotFoundError",
9031        ),
9032        // cloneNode(deep): テキストごと複製
9033        ("document.getElementById('t').cloneNode(true).textContent", "x"),
9034        ("var c=document.getElementById('t').cloneNode(false); c.tagName + ':' + c.children.length", "P:0"),
9035        ("document.getElementById('t').cloneNode(true).parentElement === null", "true"),
9036        // classList.replace
9037        ("var e=document.getElementById('t'); e.classList.replace('a','z'); e.classList.contains('z') + ',' + e.classList.contains('a')", "true,false"),
9038        ("document.getElementById('t').classList.replace('nope','z')", "false"),
9039        // classList.toggle(name, force) — 第2引数 force が以前は完全に無視されていた。
9040        (
9041            "var e=document.getElementById('t'); e.classList.toggle('force-on', true); e.classList.contains('force-on')",
9042            "true",
9043        ),
9044        (
9045            "var e=document.getElementById('t'); e.classList.add('force-off'); e.classList.toggle('force-off', false); e.classList.contains('force-off')",
9046            "false",
9047        ),
9048        // classList.add/remove の複数引数(可変長引数)対応、classList.supports、webkitMatchesSelector、execCommand
9049        (
9050            "var e=document.createElement('div'); e.classList.add('c1', 'c2', 'c3'); e.className",
9051            "c1 c2 c3",
9052        ),
9053        (
9054            "var e=document.createElement('div'); e.classList.add('c1', 'c2', 'c3'); e.classList.remove('c1', 'c3'); e.className",
9055            "c2",
9056        ),
9057        (
9058            "var e=document.createElement('div'); e.classList.supports('foo')",
9059            "false",
9060        ),
9061        // 元は`document.body.appendChild`/`.remove()`を経由していたが、この
9062        // 自己テスト実行環境(`JsRuntime::new()`直後)には既定でパース済みの
9063        // `<html>`/`<body>`が一切存在しない(`document.body`は常に`null`)
9064        // ため、その`null`への`.appendChild`呼び出しが例外を投げていた
9065        // (2026-07-18 発見・修正)。`#id`セレクタの`matches()`判定は
9066        // ツリーへの接続を要さない(自身の`id`属性のみ見る)ため、
9067        // 接続操作自体が不要と判明し削除。
9068        (
9069            "var e=document.createElement('div'); e.id='wm'; e.webkitMatchesSelector('#wm')",
9070            "true",
9071        ),
9072        (
9073            "document.execCommand('copy')",
9074            "true",
9075        ),
9076        // `classList` の `Symbol.iterator`/`forEach` が丸ごと未対応で、`for...of`/
9077        // スプレッド/`forEach` のいずれも常に何も反復しない黙殺バグだった。
9078        (
9079            "var e=document.createElement('div'); e.className='a b c'; var out=[]; for (const c of e.classList) out.push(c); out.join(',')",
9080            "a,b,c",
9081        ),
9082        (
9083            "var e=document.createElement('div'); e.className='x y'; [...e.classList].join(',')",
9084            "x,y",
9085        ),
9086        (
9087            "var e=document.createElement('div'); e.className='p q'; var out=''; e.classList.forEach(function(c,i){out+=i+':'+c+' '}); out.trim()",
9088            "0:p 1:q",
9089        ),
9090        // `classList.entries()`/`.keys()`/`.values()`(丸ごと未対応だった。`forEach`
9091        // と for-of だけが配線され、明示イテレータ取得メソッド3種は未配線だった。
9092        // 2026-07-15 発見・実装)。
9093        (
9094            "var e=document.createElement('div'); e.className='r s'; var out=[]; for (const [i,c] of e.classList.entries()) out.push(i+':'+c); out.join(',')",
9095            "0:r,1:s",
9096        ),
9097        (
9098            "var e=document.createElement('div'); e.className='r s'; [...e.classList.keys()].join(',')",
9099            "0,1",
9100        ),
9101        (
9102            "var e=document.createElement('div'); e.className='r s'; [...e.classList.values()].join(',')",
9103            "r,s",
9104        ),
9105        // `Array.prototype.with(index, value)`(ES2023)— 範囲外 index は仕様上 RangeError
9106        // だが、以前は黙って無視して元と同じ配列を返していた。
9107        ("[1,2,3].with(1, 'x').join(',')", "1,x,3"),
9108        ("[1,2,3].with(-1, 'x').join(',')", "1,2,x"),
9109        (
9110            "try { [1,2,3].with(5, 'x'); 'no-throw' } catch(e) { 'threw' }",
9111            "threw",
9112        ),
9113        // `element.style.setProperty`/`getPropertyValue`/`removeProperty` が丸ごと
9114        // 欠落していた(直接のプロパティ代入 `el.style.color='red'` はあったが、
9115        // メソッド経由のインラインスタイル読み書きが無く、特に CSS カスタムプロパティ
9116        // `--foo` はこの経路でしか設定できないため影響が大きかった)。
9117        (
9118            "var e=document.getElementById('t'); e.style.setProperty('color','red'); e.style.color",
9119            "red",
9120        ),
9121        (
9122            "var e=document.getElementById('t'); e.style.setProperty('--my-var','10px'); e.style.getPropertyValue('--my-var')",
9123            "10px",
9124        ),
9125        (
9126            "var e=document.getElementById('t'); e.style.setProperty('color','blue'); e.style.removeProperty('color'); e.style.color",
9127            "",
9128        ),
9129        // `style.getPropertyPriority(name)`/`setProperty(name, value, priority)` の
9130        // 第3引数(丸ごと未対応・無視されていた。2026-07-16 発見・実装)。
9131        (
9132            "var e=document.getElementById('t'); e.style.setProperty('color','red','important'); e.style.getPropertyPriority('color')",
9133            "important",
9134        ),
9135        // `!important` 付きで設定した値を `getPropertyValue`/直接プロパティ双方から
9136        // 読んでも、優先度マーカーを含まない値本体のみが返るべき(仕様どおり)。
9137        (
9138            "var e=document.getElementById('t'); e.style.setProperty('color','red','important'); e.style.color",
9139            "red",
9140        ),
9141        (
9142            "var e=document.getElementById('t'); e.style.setProperty('color','red'); e.style.getPropertyPriority('color')",
9143            "",
9144        ),
9145        // `style.length`/`.item(index)`(丸ごと未対応だった。反復イディオム
9146        // `for (let i=0;i<style.length;i++) style.item(i)`。2026-07-17
9147        // 発見・実装)。
9148        (
9149            "var e=document.getElementById('t'); e.style.cssText='color: red; font-size: 12px'; e.style.length",
9150            "2",
9151        ),
9152        (
9153            "var e=document.getElementById('t'); e.style.cssText='color: red; font-size: 12px'; \
9154             e.style.item(0)+','+e.style.item(1)",
9155            "color,font-size",
9156        ),
9157        ("document.getElementById('t').style.length", "0"),
9158        // `style.cssFloat`(`float`プロパティのレガシー別名。丸ごと未対応
9159        // だった。2026-07-17 発見・実装)。
9160        (
9161            "var e=document.getElementById('t'); e.style.cssFloat='left'; e.style.float",
9162            "left",
9163        ),
9164        (
9165            "var e=document.getElementById('t'); e.style.float='right'; e.style.cssFloat",
9166            "right",
9167        ),
9168        // `element.style.cssText`(全プロパティを1つの文字列で読み書きする定番パターン)が
9169        // 丸ごと未対応で、通常のプロパティ名として扱われ常に空文字列になっていた。
9170        (
9171            "var e=document.getElementById('t'); e.style.cssText='color: red; font-size: 12px'; e.style.color+','+e.style.fontSize",
9172            "red,12px",
9173        ),
9174        (
9175            "var e=document.getElementById('t'); e.style.color='blue'; e.style.fontSize='10px'; e.style.cssText",
9176            "color: blue; font-size: 10px",
9177        ),
9178        // innerHTML/outerHTML が丸ごと未対応(innerHTML は textContent と同じ実装を
9179        // 共有しておりマークアップ自体が失われていた)だったバグ。
9180        (
9181            "var e=document.getElementById('t'); e.innerHTML='<b>bold</b>text'; e.innerHTML",
9182            "<b>bold</b>text",
9183        ),
9184        (
9185            "var e=document.getElementById('t'); e.innerHTML='hi'; e.outerHTML",
9186            "<p id=\"t\" class=\"a b\" data-k=\"v\">hi</p>",
9187        ),
9188        // nodeType/nodeName がテキストノードでも常に ELEMENT_NODE(1)/空文字列固定
9189        // だったバグ。childNodes/firstChild/lastChild/nextSibling/previousSibling
9190        // (テキストノードも含む Node レベル走査 API)も丸ごと未対応だった。
9191        (
9192            "var e=document.getElementById('t'); e.innerHTML='a<b>x</b>'; e.childNodes.length+','+e.firstChild.nodeType+','+e.lastChild.nodeType",
9193            "2,3,1",
9194        ),
9195        (
9196            "var e=document.getElementById('t'); e.innerHTML='a<b>x</b>'; e.firstChild.nextSibling.nodeName",
9197            "B",
9198        ),
9199        // `node.nodeValue`(テキストノードは自身のテキスト、要素ノードは仕様どおり
9200        // `null`)が丸ごと未対応だった。代入は要素ノードでは no-op。
9201        (
9202            "var e=document.getElementById('t'); e.innerHTML='hello'; e.firstChild.nodeValue",
9203            "hello",
9204        ),
9205        (
9206            "var e=document.getElementById('t'); e.innerHTML='hello'; e.nodeValue === null",
9207            "true",
9208        ),
9209        (
9210            "var e=document.getElementById('t'); e.innerHTML='hello'; e.firstChild.nodeValue='bye'; e.textContent",
9211            "bye",
9212        ),
9213        // `CharacterData.data`/`.length`/`.appendData`/`.deleteData`/
9214        // `.insertData`/`.replaceData`/`.substringData`(丸ごと未対応
9215        // だった。`nodeValue`は対応済みだったが単体アクセサ`data`と
9216        // 編集用メソッド群は漏れていた。2026-07-16 発見・実装)。
9217        (
9218            "var e=document.getElementById('t'); e.innerHTML='hello'; e.firstChild.data",
9219            "hello",
9220        ),
9221        (
9222            "var e=document.getElementById('t'); e.innerHTML='hello'; e.firstChild.length",
9223            "5",
9224        ),
9225        (
9226            "var e=document.getElementById('t'); e.innerHTML='hello'; e.firstChild.data='world'; e.textContent",
9227            "world",
9228        ),
9229        (
9230            "var e=document.getElementById('t'); e.innerHTML='hello'; e.firstChild.appendData(' world'); e.textContent",
9231            "hello world",
9232        ),
9233        (
9234            "var e=document.getElementById('t'); e.innerHTML='hello world'; e.firstChild.deleteData(5,6); e.textContent",
9235            "hello",
9236        ),
9237        (
9238            "var e=document.getElementById('t'); e.innerHTML='hello'; e.firstChild.insertData(5,' world'); e.textContent",
9239            "hello world",
9240        ),
9241        (
9242            "var e=document.getElementById('t'); e.innerHTML='hello world'; e.firstChild.replaceData(6,5,'there'); e.textContent",
9243            "hello there",
9244        ),
9245        (
9246            "var e=document.getElementById('t'); e.innerHTML='hello world'; e.firstChild.substringData(6,5)",
9247            "world",
9248        ),
9249        // `deleteData`/`insertData`/`replaceData`/`substringData`/`splitText`は
9250        // 仕様上`offset`が`length`を超えると`IndexSizeError`を投げるべきだが、
9251        // 以前は`offset`を黙って`length`へクランプしてしまい、範囲外呼び出しが
9252        // 常に無害なno-op/末尾追記として成立していた(Table DOMの
9253        // `insertRow`等と同じ「範囲外インデックスの黙殺」バグ族)。
9254        (
9255            "var e=document.getElementById('t'); e.innerHTML='hi'; \
9256             try { e.firstChild.deleteData(99,1); 'no-throw' } catch(e) { e.name }",
9257            "IndexSizeError",
9258        ),
9259        (
9260            "var e=document.getElementById('t'); e.innerHTML='hi'; \
9261             try { e.firstChild.insertData(99,'x'); 'no-throw' } catch(e) { e.name }",
9262            "IndexSizeError",
9263        ),
9264        (
9265            "var e=document.getElementById('t'); e.innerHTML='hi'; \
9266             try { e.firstChild.replaceData(99,1,'x'); 'no-throw' } catch(e) { e.name }",
9267            "IndexSizeError",
9268        ),
9269        (
9270            "var e=document.getElementById('t'); e.innerHTML='hi'; \
9271             try { e.firstChild.substringData(99,1); 'no-throw' } catch(e) { e.name }",
9272            "IndexSizeError",
9273        ),
9274        (
9275            "var e=document.getElementById('t'); e.innerHTML='hi'; \
9276             try { e.firstChild.splitText(99); 'no-throw' } catch(e) { e.name }",
9277            "IndexSizeError",
9278        ),
9279        (
9280            // offset===lengthはちょうど境界で範囲内(末尾扱い)なので例外にならない。
9281            "var e=document.getElementById('t'); e.innerHTML='hi'; \
9282             e.firstChild.insertData(2,'!'); e.textContent",
9283            "hi!",
9284        ),
9285        // `Text.splitText(offset)`(丸ごと未対応だった。2026-07-16 発見・
9286        // 実装。テキストノードを分割し、後半を新しい兄弟ノードとして
9287        // 挿入する)。
9288        (
9289            "var e=document.getElementById('t'); e.innerHTML='hello world'; \
9290             var t1=e.firstChild; var t2=t1.splitText(5); t1.data+'|'+t2.data",
9291            "hello| world",
9292        ),
9293        (
9294            "var e=document.getElementById('t'); e.innerHTML='hello world'; \
9295             var t1=e.firstChild; t1.splitText(5); e.childNodes.length",
9296            "2",
9297        ),
9298        (
9299            "var e=document.getElementById('t'); e.innerHTML='hello world'; \
9300             var t1=e.firstChild; var t2=t1.splitText(5); t2.nextSibling===null && t2.previousSibling===t1",
9301            "true",
9302        ),
9303        // `Text.wholeText`(丸ごと未対応だった。`splitText`と対をなす読み
9304        // 取りプロパティ。2026-07-16 発見・実装。連続するテキストノード
9305        // 兄弟の`data`を全て連結して返す)。
9306        (
9307            "var e=document.getElementById('t'); e.innerHTML='hello world'; \
9308             var t1=e.firstChild; var t2=t1.splitText(5); t1.wholeText+'|'+t2.wholeText",
9309            "hello world|hello world",
9310        ),
9311        (
9312            "var e=document.getElementById('t'); e.innerHTML='hello'; e.firstChild.wholeText",
9313            "hello",
9314        ),
9315        // HTML5 Table DOM(`table.insertRow`/`.deleteRow`/`.rows`、
9316        // `tr.insertCell`/`.deleteCell`/`.cells`、`.rowIndex`/`.cellIndex`)が
9317        // 丸ごと未対応だった(2026-07-17 発見・実装)。
9318        (
9319            "var t=document.createElement('table'); \
9320             t.insertRow(); t.insertRow(); t.rows.length",
9321            "2",
9322        ),
9323        (
9324            "var t=document.createElement('table'); var r=t.insertRow(); r.insertCell(); r.insertCell(); \
9325             r.cells.length",
9326            "2",
9327        ),
9328        (
9329            "var t=document.createElement('table'); \
9330             var r0=t.insertRow(); var r1=t.insertRow(); var rmid=t.insertRow(1); \
9331             rmid===t.rows[1]",
9332            "true",
9333        ),
9334        (
9335            "var t=document.createElement('table'); t.insertRow(); t.insertRow(); t.deleteRow(0); \
9336             t.rows.length",
9337            "1",
9338        ),
9339        (
9340            "var t=document.createElement('table'); var r=t.insertRow(); \
9341             r.insertCell(); var mid=r.insertCell(); r.insertCell(); \
9342             mid===r.cells[1]",
9343            "true",
9344        ),
9345        (
9346            "var t=document.createElement('table'); var r=t.insertRow(); r.insertCell(); r.insertCell(); \
9347             r.deleteCell(0); r.cells.length",
9348            "1",
9349        ),
9350        (
9351            "var t=document.createElement('table'); t.insertRow(); var r=t.insertRow(); r.rowIndex",
9352            "1",
9353        ),
9354        (
9355            "var t=document.createElement('table'); var r=t.insertRow(); r.insertCell(); var c=r.insertCell(); c.cellIndex",
9356            "1",
9357        ),
9358        // `insertRow`/`deleteRow`/`insertCell`/`deleteCell`は仕様上、範囲外の
9359        // インデックス(`-1`未満、または`insertRow`/`insertCell`なら
9360        // `length`超過、`deleteRow`/`deleteCell`なら`length`以上)で
9361        // `IndexSizeError`を投げるべきだが、以前は範囲外の値をすべて
9362        // 「末尾へ追加」/「末尾を削除」として黙って受け入れてしまっていた。
9363        (
9364            "var t=document.createElement('table'); t.insertRow(); \
9365             try { t.insertRow(5); 'no-throw' } catch(e) { e.name }",
9366            "IndexSizeError",
9367        ),
9368        (
9369            "var t=document.createElement('table'); t.insertRow(); \
9370             try { t.deleteRow(5); 'no-throw' } catch(e) { e.name }",
9371            "IndexSizeError",
9372        ),
9373        (
9374            "var t=document.createElement('table'); var r=t.insertRow(); r.insertCell(); \
9375             try { r.insertCell(5); 'no-throw' } catch(e) { e.name }",
9376            "IndexSizeError",
9377        ),
9378        (
9379            "var t=document.createElement('table'); var r=t.insertRow(); r.insertCell(); \
9380             try { r.deleteCell(5); 'no-throw' } catch(e) { e.name }",
9381            "IndexSizeError",
9382        ),
9383        (
9384            // `insertRow(length)`(末尾追加)と`insertRow(-1)`(同じく末尾追加)は
9385            // 範囲内なので従来どおり例外にならない。
9386            "var t=document.createElement('table'); t.insertRow(); \
9387             t.insertRow(1); t.insertRow(-1); t.rows.length",
9388            "3",
9389        ),
9390        // `tr.sectionRowIndex`(丸ごと未対応だった。`rowIndex`は実装済み
9391        // なのに対になるこちらだけ抜けていた兄弟ギャップ。2026-07-17
9392        // 発見・実装)。`thead`2行+`tbody`3行の表で、`tbody`側2行目
9393        // (テーブル全体では4番目=`rowIndex:3`)の`sectionRowIndex`は
9394        // `tbody`内での位置`1`(0始まり)になる。
9395        (
9396            "var t=document.createElement('table'); \
9397             var h=t.createTHead(); h.insertRow(); h.insertRow(); \
9398             var b=document.createElement('tbody'); t.appendChild(b); \
9399             b.insertRow(); var r=b.insertRow(); b.insertRow(); \
9400             r.rowIndex + ',' + r.sectionRowIndex",
9401            "3,1",
9402        ),
9403        // `HTMLTableSectionElement.insertRow`/`.rows`(丸ごと未対応だった。
9404        // `table.insertRow`は実装済みなのに対になるこちらだけ抜けていた
9405        // 兄弟ギャップ。`tbody`自身が持つ`insertRow`/`.rows`はそのセクション
9406        // 内に限定される。2026-07-17 発見・実装)。
9407        (
9408            "var t=document.createElement('table'); var b=document.createElement('tbody'); \
9409             t.appendChild(b); b.insertRow(); b.insertRow(); b.rows.length",
9410            "2",
9411        ),
9412        // `thead`/`tbody`ラッパー無しで直接`table`に`insertRow`した場合は
9413        // `rowIndex`と`sectionRowIndex`が一致する。
9414        (
9415            "var t=document.createElement('table'); t.insertRow(); var r=t.insertRow(); \
9416             r.rowIndex + ',' + r.sectionRowIndex",
9417            "1,1",
9418        ),
9419        // `table.tHead`/`.tFoot`/`.caption`/`.tBodies`/`.createTHead()`/
9420        // `.createTFoot()`/`.createCaption()`/`.delete*()`(丸ごと未対応
9421        // だった。2026-07-17 発見・実装。「既存要素があれば返す、無ければ
9422        // 新規作成」の冪等な動作)。
9423        ("document.createElement('table').tHead", "null"),
9424        (
9425            "var t=document.createElement('table'); var h=t.createTHead(); h===t.tHead && h.tagName",
9426            "THEAD",
9427        ),
9428        (
9429            "var t=document.createElement('table'); var h1=t.createTHead(); var h2=t.createTHead(); h1===h2",
9430            "true",
9431        ),
9432        (
9433            "var t=document.createElement('table'); t.createTHead(); t.deleteTHead(); t.tHead",
9434            "null",
9435        ),
9436        (
9437            "var t=document.createElement('table'); var f=t.createTFoot(); f===t.tFoot && f.tagName",
9438            "TFOOT",
9439        ),
9440        (
9441            "var t=document.createElement('table'); var c=t.createCaption(); c===t.caption && c.tagName",
9442            "CAPTION",
9443        ),
9444        (
9445            "var t=document.createElement('table'); t.appendChild(document.createElement('tbody')); \
9446             t.appendChild(document.createElement('tbody')); t.tBodies.length",
9447            "2",
9448        ),
9449        // `node.isConnected`(click-outside 判定等で使われる)が丸ごと未対応だった。
9450        (
9451            "document.createElement('div').isConnected",
9452            "false",
9453        ),
9454        (
9455            "document.getElementById('t').isConnected",
9456            "true",
9457        ),
9458        (
9459            "var e=document.getElementById('t'); e.remove(); e.isConnected",
9460            "false",
9461        ),
9462        // `Node.ELEMENT_NODE`/`Node.TEXT_NODE`(`if (node.nodeType === Node.
9463        // ELEMENT_NODE)` という定番パターンで使われる標準定数)が丸ごと未対応
9464        // だった(グローバル `Node` 自体が存在しなかった)。
9465        (
9466            "document.createElement('div').nodeType === Node.ELEMENT_NODE",
9467            "true",
9468        ),
9469        ("Node.TEXT_NODE", "3"),
9470        ("Node.COMMENT_NODE", "8"),
9471        ("var c=document.createComment('test'); c.nodeType", "8"),
9472        ("var c=document.createComment('test'); c.nodeName", "#comment"),
9473        ("var c=document.createComment('test'); c.nodeValue", "test"),
9474        ("var c=document.createComment('test'); c.data", "test"),
9475        ("var c=document.createComment('test'); c.length", "4"),
9476        ("var c=document.createComment('test'); c.nodeValue='new'; c.nodeValue", "new"),
9477        ("var c=document.createComment('test'); c.data='new'; c.data", "new"),
9478        ("var c=document.createComment('test'); c.textContent", "test"),
9479        ("var c=document.createComment('test'); c.textContent='new'; c.textContent", "new"),
9480        (
9481            "var d=document.createElement('div'); var c=document.createComment('foo'); d.appendChild(c); d.innerHTML",
9482            "<!--foo-->",
9483        ),
9484        (
9485            "var t=document.getElementById('t'); var s=document.createElement('style'); s.textContent='div { color: red; }'; t.appendChild(s); var sheet=document.styleSheets[0]; sheet.cssRules.length",
9486            "1",
9487        ),
9488        (
9489            "var t=document.getElementById('t'); var s=document.createElement('style'); s.textContent='div { color: red; }'; t.appendChild(s); var sheet=document.styleSheets[0]; sheet.cssRules[0].cssText",
9490            "div { color: red; }",
9491        ),
9492        (
9493            "var t=document.getElementById('t'); var s=document.createElement('style'); s.textContent='div { color: red; }'; t.appendChild(s); var sheet=document.styleSheets[0]; sheet.cssRules[0].selectorText",
9494            "div",
9495        ),
9496        (
9497            "var t=document.getElementById('t'); var s=document.createElement('style'); s.textContent='div { color: red; }'; t.appendChild(s); var sheet=document.styleSheets[0]; sheet.insertRule('span { color: blue; }', 1); sheet.cssRules.length",
9498            "2",
9499        ),
9500        (
9501            "var t=document.getElementById('t'); var s=document.createElement('style'); s.textContent='div { color: red; }'; t.appendChild(s); var sheet=document.styleSheets[0]; sheet.insertRule('span { color: blue; }', 1); sheet.cssRules[1].cssText",
9502            "span { color: blue; }",
9503        ),
9504        (
9505            "var t=document.getElementById('t'); var s=document.createElement('style'); s.textContent='div { color: red; }'; t.appendChild(s); var sheet=document.styleSheets[0]; sheet.insertRule('span { color: blue; }', 1); sheet.deleteRule(0); sheet.cssRules.length",
9506            "1",
9507        ),
9508        (
9509            "var t=document.getElementById('t'); var s=document.createElement('style'); s.textContent='div { color: red; }'; t.appendChild(s); var sheet=document.styleSheets[0]; sheet.insertRule('span { color: blue; }', 1); sheet.deleteRule(0); sheet.cssRules[0].cssText",
9510            "span { color: blue; }",
9511        ),
9512        // `document.title` が常に install 時の空文字列固定で `<title>` 要素の中身/
9513        // 代入結果と一切連動していなかったバグ。ここでは `<head>` 自体が無い状態
9514        // (フレッシュな JsRuntime)での内部プロパティへのフォールバック保存/読み出し
9515        // を確認する(`<head>`/`<title>` 実要素との連動は別ブロックで確認)。
9516        ("document.title = 'Hello'; document.title", "Hello"),
9517        // `element.lang`/`.dir`(グローバル属性の JS プロパティ版)が他の属性直結
9518        // プロパティ群の点検から漏れて丸ごと未対応だった。
9519        (
9520            "var e=document.createElement('p'); e.lang='ja'; e.lang",
9521            "ja",
9522        ),
9523        (
9524            "var e=document.createElement('p'); e.dir='rtl'; e.dir",
9525            "rtl",
9526        ),
9527        (
9528            "var e=document.createElement('p'); e.setAttribute('lang','fr'); e.lang",
9529            "fr",
9530        ),
9531        // `element.title`/`.accessKey`/`.translate`(同じ理由で丸ごと未対応
9532        // だった。未マッチキーは巨大 match の末尾 `_ => Value::Undefined`
9533        // に落ちるだけで汎用フォールバックが無いため常に `undefined` に
9534        // なっていた。2026-07-16 発見・実装)。
9535        (
9536            "var e=document.createElement('p'); e.title='tip'; e.title",
9537            "tip",
9538        ),
9539        (
9540            "var e=document.createElement('p'); e.setAttribute('title','x'); e.title",
9541            "x",
9542        ),
9543        (
9544            "var e=document.createElement('p'); e.accessKey='k'; e.getAttribute('accesskey')",
9545            "k",
9546        ),
9547        // `translate` は既定 `true`、`translate=\"no\"` の時のみ `false`。
9548        ("document.createElement('p').translate", "true"),
9549        (
9550            "var e=document.createElement('p'); e.setAttribute('translate','no'); e.translate",
9551            "false",
9552        ),
9553        (
9554            "var e=document.createElement('p'); e.translate=false; e.getAttribute('translate')",
9555            "no",
9556        ),
9557        // `element.draggable`(丸ごと未対応だった。2026-07-16 発見・実装。
9558        // 明示指定が無ければ既定 `false` の簡略実装)。
9559        ("document.createElement('div').draggable", "false"),
9560        (
9561            "var e=document.createElement('div'); e.draggable=true; e.getAttribute('draggable')",
9562            "true",
9563        ),
9564        (
9565            "var e=document.createElement('div'); e.setAttribute('draggable','true'); e.draggable",
9566            "true",
9567        ),
9568        // `element.slot`(named slot 割り当て名。丸ごと未対応だった。
9569        // 2026-07-16 発見・実装)。
9570        (
9571            "var e=document.createElement('div'); e.slot='header'; e.getAttribute('slot')",
9572            "header",
9573        ),
9574        // DOM コンストラクタ階層 (Node -> Element -> HTMLElement -> HTMLXxxElement)
9575        // および `instanceof` / `.constructor` 連携の自己テスト
9576        (
9577            "document.createElement('div') instanceof HTMLDivElement",
9578            "true",
9579        ),
9580        (
9581            "document.createElement('div') instanceof HTMLElement",
9582            "true",
9583        ),
9584        (
9585            "document.createElement('div') instanceof Element",
9586            "true",
9587        ),
9588        (
9589            "document.createElement('div') instanceof Node",
9590            "true",
9591        ),
9592        (
9593            "document.createElement('div') instanceof HTMLInputElement",
9594            "false",
9595        ),
9596        (
9597            "document.createElement('input') instanceof HTMLInputElement",
9598            "true",
9599        ),
9600        (
9601            "document.createElement('input') instanceof HTMLElement",
9602            "true",
9603        ),
9604        (
9605            "document.createElement('form') instanceof HTMLFormElement",
9606            "true",
9607        ),
9608        (
9609            "document.createElement('div').constructor === HTMLDivElement",
9610            "true",
9611        ),
9612        (
9613            "try { new Node(); false; } catch(e) { e instanceof TypeError }",
9614            "true",
9615        ),
9616        (
9617            "try { new HTMLElement(); false; } catch(e) { e instanceof TypeError }",
9618            "true",
9619        ),
9620        (
9621            "var e=document.createElement('div'); e.setAttribute('slot','footer'); e.slot",
9622            "footer",
9623        ),
9624        // `element.tabIndex`(`tabindex` 属性の数値プロパティ版)も同じ理由で
9625        // 丸ごと未対応だった。未指定時の既定値は `-1`。
9626        (
9627            "document.createElement('div').tabIndex",
9628            "-1",
9629        ),
9630        (
9631            "var e=document.createElement('div'); e.tabIndex=3; e.tabIndex",
9632            "3",
9633        ),
9634        (
9635            "var e=document.createElement('div'); e.tabIndex=2; e.getAttribute('tabindex')",
9636            "2",
9637        ),
9638        // `element.hidden = true/false`(要素の表示/非表示切替の定番イディオム)の
9639        // setter が丸ごと未対応だった(getter は既に対応済み)。
9640        (
9641            "var e=document.createElement('div'); e.hidden=true; e.hidden",
9642            "true",
9643        ),
9644        (
9645            "var e=document.createElement('div'); e.hidden=true; e.hasAttribute('hidden')",
9646            "true",
9647        ),
9648        (
9649            "var e=document.createElement('div'); e.hidden=true; e.hidden=false; e.hidden",
9650            "false",
9651        ),
9652        // `form.noValidate`(`novalidate` 属性の camelCase プロパティ版)が丸ごと
9653        // 未対応だった。
9654        (
9655            "var f=document.createElement('form'); f.noValidate=true; f.noValidate",
9656            "true",
9657        ),
9658        (
9659            "var f=document.createElement('form'); f.noValidate=true; f.hasAttribute('novalidate')",
9660            "true",
9661        ),
9662        (
9663            "document.createElement('form').noValidate",
9664            "false",
9665        ),
9666        // `form.elements`(全フォームコントロールを走査する定番イディオム)が丸ごと
9667        // 未対応だった。
9668        (
9669            "var f=document.createElement('form'); var i=document.createElement('input'); f.appendChild(i); f.elements.length",
9670            "1",
9671        ),
9672        (
9673            "var f=document.createElement('form'); var i=document.createElement('input'); i.name='x'; f.appendChild(i); f.elements[0].name",
9674            "x",
9675        ),
9676        // `form.length`(`form.elements.length`と同じ値を返すIDL属性の数値
9677        // ショートハンド。`select.length`の対になる`<form>`側だが丸ごと
9678        // 未対応だった)。
9679        (
9680            "var f=document.createElement('form'); var i=document.createElement('input'); \
9681             var s=document.createElement('select'); f.appendChild(i); f.appendChild(s); \
9682             f.length + ',' + f.elements.length",
9683            "2,2",
9684        ),
9685        (
9686            "document.createElement('form').length",
9687            "0",
9688        ),
9689        // `fieldset.elements`(`HTMLFieldSetElement`のIDLプロパティ。丸ごと
9690        // 未対応だった。`form.elements`と異なり純粋なDOM子孫のみが対象。
9691        // 2026-07-17 発見・実装)。
9692        (
9693            "var fs=document.createElement('fieldset'); var i=document.createElement('input'); \
9694             fs.appendChild(i); fs.elements.length",
9695            "1",
9696        ),
9697        (
9698            "document.createElement('fieldset').elements.length",
9699            "0",
9700        ),
9701        // `fieldset.type`(仕様上、属性値に関わらず常に固定文字列
9702        // `"fieldset"`を返す読み取り専用IDLプロパティ。丸ごと未対応
9703        // だった。2026-07-17 発見・実装)。
9704        ("document.createElement('fieldset').type", "fieldset"),
9705        (
9706            "var fs=document.createElement('fieldset'); fs.setAttribute('type','x'); fs.type",
9707            "fieldset",
9708        ),
9709        // `select.type`(仕様上、`multiple`属性の有無で`"select-multiple"`/
9710        // `"select-one"`のいずれか固定文字列を返す読み取り専用IDL
9711        // プロパティ。`fieldset.type`と同じ理由で丸ごと未対応だった。
9712        // 2026-07-17 発見・実装)。
9713        ("document.createElement('select').type", "select-one"),
9714        (
9715            "var s=document.createElement('select'); s.multiple=true; s.type",
9716            "select-multiple",
9717        ),
9718        // `button.type`(`type`属性が無いか不正な値なら既定`"submit"`に
9719        // フォールバックする。`fieldset.type`/`select.type`と同じ理由で
9720        // 丸ごと未対応だった。`if (btn.type === 'submit')`という定番
9721        // チェックが常に偽になる実害があった。2026-07-17 発見・実装)。
9722        ("document.createElement('button').type", "submit"),
9723        // `textarea.type`(仕様上、属性値に関わらず常に固定文字列
9724        // `"textarea"`を返す読み取り専用IDLプロパティ。`fieldset.type`と
9725        // 同じ理由で丸ごと未対応だった。2026-07-17 発見・実装)。
9726        ("document.createElement('textarea').type", "textarea"),
9727        (
9728            "var b=document.createElement('button'); b.setAttribute('type','reset'); b.type",
9729            "reset",
9730        ),
9731        (
9732            "var b=document.createElement('button'); b.setAttribute('type','button'); b.type",
9733            "button",
9734        ),
9735        (
9736            "var b=document.createElement('button'); b.setAttribute('type','bogus'); b.type",
9737            "submit",
9738        ),
9739        // `input.type`(`type`属性が無いか既知の列挙値以外なら既定
9740        // `"text"`にフォールバックする。`fieldset.type`/`select.type`/
9741        // `button.type`と同じ理由で丸ごと未対応だった。全入力系IDL
9742        // プロパティの中で最も広く参照される`.type`が常に空文字列に
9743        // なっていた実害の大きいバグ。2026-07-17 発見・実装)。
9744        ("document.createElement('input').type", "text"),
9745        (
9746            "var i=document.createElement('input'); i.setAttribute('type','checkbox'); i.type",
9747            "checkbox",
9748        ),
9749        (
9750            "var i=document.createElement('input'); i.setAttribute('type','DATE'); i.type",
9751            "date",
9752        ),
9753        (
9754            "var i=document.createElement('input'); i.setAttribute('type','bogus'); i.type",
9755            "text",
9756        ),
9757        // `form.elements`が`form="formId"`属性によるフォーム外関連付け
9758        // (HTML5仕様の「form owner」)を反映していなかった兄弟ギャップの
9759        // 自己テストは、この配列が`(&str, &str)`(HTML fixtureを持たない)
9760        // 型のため3要素タプルでは追加できない。別途、独自のHTML fixtureを
9761        // 持つ`fd2_cases`(本ファイル内。`FormData`のform owner対応テストと
9762        // 同じfixtureを再利用)に追加してある。
9763        // `input.form`(自身が属する `<form>` への逆参照)が丸ごと未対応だった。
9764        (
9765            "var f=document.createElement('form'); f.id='ff'; var i=document.createElement('input'); f.appendChild(i); i.form.id",
9766            "ff",
9767        ),
9768        (
9769            "document.createElement('input').form === null",
9770            "true",
9771        ),
9772        // `input.labels`(`for` 属性の明示的な関連付けと、`<label>` 子孫の暗黙の
9773        // 関連付けの両方)が丸ごと未対応だった。
9774        (
9775            "var i=document.createElement('input'); i.id='u'; var l=document.createElement('label'); l.setAttribute('for','u'); i.labels.length",
9776            "1",
9777        ),
9778        (
9779            "var l=document.createElement('label'); var i=document.createElement('input'); l.appendChild(i); i.labels.length",
9780            "1",
9781        ),
9782        (
9783            "document.createElement('input').labels.length",
9784            "0",
9785        ),
9786        // 【2026-11-18】`labels` は labelable な要素だけ。div・カスタム要素には無く、
9787        // `in` も偽(YouTube の無害化が組込み扱いして `labels="[object Object]"` を報告していた)。
9788        (
9789            "var d=document.createElement('div'); ('labels' in d) + ',' + (d.labels === undefined) + ',' + ('labels' in document.createElement('input'))",
9790            "false,true,true",
9791        ),
9792        (
9793            "var d=document.createElement('x-lbl'); d.labels={a:1}; d.getAttribute('labels') + ',' + d.labels.a",
9794            "null,1",
9795        ),
9796        // `label.control`(`labels` の逆方向)が丸ごと未対応だった。
9797        (
9798            "var i=document.createElement('input'); i.id='v'; var l=document.createElement('label'); l.setAttribute('for','v'); l.control.id",
9799            "v",
9800        ),
9801        (
9802            "var l=document.createElement('label'); var i=document.createElement('input'); i.name='y'; l.appendChild(i); l.control.name",
9803            "y",
9804        ),
9805        (
9806            "document.createElement('label').control === null",
9807            "true",
9808        ),
9809        // `node.contains(other)`(click-outside 判定等で広く使われる)が丸ごと
9810        // 未対応だった。
9811        (
9812            "var w=document.getElementById('wrap'); var t=document.getElementById('t'); w.contains(t)+','+t.contains(w)+','+t.contains(t)",
9813            "true,false,true",
9814        ),
9815        // `Node.compareDocumentPosition(other)` が丸ごと未対応だった(`contains()` はあったが
9816        // 兄弟同士の前後関係や祖先/子孫の判定を1回のビットマスクで得る標準APIが欠落)。
9817        (
9818            "var t=document.getElementById('t'); t.compareDocumentPosition(t)",
9819            "0",
9820        ),
9821        (
9822            "var w=document.getElementById('wrap'); var t=document.getElementById('t'); t.compareDocumentPosition(w)",
9823            "10",
9824        ),
9825        (
9826            "var w=document.getElementById('wrap'); var t=document.getElementById('t'); w.compareDocumentPosition(t)",
9827            "20",
9828        ),
9829        (
9830            "var t=document.getElementById('t'); var s=document.getElementById('s'); t.compareDocumentPosition(s)",
9831            "4",
9832        ),
9833        (
9834            "var t=document.getElementById('t'); var s=document.getElementById('s'); s.compareDocumentPosition(t)",
9835            "2",
9836        ),
9837        // `element.click()` が単なる no-op で、実際のクリック(登録済みリスナの発火)を
9838        // 一切引き起こさなかったバグ(プログラム的クリックはテストコードで広く使われる
9839        // 定番パターン)。
9840        (
9841            "var e=document.getElementById('t'); var clicked=false; e.addEventListener('click', function(){ clicked=true; }); e.click(); clicked",
9842            "true",
9843        ),
9844        // `document.scrollingElement`(HTML5。丸ごと未対応だった。標準準拠
9845        // モードでは `documentElement`(`<html>`)と同じ要素を返す仕様)。
9846        ("document.scrollingElement.tagName", "HTML"),
9847        ("document.scrollingElement === document.documentElement", "true"),
9848        // `document.activeElement`/`element.focus()`/`.blur()`(HTML5。丸ごと
9849        // 未対応だった。以前は `activeElement` が常に `null` 固定、
9850        // `.focus()`/`.blur()` 自体が丸ごと存在しなかった)。
9851        (
9852            "document.getElementById('t').focus(); document.activeElement.id",
9853            "t",
9854        ),
9855        (
9856            "document.getElementById('t').focus(); document.getElementById('t') === document.activeElement",
9857            "true",
9858        ),
9859        (
9860            "document.getElementById('t').focus(); document.getElementById('s').focus(); document.activeElement.id",
9861            "s",
9862        ),
9863        (
9864            "document.getElementById('t').focus(); document.getElementById('t').blur(); \
9865             document.getElementById('t') === document.activeElement",
9866            "false",
9867        ),
9868        (
9869            "var log=''; document.getElementById('t').addEventListener('focus', ()=>log+='f'); \
9870             document.getElementById('t').addEventListener('blur', ()=>log+='b'); \
9871             document.getElementById('t').focus(); document.getElementById('s').focus(); log",
9872            "fb",
9873        ),
9874        (
9875            "var n=0; document.getElementById('t').addEventListener('focus', ()=>n++); \
9876             document.getElementById('t').focus(); document.getElementById('t').focus(); n",
9877            "1",
9878        ),
9879    ];
9880    total += dom2_cases.len();
9881    for (src, expect) in dom2_cases {
9882        let mut rt = JsRuntime::new();
9883        rt.dom()
9884            .borrow_mut()
9885            .build_from(&crate::os_lib::dom::parse_html(dom2_html));
9886        match rt.eval(src) {
9887            Ok(v) if &v.to_js_string() == expect => passed += 1,
9888            Ok(v) => crate::println!(
9889                "JS_SELFTEST FAIL: `{}` => `{}` (want `{}`)",
9890                src,
9891                v.to_js_string(),
9892                expect
9893            ),
9894            Err(e) => crate::println!("JS_SELFTEST ERR:  `{}` => {}", src, e),
9895        }
9896    }
9897    // ===== DOM イベントシステム(Phase 3+)=====
9898    // addEventListener / removeEventListener / dispatchEvent と Event オブジェクトの
9899    // 伝播(capture→target→bubble)、preventDefault / stopPropagation /
9900    // stopImmediatePropagation / once / target・currentTarget を JS 層から検証する。
9901    // dispatchEvent はホストの dispatch_key/dispatch_mouse と同じ dispatch_event_in_interp を
9902    // 通るため、ここで伝播ロジック全体を決定論的にカバーできる。
9903    let ev_html = "<div id='outer'><div id='mid'><button id='btn'>go</button></div></div>";
9904    let event_cases: &[(&str, &str)] = &[
9905        // 基本: addEventListener したリスナが dispatchEvent で発火する。
9906        ("var n=0; var b=document.getElementById('btn'); b.addEventListener('click', function(){ n++; }); b.dispatchEvent({type:'click'}); n", "1"),
9907        // 同一要素に複数リスナ → 登録順に全て発火。
9908        ("var s=''; var b=document.getElementById('btn'); b.addEventListener('click', ()=>s+='a'); b.addEventListener('click', ()=>s+='b'); b.dispatchEvent({type:'click'}); s", "ab"),
9909        // removeEventListener で解除したリスナは発火しない。
9910        ("var n=0; var f=()=>n++; var b=document.getElementById('btn'); b.addEventListener('click', f); b.removeEventListener('click', f); b.dispatchEvent({type:'click'}); n", "0"),
9911        // バブリング: button で発火 → 祖先 mid / outer の click リスナも発火。
9912        ("var s=''; document.getElementById('outer').addEventListener('click', ()=>s+='O'); document.getElementById('mid').addEventListener('click', ()=>s+='M'); document.getElementById('btn').addEventListener('click', ()=>s+='B'); document.getElementById('btn').dispatchEvent({type:'click', bubbles:true}); s", "BMO"),
9913        // event.target は発火元、currentTarget は処理中の要素(バブリング中は祖先)。
9914        ("var t=''; document.getElementById('outer').addEventListener('click', function(e){ t = e.target.id + '/' + e.currentTarget.id; }); document.getElementById('btn').dispatchEvent({type:'click', bubbles:true}); t", "btn/outer"),
9915        // stopPropagation: button のリスナで止めると祖先には伝わらない。
9916        ("var s=''; document.getElementById('outer').addEventListener('click', ()=>s+='O'); document.getElementById('btn').addEventListener('click', function(e){ s+='B'; e.stopPropagation(); }); document.getElementById('btn').dispatchEvent({type:'click', bubbles:true}); s", "B"),
9917        // stopImmediatePropagation: 同一要素の後続リスナも止める。
9918        ("var s=''; var b=document.getElementById('btn'); b.addEventListener('click', function(e){ s+='1'; e.stopImmediatePropagation(); }); b.addEventListener('click', ()=>s+='2'); b.dispatchEvent({type:'click'}); s", "1"),
9919        // preventDefault → dispatchEvent は false を返す(defaultPrevented)。
9920        ("var b=document.getElementById('btn'); b.addEventListener('click', e=>e.preventDefault()); b.dispatchEvent({type:'click'})", "false"),
9921        // preventDefault しなければ dispatchEvent は true を返す。
9922        ("var b=document.getElementById('btn'); b.addEventListener('click', ()=>{}); b.dispatchEvent({type:'click'})", "true"),
9923        // e.defaultPrevented フラグが preventDefault 後に true。
9924        ("var d=false; var b=document.getElementById('btn'); b.addEventListener('click', function(e){ e.preventDefault(); d=e.defaultPrevented; }); b.dispatchEvent({type:'click'}); d", "true"),
9925        // once: true のリスナは 1 回だけ発火し、2 回目は無視される。
9926        ("var n=0; var b=document.getElementById('btn'); b.addEventListener('click', ()=>n++, {once:true}); b.dispatchEvent({type:'click'}); b.dispatchEvent({type:'click'}); n", "1"),
9927        // capture フェーズ: 祖先の capture リスナは target より先に発火。
9928        ("var s=''; document.getElementById('outer').addEventListener('click', ()=>s+='C', true); document.getElementById('btn').addEventListener('click', ()=>s+='T'); document.getElementById('btn').dispatchEvent({type:'click', bubbles:true}); s", "CT"),
9929        // event.type が正しく渡る。
9930        ("var ty=''; var b=document.getElementById('btn'); b.addEventListener('custom', function(e){ ty=e.type; }); b.dispatchEvent({type:'custom'}); ty", "custom"),
9931        // カスタムプロパティ(detail 等)がリスナ側へ転送される。
9932        ("var d=0; var b=document.getElementById('btn'); b.addEventListener('ping', function(e){ d=e.detail; }); b.dispatchEvent({type:'ping', detail:7}); d", "7"),
9933        // 異なるイベント型のリスナは発火しない。
9934        ("var n=0; var b=document.getElementById('btn'); b.addEventListener('mouseover', ()=>n++); b.dispatchEvent({type:'click'}); n", "0"),
9935        // バブリングフラグ未指定でも、本エンジンは委譲(イベント委譲)を成立させるため
9936        // 祖先のリスナも発火する設計(blur/focus を親で受ける UI を許容)。
9937        ("var s=''; document.getElementById('outer').addEventListener('foo', ()=>s+='O'); document.getElementById('btn').addEventListener('foo', ()=>s+='B'); document.getElementById('btn').dispatchEvent({type:'foo'}); s", "BO"),
9938        // `document.addEventListener('click', fn)` によるイベント委譲パターンが
9939        // 丸ごと未対応だった(`document` は `self.dom().nodes` の一員ではないため
9940        // 祖先チェーンに一切含まれず、`click`等の汎用種別は登録すら黙って
9941        // 捨てられていた。2026-07-16 発見・実装)。要素からバブリングした
9942        // クリックが `document` レベルのリスナまで届くことを確認。
9943        ("var s=''; document.addEventListener('click', ()=>s+='D'); document.getElementById('btn').addEventListener('click', ()=>s+='B'); document.getElementById('btn').dispatchEvent({type:'click', bubbles:true}); s", "BD"),
9944        // `stopPropagation()` すれば document レベルへは届かない。
9945        ("var s=''; document.addEventListener('click', ()=>s+='D'); document.getElementById('btn').addEventListener('click', function(e){ s+='B'; e.stopPropagation(); }); document.getElementById('btn').dispatchEvent({type:'click', bubbles:true}); s", "B"),
9946        // document.removeEventListener('click', fn) で解除できる。
9947        ("var n=0; var f=()=>n++; document.addEventListener('click', f); document.removeEventListener('click', f); document.getElementById('btn').dispatchEvent({type:'click', bubbles:true}); n", "0"),
9948        // document 側でも e.target は発火元要素、currentTarget は document 自身。
9949        ("var r=''; document.addEventListener('click', function(e){ r = e.target.id + '/' + (e.currentTarget === document); }); document.getElementById('btn').dispatchEvent({type:'click', bubbles:true}); r", "btn/true"),
9950        // `document.dispatchEvent(new Event('click'))` で document 自身から直接
9951        // 合成発火することもできる(実DOM要素を経由しない経路)。
9952        ("var n=0; document.addEventListener('click', ()=>n++); document.dispatchEvent(new Event('click')); n", "1"),
9953        // `document.addEventListener(type, fn, {capture:true})` がキャプチャ
9954        // フェーズを一切扱えないバグ(丸ごと未対応だった。`document` の汎用
9955        // リスナは `event_target_add_event_listener` を再利用しており、
9956        // `capture` オプションは元々「DOM ツリーを持たないクラスでは無意味」
9957        // として即座に破棄されていた。`document` に対して再利用したことで
9958        // 意味が変わり、キャプチャ登録が黙ってバブル扱いになっていた。
9959        // 2026-07-16 発見・実装)。document の capture リスナは祖先の
9960        // capture リスナより先(最も外側)に発火する。
9961        ("var s=''; document.addEventListener('click', ()=>s+='D', true); document.getElementById('outer').addEventListener('click', ()=>s+='O', true); document.getElementById('btn').addEventListener('click', ()=>s+='B'); document.getElementById('btn').dispatchEvent({type:'click', bubbles:true}); s", "DOB"),
9962        // capture 登録は bubble フェーズでは発火しない(両方登録すれば両方発火)。
9963        ("var s=''; document.addEventListener('click', ()=>s+='C', true); document.addEventListener('click', ()=>s+='B'); document.getElementById('btn').dispatchEvent({type:'click', bubbles:true}); s", "CB"),
9964    ];
9965    total += event_cases.len();
9966    for (src, expect) in event_cases {
9967        let mut rt = JsRuntime::new();
9968        rt.dom()
9969            .borrow_mut()
9970            .build_from(&crate::os_lib::dom::parse_html(ev_html));
9971        match rt.eval(src) {
9972            Ok(v) if &v.to_js_string() == expect => passed += 1,
9973            Ok(v) => crate::println!(
9974                "JS_SELFTEST FAIL: `{}` => `{}` (want `{}`)",
9975                src,
9976                v.to_js_string(),
9977                expect
9978            ),
9979            Err(e) => crate::println!("JS_SELFTEST ERR:  `{}` => {}", src, e),
9980        }
9981    }
9982
9983    // FormData(form): <form> 配下のコントロールから値を収集(DOM 必須)。
9984    {
9985        let fd_html = "<form id='f'>\
9986            <input name='user' value='alice'>\
9987            <input name='nope'>\
9988            <input type='checkbox' name='agree' value='yes' checked>\
9989            <input type='checkbox' name='news' value='1'>\
9990            <input type='radio' name='plan' value='free'>\
9991            <input type='radio' name='plan' value='pro' checked>\
9992            <input type='submit' name='btn' value='go'>\
9993            <select name='color' value='green'><option value='red'>R</option><option value='green'>G</option></select>\
9994            <textarea name='bio'>hello</textarea>\
9995        </form>";
9996        let fd_cases: &[(&str, &str)] = &[
9997            // user=alice, agree=yes(checked), plan=pro(checked radio), color=green, bio=hello。
9998            // nope は name はあるが value 空 → 空値で含まれる。news/free は未チェックで除外。submit は除外。
9999            (
10000                "new FormData(document.getElementById('f')).get('user')",
10001                "alice",
10002            ),
10003            (
10004                "new FormData(document.getElementById('f')).get('agree')",
10005                "yes",
10006            ),
10007            (
10008                "new FormData(document.getElementById('f')).get('plan')",
10009                "pro",
10010            ),
10011            (
10012                "var f=new FormData(document.getElementById('f')); f.has('news')+','+f.has('btn')",
10013                "false,false",
10014            ),
10015        ];
10016        total += fd_cases.len();
10017        for (src, expect) in fd_cases {
10018            let mut rt = JsRuntime::new();
10019            rt.dom()
10020                .borrow_mut()
10021                .build_from(&crate::os_lib::dom::parse_html(fd_html));
10022            match rt.eval(src) {
10023                Ok(v) if &v.to_js_string() == expect => passed += 1,
10024                Ok(v) => crate::println!(
10025                    "JS_SELFTEST FAIL: `{}` => `{}` (want `{}`)",
10026                    src,
10027                    v.to_js_string(),
10028                    expect
10029                ),
10030                Err(e) => crate::println!("JS_SELFTEST ERR:  `{}` => {}", src, e),
10031            }
10032        }
10033    }
10034    {
10035        // `collect_form_data`(FormData収集の実体)が`form="formId"`属性による
10036        // フォーム外関連付け(HTML5仕様の「form owner」。`element.form`/
10037        // `checkValidity()`は既に対応済み)を反映していなかった兄弟ギャップ。
10038        // 併せて`<fieldset disabled>`祖先による暗黙の無効化(`is_disabled`)も
10039        // 送信データ収集側では未反映だったため同時に修正した。
10040        let fd2_html = "<form id='f6'>\
10041            <input name='inside' value='a'>\
10042            <fieldset disabled><input name='hidden_by_fieldset' value='b'></fieldset>\
10043        </form>\
10044        <input name='outside' form='f6' value='c'>\
10045        <input name='not_associated' value='d'>";
10046        let fd2_cases: &[(&str, &str)] = &[
10047            (
10048                "new FormData(document.getElementById('f6')).get('inside')",
10049                "a",
10050            ),
10051            (
10052                "new FormData(document.getElementById('f6')).get('outside')",
10053                "c",
10054            ),
10055            (
10056                "var f=new FormData(document.getElementById('f6')); f.has('hidden_by_fieldset')",
10057                "false",
10058            ),
10059            (
10060                "var f=new FormData(document.getElementById('f6')); f.has('not_associated')",
10061                "false",
10062            ),
10063            // `form.elements`も同じ`form_associated_controls`を再利用するため、
10064            // フォーム外の`outside`(`form='f6'`)を含む3件(inside/
10065            // hidden_by_fieldset/outside。`not_associated`は含まれない)になる。
10066            (
10067                "document.getElementById('f6').elements.length",
10068                "3",
10069            ),
10070        ];
10071        total += fd2_cases.len();
10072        for (src, expect) in fd2_cases {
10073            let mut rt = JsRuntime::new();
10074            rt.dom()
10075                .borrow_mut()
10076                .build_from(&crate::os_lib::dom::parse_html(fd2_html));
10077            match rt.eval(src) {
10078                Ok(v) if &v.to_js_string() == expect => passed += 1,
10079                Ok(v) => crate::println!(
10080                    "JS_SELFTEST FAIL: `{}` => `{}` (want `{}`)",
10081                    src,
10082                    v.to_js_string(),
10083                    expect
10084                ),
10085                Err(e) => crate::println!("JS_SELFTEST ERR:  `{}` => {}", src, e),
10086            }
10087        }
10088    }
10089    // `<select multiple>` — 選択された option 1つにつき1エントリを送信する仕様が
10090    // FormData 収集で丸ごと未対応だったバグ(複数選択リストボックスという定番 UI
10091    // パターン)。`selectedOptions`(丸ごと未対応だった)も合わせて確認する。
10092    {
10093        let sm_html = "<form id='f2'>\
10094            <select name='tags' multiple>\
10095                <option value='a' selected>A</option>\
10096                <option value='b'>B</option>\
10097                <option value='c' selected>C</option>\
10098            </select>\
10099        </form>";
10100        let sm_cases: &[(&str, &str)] = &[
10101            (
10102                "new FormData(document.getElementById('f2')).getAll('tags').join(',')",
10103                "a,c",
10104            ),
10105            (
10106                "document.querySelector('select').selectedOptions.length",
10107                "2",
10108            ),
10109            (
10110                "Array.from(document.querySelector('select').selectedOptions).map(o => o.value).join(',')",
10111                "a,c",
10112            ),
10113            // `select.options`(動的にドロップダウンを構築する定番イディオム)が
10114            // 丸ごと未対応だった。
10115            (
10116                "document.querySelector('select').options.length",
10117                "3",
10118            ),
10119            (
10120                "Array.from(document.querySelector('select').options).map(o => o.value).join(',')",
10121                "a,b,c",
10122            ),
10123            // `select.options.add`/`.remove`/`.namedItem`(`HTMLOptionsCollection`。
10124            // 丸ごと未対応だった)。
10125            (
10126                "var s=document.querySelector('select'); \
10127                 var o=new Option('D','d'); o.id='optd'; s.options.add(o); \
10128                 s.options.length + ':' + s.options[3].value",
10129                "4:d",
10130            ),
10131            (
10132                "var s=document.querySelector('select'); s.options.remove(1); \
10133                 Array.from(s.options).map(o => o.value).join(',')",
10134                "a,c",
10135            ),
10136            (
10137                "document.querySelector('select').options.namedItem('nope')",
10138                "null",
10139            ),
10140            (
10141                "var s=document.querySelector('select'); s.options.item(0).value",
10142                "a",
10143            ),
10144            (
10145                "var s=document.querySelector('select'); s.options.selectedIndex=1; s.selectedIndex",
10146                "1",
10147            ),
10148            (
10149                "var s=document.querySelector('select'); s.selectedIndex=2; s.options.selectedIndex",
10150                "2",
10151            ),
10152        ];
10153        total += sm_cases.len();
10154        for (src, expect) in sm_cases {
10155            let mut rt = JsRuntime::new();
10156            rt.dom()
10157                .borrow_mut()
10158                .build_from(&crate::os_lib::dom::parse_html(sm_html));
10159            match rt.eval(src) {
10160                Ok(v) if &v.to_js_string() == expect => passed += 1,
10161                Ok(v) => crate::println!(
10162                    "JS_SELFTEST FAIL: `{}` => `{}` (want `{}`)",
10163                    src,
10164                    v.to_js_string(),
10165                    expect
10166                ),
10167                Err(e) => crate::println!("JS_SELFTEST ERR:  `{}` => {}", src, e),
10168            }
10169        }
10170    }
10171    // `<select>`配下`<optgroup>`でグループ化された`<option>`が丸ごと見えなく
10172    // なっていたバグ(`select.options`/`selectedOptions`/フォーム送信の
10173    // どちらも直接の子要素しか見ておらず、`<optgroup>`という非常によく
10174    // 使われるカテゴリ分けパターンを完全に見落としていた。2026-07-17
10175    // 発見・実装)。
10176    // 【2026-07-24】以前`optgroup_total`が固定値`5`だったが、実際の`og_cases`
10177    // 配列は4件しか無く、`total`側だけ1件多く数える「集計ずれ」の一例だった
10178    // (`pass == total`の一言判定のみでは個別FAIL行が一切出ないままカテゴリ
10179    // 丸ごとFAILになり原因不明だった)。`.len()`から動的に求めることで
10180    // 今後同じズレが再発しないようにする。
10181    let og_html = "<form id='f3'><select name='fruit'><optgroup label='Citrus'><option value='lemon'>Lemon</option><option value='lime' selected>Lime</option></optgroup><optgroup label='Berries'><option value='straw'>Strawberry</option></optgroup></select></form>";
10182    let og_cases: &[(&str, &str)] = &[
10183        (
10184            "document.querySelector('select').options.length",
10185            "3",
10186        ),
10187        (
10188            "Array.from(document.querySelector('select').options).map(o => o.value).join(',')",
10189            "lemon,lime,straw",
10190        ),
10191        (
10192            "document.querySelector('select').selectedOptions.length",
10193            "1",
10194        ),
10195        (
10196            "document.querySelector('select').value",
10197            "lime",
10198        ),
10199    ];
10200    total += og_cases.len();
10201    {
10202        for (src, expect) in og_cases {
10203            let mut rt = JsRuntime::new();
10204            rt.dom()
10205                .borrow_mut()
10206                .build_from(&crate::os_lib::dom::parse_html(og_html));
10207            match rt.eval(src) {
10208                Ok(v) if &v.to_js_string() == expect => passed += 1,
10209                Ok(v) => crate::println!(
10210                    "JS_SELFTEST FAIL: `{}` => `{}` (want `{}`)",
10211                    src,
10212                    v.to_js_string(),
10213                    expect
10214                ),
10215                Err(e) => crate::println!("JS_SELFTEST ERR:  `{}` => {}", src, e),
10216            }
10217        }
10218    }
10219    // `document.title` が実際の `<head><title>` 要素と連動すること(既存 `<title>` の
10220    // 更新、無い場合は `<head>` へ新規作成)を、実 DOM 構造を持つフィクスチャで確認する。
10221    {
10222        let title_cases: &[(&str, &str, &str)] = &[
10223            // 既存の <title> があれば、その中身が更新される。
10224            (
10225                "<html><head><title>old</title></head><body></body></html>",
10226                "document.title",
10227                "old",
10228            ),
10229            (
10230                "<html><head><title>old</title></head><body></body></html>",
10231                "document.title='new'; document.querySelector('title').textContent",
10232                "new",
10233            ),
10234            // <head> はあるが <title> が無い場合、新規作成されて連動する。
10235            (
10236                "<html><head></head><body></body></html>",
10237                "document.title='created'; document.querySelector('title').textContent",
10238                "created",
10239            ),
10240        ];
10241        total += title_cases.len();
10242        for (html, src, expect) in title_cases {
10243            let mut rt = JsRuntime::new();
10244            rt.dom()
10245                .borrow_mut()
10246                .build_from(&crate::os_lib::dom::parse_html(html));
10247            match rt.eval(src) {
10248                Ok(v) if &v.to_js_string() == expect => passed += 1,
10249                Ok(v) => crate::println!(
10250                    "JS_SELFTEST FAIL: `{}` => `{}` (want `{}`)",
10251                    src,
10252                    v.to_js_string(),
10253                    expect
10254                ),
10255                Err(e) => crate::println!("JS_SELFTEST ERR:  `{}` => {}", src, e),
10256            }
10257        }
10258    }
10259    // `document.forms`/`.images`/`.scripts`(文書全体をタグ横断で集約する定番の
10260    // HTMLCollection 群)が丸ごと未対応だった。
10261    {
10262        let coll_html = "<html><body>\
10263            <form id='f1'></form><form id='f2'></form>\
10264            <img src='a.png'><img src='b.png'><img src='c.png'>\
10265            <script>1</script>\
10266            <a href='x.html'>x</a><a name='top'>anchor</a>\
10267            <area href='y.html' alt='y'>\
10268            <embed src='z.swf'>\
10269        </body></html>";
10270        let coll_cases: &[(&str, &str)] = &[
10271            ("document.forms.length", "2"),
10272            ("document.images.length", "3"),
10273            ("document.scripts.length", "1"),
10274            // `document.links`(href 付きの a/area のみ。`name` のみの a は含まない)が
10275            // 丸ごと未対応だった。
10276            ("document.links.length", "2"),
10277            // `document.anchors`(`name` 属性付きの a のみ)も丸ごと未対応だった。
10278            ("document.anchors.length", "1"),
10279            // `document.embeds`/`.plugins`(仕様上同じ集合を指すエイリアス)/
10280            // `document.applets`(Java アプレット廃止に伴い常に空固定のレガシー
10281            // スタブ)が丸ごと未対応だった。2026-07-16 発見・実装。
10282            ("document.embeds.length", "1"),
10283            ("document.plugins.length", "1"),
10284            ("document.applets.length", "0"),
10285        ];
10286        total += coll_cases.len();
10287        for (src, expect) in coll_cases {
10288            let mut rt = JsRuntime::new();
10289            rt.dom()
10290                .borrow_mut()
10291                .build_from(&crate::os_lib::dom::parse_html(coll_html));
10292            match rt.eval(src) {
10293                Ok(v) if &v.to_js_string() == expect => passed += 1,
10294                Ok(v) => crate::println!(
10295                    "JS_SELFTEST FAIL: `{}` => `{}` (want `{}`)",
10296                    src,
10297                    v.to_js_string(),
10298                    expect
10299                ),
10300                Err(e) => crate::println!("JS_SELFTEST ERR:  `{}` => {}", src, e),
10301            }
10302        }
10303    }
10304    // 【2026-10-24】YouTube(kevlar)のカスタム要素が、ビヘイビアと prototype のメソッド名を
10305    // 集めて要素へ転送するのに使う反射 API。ytd-player に preparePlayer が無かった件の切り分け。
10306    {
10307        let reflect_checks: &[(&str, &str)] = &[
10308            ("Object.getOwnPropertyNames({a:function(){},p:1}).join()", "a,p"),
10309            ("Object.getOwnPropertyDescriptor({a:function(){}},'a').value instanceof Function", "true"),
10310            ("[[{x:1}],[[{y:2}]],[]].flat(Infinity).length", "2"),
10311            ("function C(){}; C.prototype.m=function(){}; Object.keys(Object.getOwnPropertyDescriptors(C.prototype)).join()", "constructor,m"),
10312            ("function C(){}; C.prototype.m=function(){}; Object.entries(Object.getOwnPropertyDescriptors(C.prototype)).map(function(e){return e[0]+':'+(e[1].value instanceof Function)}).join()", "constructor:true,m:true"),
10313            ("var B=[{f:function(){return 1}},[{g:function(){return 2}}]]; var n=[]; B.flat(Infinity).forEach(function(o){Object.getOwnPropertyNames(o).forEach(function(k){n.push(k)})}); n.join()", "f,g"),
10314            ("var o={}; ['x','y'].forEach(function(k){o[k]=function(){return k}}); o.y()", "y"),
10315            // connectedCallback の中で複製したカスタム要素が、複製の呼び出しが戻った時点で昇格している
10316            // (CEReactions の入れ子。YouTube の ytd-watch-flexy → ytd-player)。
10317            ("class XKid extends HTMLElement { hi(){ return 'hi'; } } customElements.define('x-kid', XKid); \
10318              var R; class XPar extends HTMLElement { connectedCallback(){ var s=document.createElement('div'); \
10319              s.innerHTML='<x-kid></x-kid>'; var c=s.cloneNode(true); this.appendChild(c); R=typeof c.firstChild.hi; } } \
10320              customElements.define('x-par', XPar); document.body.appendChild(document.createElement('x-par')); R", "function"),
10321        ];
10322        total += reflect_checks.len();
10323        for (src, expect) in reflect_checks {
10324            let mut rt = JsRuntime::new();
10325            match rt.eval(src) {
10326                Ok(v) if &v.to_js_string() == expect => passed += 1,
10327                Ok(v) => crate::println!(
10328                    "JS_SELFTEST FAIL: `{}` => `{}` (want `{}`)",
10329                    src,
10330                    v.to_js_string(),
10331                    expect
10332                ),
10333                Err(e) => crate::println!("JS_SELFTEST ERR:  `{}` => {}", src, e),
10334            }
10335        }
10336    }
10337    // getBoundingClientRect / offset* (レンダラが set_rect で注入する矩形を JS から読む)。
10338    {
10339        let rect_checks: &[(&str, &str)] = &[
10340            (
10341                "document.getElementById('t').getBoundingClientRect().width",
10342                "30",
10343            ),
10344            (
10345                "document.getElementById('t').getBoundingClientRect().height",
10346                "40",
10347            ),
10348            (
10349                "document.getElementById('t').getBoundingClientRect().left",
10350                "10",
10351            ),
10352            (
10353                "document.getElementById('t').getBoundingClientRect().bottom",
10354                "60",
10355            ),
10356            ("document.getElementById('t').offsetWidth", "30"),
10357            ("document.getElementById('t').offsetTop", "20"),
10358            // clientWidth = 30 (width) - 5 (left border) - 3 (right border) = 22
10359            ("document.getElementById('t').clientWidth", "22"),
10360            // 文書要素の clientWidth/clientHeight はビューポート(innerWidth/innerHeight)。
10361            ("document.documentElement.clientWidth === innerWidth", "true"),
10362            ("document.documentElement.clientHeight === innerHeight", "true"),
10363            // clientHeight = 40 (height) - 2 (top border) - 4 (bottom border) = 34
10364            ("document.getElementById('t').clientHeight", "34"),
10365            // clientLeft = 5 (left border)
10366            ("document.getElementById('t').clientLeft", "5"),
10367            // clientTop = 2 (top border)
10368            ("document.getElementById('t').clientTop", "2"),
10369            // `element.getClientRects()`(丸ごと未対応だった。テキスト行フラグメント
10370            // モデルが無いこの処理系では要素1つにつき `getBoundingClientRect()` と
10371            // 同じ矩形を1個だけ持つ配列として返す簡略実装)。
10372            ("document.getElementById('t').getClientRects().length", "1"),
10373            (
10374                "document.getElementById('t').getClientRects()[0].width",
10375                "30",
10376            ),
10377            // rect が未登録(レンダラ未描画)の要素は仕様どおり空配列。
10378            ("document.getElementById('s').getClientRects().length", "0"),
10379            // `element.offsetParent`(丸ごと未対応だった。祖先に position が
10380            // static 以外の要素も `<body>` も無ければ仕様どおり `null`)。
10381            (
10382                "document.getElementById('t').offsetParent",
10383                "null",
10384            ),
10385            (
10386                "document.getElementById('wrap').style.position='relative'; \
10387                 document.getElementById('t').offsetParent.id",
10388                "wrap",
10389            ),
10390            // 【2026-10-29】未レイアウト時のインラインスタイル・属性・HTML5固有寸法フォールバック
10391            ("var cv = document.createElement('canvas'); cv.offsetWidth", "300"),
10392            ("var cv = document.createElement('canvas'); cv.offsetHeight", "150"),
10393            ("var vd = document.createElement('video'); vd.setAttribute('width', '640'); vd.setAttribute('height', '360'); vd.offsetWidth", "640"),
10394            ("var vd = document.createElement('video'); vd.setAttribute('width', '640'); vd.setAttribute('height', '360'); vd.offsetHeight", "360"),
10395            ("var d = document.createElement('div'); d.style.width = '240px'; d.style.height = '120px'; d.offsetWidth", "240"),
10396            ("var d = document.createElement('div'); d.style.width = '240px'; d.style.height = '120px'; d.getBoundingClientRect().width", "240"),
10397            ("var hid = document.createElement('div'); hid.style.display = 'none'; hid.offsetWidth", "0"),
10398        ];
10399        total += rect_checks.len();
10400        for (src, expect) in rect_checks {
10401            let mut rt = JsRuntime::new();
10402            rt.dom()
10403                .borrow_mut()
10404                .build_from(&crate::os_lib::dom::parse_html(dom2_html));
10405            // レンダラ相当: #t の矩形 (x=10,y=20,w=30,h=40) を注入。
10406            let idx = rt.dom().borrow().get_element_by_id("t");
10407            if let Some(i) = idx {
10408                rt.dom().borrow_mut().set_rect(i, 10, 20, 30, 40);
10409                rt.dom().borrow_mut().set_border_widths(i, 2, 3, 4, 5); // top=2, right=3, bottom=4, left=5
10410            }
10411            match rt.eval(src) {
10412                Ok(v) if &v.to_js_string() == expect => passed += 1,
10413                Ok(v) => crate::println!(
10414                    "JS_SELFTEST FAIL: `{}` => `{}` (want `{}`)",
10415                    src,
10416                    v.to_js_string(),
10417                    expect
10418                ),
10419                Err(e) => crate::println!("JS_SELFTEST ERR:  `{}` => {}", src, e),
10420            }
10421        }
10422    }
10423
10424    // `document.elementFromPoint(x,y)`/`.elementsFromPoint(x,y)`(座標ヒットテスト)
10425    // が丸ごと未対応だった。`rects`(レンダラが `set_rect` で注入)から座標を含む
10426    // 矩形を集め、最も面積が小さい(=最も深くネストした)要素を返す簡略実装。
10427    {
10428        let point_checks: &[(&str, &str)] = &[
10429            ("document.elementFromPoint(20, 15).id", "t"),
10430            ("document.elementFromPoint(5, 5).id", "wrap"),
10431            ("document.elementFromPoint(500, 500)", "null"),
10432            (
10433                "document.elementsFromPoint(20, 15).map(e => e.id).join(',')",
10434                "t,wrap",
10435            ),
10436        ];
10437        total += point_checks.len();
10438        for (src, expect) in point_checks {
10439            let mut rt = JsRuntime::new();
10440            rt.dom()
10441                .borrow_mut()
10442                .build_from(&crate::os_lib::dom::parse_html(dom2_html));
10443            // レンダラ相当: 'wrap'(外側、大きい矩形)に 't'(内側、小さい矩形)が
10444            // ネストした状態を注入。
10445            let wrap_idx = rt.dom().borrow().get_element_by_id("wrap");
10446            if let Some(i) = wrap_idx {
10447                rt.dom().borrow_mut().set_rect(i, 0, 0, 100, 100);
10448            }
10449            let t_idx = rt.dom().borrow().get_element_by_id("t");
10450            if let Some(i) = t_idx {
10451                rt.dom().borrow_mut().set_rect(i, 10, 10, 30, 20);
10452            }
10453            match rt.eval(src) {
10454                Ok(v) if &v.to_js_string() == expect => passed += 1,
10455                Ok(v) => crate::println!(
10456                    "JS_SELFTEST FAIL: `{}` => `{}` (want `{}`)",
10457                    src,
10458                    v.to_js_string(),
10459                    expect
10460                ),
10461                Err(e) => crate::println!("JS_SELFTEST ERR:  `{}` => {}", src, e),
10462            }
10463        }
10464    }
10465
10466    // getComputedStyle(set_computed_style で注入した算出スタイルを camelCase/kebab/getPropertyValue で読む)。
10467    {
10468        let cs_checks: &[(&str, &str)] = &[
10469            ("getComputedStyle(document.getElementById('t')).color", "red"),
10470            ("getComputedStyle(document.getElementById('t')).backgroundColor", "blue"),
10471            ("getComputedStyle(document.getElementById('t')).getPropertyValue('background-color')", "blue"),
10472            ("window.getComputedStyle(document.getElementById('t')).fontSize", "16px"),
10473        ];
10474        total += cs_checks.len();
10475        for (src, expect) in cs_checks {
10476            let mut rt = JsRuntime::new();
10477            rt.dom()
10478                .borrow_mut()
10479                .build_from(&crate::os_lib::dom::parse_html(dom2_html));
10480            let idx = rt.dom().borrow().get_element_by_id("t");
10481            if let Some(i) = idx {
10482                let mut d = rt.dom().borrow_mut();
10483                d.set_computed_style(i, "color", "red");
10484                d.set_computed_style(i, "background-color", "blue");
10485                d.set_computed_style(i, "font-size", "16px");
10486            }
10487            match rt.eval(src) {
10488                Ok(v) if &v.to_js_string() == expect => passed += 1,
10489                Ok(v) => crate::println!(
10490                    "JS_SELFTEST FAIL: `{}` => `{}` (want `{}`)",
10491                    src,
10492                    v.to_js_string(),
10493                    expect
10494                ),
10495                Err(e) => crate::println!("JS_SELFTEST ERR:  `{}` => {}", src, e),
10496            }
10497        }
10498    }
10499
10500    // `element.checkVisibility()`(DOM 標準。丸ごと未対応だった)。
10501    {
10502        let cv_checks: &[(&str, &str, &[(&str, &str, &str)])] = &[
10503            (
10504                "document.getElementById('t').checkVisibility()",
10505                "true",
10506                &[],
10507            ),
10508            (
10509                "document.getElementById('t').checkVisibility()",
10510                "false",
10511                &[("t", "display", "none")],
10512            ),
10513            (
10514                "document.getElementById('t').checkVisibility()",
10515                "false",
10516                &[("wrap", "display", "none")],
10517            ),
10518            (
10519                "document.getElementById('t').checkVisibility()",
10520                "false",
10521                &[("t", "visibility", "hidden")],
10522            ),
10523        ];
10524        total += cv_checks.len();
10525        for (src, expect, styles) in cv_checks {
10526            let mut rt = JsRuntime::new();
10527            rt.dom()
10528                .borrow_mut()
10529                .build_from(&crate::os_lib::dom::parse_html(dom2_html));
10530            for (id, prop, val) in *styles {
10531                let idx = rt.dom().borrow().get_element_by_id(id);
10532                if let Some(i) = idx {
10533                    rt.dom().borrow_mut().set_computed_style(i, prop, val);
10534                }
10535            }
10536            match rt.eval(src) {
10537                Ok(v) if &v.to_js_string() == expect => passed += 1,
10538                Ok(v) => crate::println!(
10539                    "JS_SELFTEST FAIL: `{}` => `{}` (want `{}`)",
10540                    src,
10541                    v.to_js_string(),
10542                    expect
10543                ),
10544                Err(e) => crate::println!("JS_SELFTEST ERR:  `{}` => {}", src, e),
10545            }
10546        }
10547    }
10548
10549    // クリックディスパッチの統合確認(リスナ登録→dispatch_click→カウンタ増加)。
10550    {
10551        total += 1;
10552        let mut rt = JsRuntime::new();
10553        rt.dom()
10554            .borrow_mut()
10555            .build_from(&crate::os_lib::dom::parse_html(dom_html));
10556        let _ = rt.eval("var clicks=0; document.getElementById('b').addEventListener('click', () => { clicks++; document.getElementById('out').textContent = 'clicked ' + clicks; });");
10557        let bidx = rt.dom().borrow().get_element_by_id("b");
10558        if let Some(i) = bidx {
10559            rt.dispatch_click(i);
10560            rt.dispatch_click(i);
10561        }
10562        match rt.eval("clicks + ':' + document.getElementById('out').textContent") {
10563            Ok(v) if v.to_js_string() == "2:clicked 2" => passed += 1,
10564            Ok(v) => crate::println!(
10565                "JS_SELFTEST FAIL: click dispatch => `{}` (want `2:clicked 2`)",
10566                v.to_js_string()
10567            ),
10568            Err(e) => crate::println!("JS_SELFTEST ERR:  click dispatch => {}", e),
10569        }
10570    }
10571
10572    // Event: バブリング / target・currentTarget / stopPropagation / preventDefault / stopImmediate。
10573    let event_html = "<div id='par'><button id='btn'>go</button></div>";
10574    let event_checks: &[(&str, &str, &str)] = &[
10575        // 委譲: par のリスナが子 btn のクリックで発火。target=btn, currentTarget=par。
10576        ("var L=''; document.getElementById('par').addEventListener('click', function(e){ L += 'par('+e.target.id+','+e.currentTarget.id+')'; });",
10577         "L", "par(btn,par)"),
10578        // バブリング順: target(btn) → 祖先(par)。
10579        ("var L=''; document.getElementById('btn').addEventListener('click', function(){ L+='btn'; }); document.getElementById('par').addEventListener('click', function(){ L+='-par'; });",
10580         "L", "btn-par"),
10581        // stopPropagation で祖先に伝播しない。
10582        ("var L=''; document.getElementById('btn').addEventListener('click', function(e){ L+='btn'; e.stopPropagation(); }); document.getElementById('par').addEventListener('click', function(){ L+='-par'; });",
10583         "L", "btn"),
10584        // preventDefault → defaultPrevented。
10585        ("var L=''; document.getElementById('btn').addEventListener('click', function(e){ e.preventDefault(); L += e.defaultPrevented; });",
10586         "L", "true"),
10587        // stopImmediatePropagation で同一ノードの後続リスナも止まる。
10588        ("var L=''; document.getElementById('btn').addEventListener('click', function(e){ L+='1'; e.stopImmediatePropagation(); }); document.getElementById('btn').addEventListener('click', function(){ L+='2'; });",
10589         "L", "1"),
10590        // キャプチャ→ターゲット→バブルの順。par(capture) → btn → par(bubble)。
10591        ("var L=''; document.getElementById('par').addEventListener('click', function(){ L+='cap'; }, true); document.getElementById('btn').addEventListener('click', function(){ L+='-tgt'; }); document.getElementById('par').addEventListener('click', function(){ L+='-bub'; });",
10592         "L", "cap-tgt-bub"),
10593        // eventPhase: capture=1, at target=2, bubble=3。
10594        ("var P=''; document.getElementById('par').addEventListener('click', function(e){ P+=e.eventPhase; }, true); document.getElementById('btn').addEventListener('click', function(e){ P+=e.eventPhase; }); document.getElementById('par').addEventListener('click', function(e){ P+=e.eventPhase; });",
10595         "P", "123"),
10596        // once: クリックで一度発火する(複数回 dispatch のテストは専用ブロックで実施)。
10597        ("var N=0; document.getElementById('btn').addEventListener('click', function(){ N++; }, {once:true}); N",
10598         "N", "1"),
10599        // removeEventListener: 登録解除すると発火しない。
10600        ("var L=''; function h(){ L+='x'; } document.getElementById('btn').addEventListener('click', h); document.getElementById('btn').removeEventListener('click', h);",
10601         "L", ""),
10602        // composedPath: target→祖先(btn, par, ...)。先頭2件の id を確認。
10603        ("var C=''; document.getElementById('btn').addEventListener('click', function(e){ var p=e.composedPath(); C=p[0].id+','+p[1].id; });",
10604         "C", "btn,par"),
10605    ];
10606    total += event_checks.len();
10607    for (setup, read, expect) in event_checks {
10608        let mut rt = JsRuntime::new();
10609        rt.dom()
10610            .borrow_mut()
10611            .build_from(&crate::os_lib::dom::parse_html(event_html));
10612        let _ = rt.eval(setup);
10613        let bidx = rt.dom().borrow().get_element_by_id("btn");
10614        if let Some(i) = bidx {
10615            rt.dispatch_click(i);
10616        }
10617        match rt.eval(read) {
10618            Ok(v) if &v.to_js_string() == expect => passed += 1,
10619            Ok(v) => crate::println!(
10620                "JS_SELFTEST FAIL: event `{}` => `{}` (want `{}`)",
10621                read,
10622                v.to_js_string(),
10623                expect
10624            ),
10625            Err(e) => crate::println!("JS_SELFTEST ERR:  event `{}` => {}", read, e),
10626        }
10627    }
10628
10629    // dispatchEvent: 手動で Event を発火し、リスナが受け取りバブリングする
10630    // (`bubbles: true` を明示。仕様上 `new Event('foo')` の既定は `bubbles: false`
10631    // で、以前は `bubbles` を一切見ず常に無条件で祖先まで伝播していたバグが
10632    // あったため、明示的に `true` を指定してバブリングの意図を検証する)。
10633    {
10634        total += 1;
10635        let mut rt = JsRuntime::new();
10636        rt.dom()
10637            .borrow_mut()
10638            .build_from(&crate::os_lib::dom::parse_html(event_html));
10639        let _ = rt.eval(
10640            "var L=''; \
10641             document.getElementById('btn').addEventListener('foo', function(e){ L+='btn:'+e.type; }); \
10642             document.getElementById('par').addEventListener('foo', function(){ L+='-par'; }); \
10643             document.getElementById('btn').dispatchEvent(new Event('foo', {bubbles:true}));",
10644        );
10645        match rt.eval("L") {
10646            Ok(v) if v.to_js_string() == "btn:foo-par" => passed += 1,
10647            Ok(v) => crate::println!(
10648                "JS_SELFTEST FAIL: dispatchEvent => `{}` (want `btn:foo-par`)",
10649                v.to_js_string()
10650            ),
10651            Err(e) => crate::println!("JS_SELFTEST ERR:  dispatchEvent => {}", e),
10652        }
10653    }
10654
10655    // dispatchEvent: `bubbles: false`(既定)なら祖先へ伝播しない。以前は
10656    // `bubbles` を一切見ず常に無条件で祖先まで伝播してしまう仕様違反バグだった。
10657    {
10658        total += 1;
10659        let mut rt = JsRuntime::new();
10660        rt.dom()
10661            .borrow_mut()
10662            .build_from(&crate::os_lib::dom::parse_html(event_html));
10663        let _ = rt.eval(
10664            "var L=''; \
10665             document.getElementById('btn').addEventListener('foo', function(e){ L+='btn:'+e.type; }); \
10666             document.getElementById('par').addEventListener('foo', function(){ L+='-par'; }); \
10667             document.getElementById('btn').dispatchEvent(new Event('foo'));",
10668        );
10669        match rt.eval("L") {
10670            Ok(v) if v.to_js_string() == "btn:foo" => passed += 1,
10671            Ok(v) => crate::println!(
10672                "JS_SELFTEST FAIL: dispatchEvent non-bubbling => `{}` (want `btn:foo`)",
10673                v.to_js_string()
10674            ),
10675            Err(e) => crate::println!("JS_SELFTEST ERR:  dispatchEvent non-bubbling => {}", e),
10676        }
10677    }
10678
10679    // dispatchEvent: CustomEvent の `bubbles` オプションが正しく反映される
10680    // (以前は常に `false` 決め打ちで、`{bubbles:true}` を渡しても無視されていた)。
10681    {
10682        total += 1;
10683        let mut rt = JsRuntime::new();
10684        rt.dom()
10685            .borrow_mut()
10686            .build_from(&crate::os_lib::dom::parse_html(event_html));
10687        let _ = rt.eval(
10688            "var L=''; \
10689             document.getElementById('btn').addEventListener('foo', function(e){ L+='btn:'+e.type; }); \
10690             document.getElementById('par').addEventListener('foo', function(){ L+='-par'; }); \
10691             document.getElementById('btn').dispatchEvent(new CustomEvent('foo', {bubbles:true}));",
10692        );
10693        match rt.eval("L") {
10694            Ok(v) if v.to_js_string() == "btn:foo-par" => passed += 1,
10695            Ok(v) => crate::println!(
10696                "JS_SELFTEST FAIL: CustomEvent bubbles => `{}` (want `btn:foo-par`)",
10697                v.to_js_string()
10698            ),
10699            Err(e) => crate::println!("JS_SELFTEST ERR:  CustomEvent bubbles => {}", e),
10700        }
10701    }
10702
10703    // once: 複数回 dispatch しても 1 回だけ発火。
10704    {
10705        total += 1;
10706        let mut rt = JsRuntime::new();
10707        rt.dom()
10708            .borrow_mut()
10709            .build_from(&crate::os_lib::dom::parse_html(event_html));
10710        let _ = rt.eval(
10711            "var N=0; document.getElementById('btn').addEventListener('foo', function(){ N++; }, {once:true}); \
10712             document.getElementById('btn').dispatchEvent(new Event('foo')); \
10713             document.getElementById('btn').dispatchEvent(new Event('foo')); \
10714             document.getElementById('btn').dispatchEvent(new Event('foo'));",
10715        );
10716        match rt.eval("N") {
10717            Ok(v) if v.to_js_string() == "1" => passed += 1,
10718            Ok(v) => crate::println!(
10719                "JS_SELFTEST FAIL: once dispatch => `{}` (want `1`)",
10720                v.to_js_string()
10721            ),
10722            Err(e) => crate::println!("JS_SELFTEST ERR:  once dispatch => {}", e),
10723        }
10724    }
10725
10726    // dispatchEvent 戻り値: preventDefault されると false(`cancelable:true` の場合のみ。
10727    // 以前は `cancelable` が一切読まれておらず preventDefault() が常に効いていた
10728    // バグの修正に伴い、このテストが元々検証したかった「妨害可能なイベントで
10729    // preventDefault() が効く」という意図を保つため `new Event('foo', {cancelable:
10730    // true})` に明示する)。
10731    {
10732        total += 1;
10733        let mut rt = JsRuntime::new();
10734        rt.dom()
10735            .borrow_mut()
10736            .build_from(&crate::os_lib::dom::parse_html(event_html));
10737        let _ = rt.eval(
10738            "document.getElementById('btn').addEventListener('foo', function(e){ e.preventDefault(); }); \
10739             var R = document.getElementById('btn').dispatchEvent(new Event('foo', {cancelable:true}));",
10740        );
10741        match rt.eval("R") {
10742            Ok(v) if v.to_js_string() == "false" => passed += 1,
10743            Ok(v) => crate::println!(
10744                "JS_SELFTEST FAIL: dispatchEvent return => `{}` (want `false`)",
10745                v.to_js_string()
10746            ),
10747            Err(e) => crate::println!("JS_SELFTEST ERR:  dispatchEvent return => {}", e),
10748        }
10749    }
10750
10751    // keydown / input / focus / blur / change / submit / mouse(座標含む) イベント。
10752    // change イベント: input/select に change リスナを登録し dispatch_event で発火。
10753    let change_html = "<form><input id='cb' type='checkbox'><select id='sel'><option value='a'>A</option><option value='b'>B</option></select></form>";
10754    let mut change_passed = 0usize;
10755    {
10756        total += 1;
10757        let mut rt = JsRuntime::new();
10758        rt.dom()
10759            .borrow_mut()
10760            .build_from(&crate::os_lib::dom::parse_html(change_html));
10761        let _ = rt.eval("var c=0; document.getElementById('cb').addEventListener('change', function(){ c++; });");
10762        let cidx = rt.dom().borrow().get_element_by_id("cb");
10763        if let Some(i) = cidx {
10764            rt.dispatch_event(i, "change");
10765            rt.dispatch_event(i, "change");
10766        }
10767        match rt.eval("c") {
10768            Ok(v) if v.to_js_string() == "2" => change_passed += 1,
10769            Ok(v) => crate::println!(
10770                "JS_SELFTEST FAIL: change count => `{}` (want `2`)",
10771                v.to_js_string()
10772            ),
10773            Err(e) => crate::println!("JS_SELFTEST ERR:  change count => {}", e),
10774        }
10775    }
10776    {
10777        total += 1;
10778        // change イベントの target が発火要素であること。
10779        let mut rt = JsRuntime::new();
10780        rt.dom()
10781            .borrow_mut()
10782            .build_from(&crate::os_lib::dom::parse_html(change_html));
10783        let _ = rt.eval("var t=''; document.getElementById('sel').addEventListener('change', function(e){ t=e.target.id; });");
10784        let sidx = rt.dom().borrow().get_element_by_id("sel");
10785        if let Some(i) = sidx {
10786            rt.dispatch_event(i, "change");
10787        }
10788        match rt.eval("t") {
10789            Ok(v) if v.to_js_string() == "sel" => change_passed += 1,
10790            Ok(v) => crate::println!(
10791                "JS_SELFTEST FAIL: change target => `{}` (want `sel`)",
10792                v.to_js_string()
10793            ),
10794            Err(e) => crate::println!("JS_SELFTEST ERR:  change target => {}", e),
10795        }
10796    }
10797    passed += change_passed;
10798
10799    {
10800        let kev_html = "<div id='par'><input id='inp'></div>";
10801        // 1. keydown が e.type/e.key 付きで発火。
10802        {
10803            total += 1;
10804            let mut rt = JsRuntime::new();
10805            rt.dom()
10806                .borrow_mut()
10807                .build_from(&crate::os_lib::dom::parse_html(kev_html));
10808            let _ = rt.eval("var L=''; document.getElementById('inp').addEventListener('keydown', function(e){ L = e.type + ':' + e.key; });");
10809            let idx = rt.dom().borrow().get_element_by_id("inp");
10810            if let Some(i) = idx {
10811                rt.dispatch_key(i, "keydown", "x");
10812            }
10813            if rt.eval("L").map(|v| v.to_js_string()).unwrap_or_default() == "keydown:x" {
10814                passed += 1;
10815            } else {
10816                crate::println!("JS_SELFTEST FAIL: keydown e.key");
10817            }
10818        }
10819        // 2. keydown が祖先へバブリング(委譲)。
10820        {
10821            total += 1;
10822            let mut rt = JsRuntime::new();
10823            rt.dom()
10824                .borrow_mut()
10825                .build_from(&crate::os_lib::dom::parse_html(kev_html));
10826            let _ = rt.eval("var L=''; document.getElementById('par').addEventListener('keydown', function(e){ L = 'par:' + e.target.id; });");
10827            let idx = rt.dom().borrow().get_element_by_id("inp");
10828            if let Some(i) = idx {
10829                rt.dispatch_key(i, "keydown", "a");
10830            }
10831            if rt.eval("L").map(|v| v.to_js_string()).unwrap_or_default() == "par:inp" {
10832                passed += 1;
10833            } else {
10834                crate::println!("JS_SELFTEST FAIL: keydown bubbling");
10835            }
10836        }
10837        // 3. keydown の preventDefault が dispatch_key の戻り値 .1 に反映。
10838        {
10839            total += 1;
10840            let mut rt = JsRuntime::new();
10841            rt.dom()
10842                .borrow_mut()
10843                .build_from(&crate::os_lib::dom::parse_html(kev_html));
10844            let _ = rt.eval("document.getElementById('inp').addEventListener('keydown', function(e){ e.preventDefault(); });");
10845            let idx = rt.dom().borrow().get_element_by_id("inp");
10846            let prevented = idx
10847                .map(|i| rt.dispatch_key(i, "keydown", "a").1)
10848                .unwrap_or(false);
10849            if prevented {
10850                passed += 1;
10851            } else {
10852                crate::println!("JS_SELFTEST FAIL: keydown preventDefault");
10853            }
10854        }
10855        // 4. input イベントが発火。
10856        {
10857            total += 1;
10858            let mut rt = JsRuntime::new();
10859            rt.dom()
10860                .borrow_mut()
10861                .build_from(&crate::os_lib::dom::parse_html(kev_html));
10862            let _ = rt.eval("var N=0; document.getElementById('inp').addEventListener('input', function(){ N++; });");
10863            let idx = rt.dom().borrow().get_element_by_id("inp");
10864            if let Some(i) = idx {
10865                rt.dispatch_event(i, "input");
10866            }
10867            if rt.eval("N").map(|v| v.to_js_string()).unwrap_or_default() == "1" {
10868                passed += 1;
10869            } else {
10870                crate::println!("JS_SELFTEST FAIL: input event");
10871            }
10872        }
10873        // 5. focus イベントが発火(e.type)。
10874        {
10875            total += 1;
10876            let mut rt = JsRuntime::new();
10877            rt.dom()
10878                .borrow_mut()
10879                .build_from(&crate::os_lib::dom::parse_html(kev_html));
10880            let _ = rt.eval("var L=''; document.getElementById('inp').addEventListener('focus', function(e){ L = e.type; });");
10881            let idx = rt.dom().borrow().get_element_by_id("inp");
10882            if let Some(i) = idx {
10883                rt.dispatch_event(i, "focus");
10884            }
10885            if rt.eval("L").map(|v| v.to_js_string()).unwrap_or_default() == "focus" {
10886                passed += 1;
10887            } else {
10888                crate::println!("JS_SELFTEST FAIL: focus event");
10889            }
10890        }
10891        // 6. blur イベントが祖先へバブリング。
10892        {
10893            total += 1;
10894            let mut rt = JsRuntime::new();
10895            rt.dom()
10896                .borrow_mut()
10897                .build_from(&crate::os_lib::dom::parse_html(kev_html));
10898            let _ = rt.eval("var L=''; document.getElementById('par').addEventListener('blur', function(e){ L = 'blur:' + e.target.id; });");
10899            let idx = rt.dom().borrow().get_element_by_id("inp");
10900            if let Some(i) = idx {
10901                rt.dispatch_event(i, "blur");
10902            }
10903            if rt.eval("L").map(|v| v.to_js_string()).unwrap_or_default() == "blur:inp" {
10904                passed += 1;
10905            } else {
10906                crate::println!("JS_SELFTEST FAIL: blur bubbling");
10907            }
10908        }
10909        // 7. change イベントが発火。
10910        {
10911            total += 1;
10912            let mut rt = JsRuntime::new();
10913            rt.dom()
10914                .borrow_mut()
10915                .build_from(&crate::os_lib::dom::parse_html(kev_html));
10916            let _ = rt.eval("var L=''; document.getElementById('inp').addEventListener('change', function(e){ L = e.type; });");
10917            let idx = rt.dom().borrow().get_element_by_id("inp");
10918            if let Some(i) = idx {
10919                rt.dispatch_event(i, "change");
10920            }
10921            if rt.eval("L").map(|v| v.to_js_string()).unwrap_or_default() == "change" {
10922                passed += 1;
10923            } else {
10924                crate::println!("JS_SELFTEST FAIL: change event");
10925            }
10926        }
10927        // 8/9. submit イベントの発火と preventDefault(送信キャンセル)。
10928        let form_html = "<form id='f'><input id='inp2'></form>";
10929        {
10930            total += 1;
10931            let mut rt = JsRuntime::new();
10932            rt.dom()
10933                .borrow_mut()
10934                .build_from(&crate::os_lib::dom::parse_html(form_html));
10935            let _ = rt.eval("var S=0; document.getElementById('f').addEventListener('submit', function(){ S++; });");
10936            let idx = rt.dom().borrow().get_element_by_id("f");
10937            if let Some(i) = idx {
10938                rt.dispatch_event_with(i, "submit", &[]);
10939            }
10940            if rt.eval("S").map(|v| v.to_js_string()).unwrap_or_default() == "1" {
10941                passed += 1;
10942            } else {
10943                crate::println!("JS_SELFTEST FAIL: submit event");
10944            }
10945        }
10946        {
10947            total += 1;
10948            let mut rt = JsRuntime::new();
10949            rt.dom()
10950                .borrow_mut()
10951                .build_from(&crate::os_lib::dom::parse_html(form_html));
10952            let _ = rt.eval("document.getElementById('f').addEventListener('submit', function(e){ e.preventDefault(); });");
10953            let idx = rt.dom().borrow().get_element_by_id("f");
10954            let prevented = idx
10955                .map(|i| rt.dispatch_event_with(i, "submit", &[]).1)
10956                .unwrap_or(false);
10957            if prevented {
10958                passed += 1;
10959            } else {
10960                crate::println!("JS_SELFTEST FAIL: submit preventDefault");
10961            }
10962        }
10963        // 10. mouseover が発火(e.type)。
10964        {
10965            total += 1;
10966            let mut rt = JsRuntime::new();
10967            rt.dom()
10968                .borrow_mut()
10969                .build_from(&crate::os_lib::dom::parse_html(kev_html));
10970            let _ = rt.eval("var L=''; document.getElementById('inp').addEventListener('mouseover', function(e){ L = e.type; });");
10971            let idx = rt.dom().borrow().get_element_by_id("inp");
10972            if let Some(i) = idx {
10973                rt.dispatch_event(i, "mouseover");
10974            }
10975            if rt.eval("L").map(|v| v.to_js_string()).unwrap_or_default() == "mouseover" {
10976                passed += 1;
10977            } else {
10978                crate::println!("JS_SELFTEST FAIL: mouseover event");
10979            }
10980        }
10981        // 11. mouseout が祖先へバブリング。
10982        {
10983            total += 1;
10984            let mut rt = JsRuntime::new();
10985            rt.dom()
10986                .borrow_mut()
10987                .build_from(&crate::os_lib::dom::parse_html(kev_html));
10988            let _ = rt.eval("var L=''; document.getElementById('par').addEventListener('mouseout', function(e){ L = 'out:' + e.target.id; });");
10989            let idx = rt.dom().borrow().get_element_by_id("inp");
10990            if let Some(i) = idx {
10991                rt.dispatch_event(i, "mouseout");
10992            }
10993            if rt.eval("L").map(|v| v.to_js_string()).unwrap_or_default() == "out:inp" {
10994                passed += 1;
10995            } else {
10996                crate::println!("JS_SELFTEST FAIL: mouseout bubbling");
10997            }
10998        }
10999        // 12. mousemove が発火(回数カウント)。
11000        {
11001            total += 1;
11002            let mut rt = JsRuntime::new();
11003            rt.dom()
11004                .borrow_mut()
11005                .build_from(&crate::os_lib::dom::parse_html(kev_html));
11006            let _ = rt.eval("var N=0; document.getElementById('inp').addEventListener('mousemove', function(){ N++; });");
11007            let idx = rt.dom().borrow().get_element_by_id("inp");
11008            if let Some(i) = idx {
11009                rt.dispatch_event(i, "mousemove");
11010                rt.dispatch_event(i, "mousemove");
11011            }
11012            if rt.eval("N").map(|v| v.to_js_string()).unwrap_or_default() == "2" {
11013                passed += 1;
11014            } else {
11015                crate::println!("JS_SELFTEST FAIL: mousemove event");
11016            }
11017        }
11018        // 13. dispatch_mouse が clientX/clientY を付与。
11019        {
11020            total += 1;
11021            let mut rt = JsRuntime::new();
11022            rt.dom()
11023                .borrow_mut()
11024                .build_from(&crate::os_lib::dom::parse_html(kev_html));
11025            let _ = rt.eval("var L=''; document.getElementById('inp').addEventListener('click', function(e){ L = e.clientX + ',' + e.clientY; });");
11026            let idx = rt.dom().borrow().get_element_by_id("inp");
11027            if let Some(i) = idx {
11028                rt.dispatch_mouse(i, "click", 42, 17);
11029            }
11030            if rt.eval("L").map(|v| v.to_js_string()).unwrap_or_default() == "42,17" {
11031                passed += 1;
11032            } else {
11033                crate::println!("JS_SELFTEST FAIL: mouse clientX/clientY");
11034            }
11035        }
11036    }
11037
11038    // window/document.location(set_page_url 後に各成分を検証)。
11039    let location_cases: &[(&str, &str)] = &[
11040        ("location.href", "https://example.com/foo/bar?q=1#h"),
11041        ("location.protocol", "https:"),
11042        ("location.host", "example.com"),
11043        ("location.hostname", "example.com"),
11044        ("location.pathname", "/foo/bar"),
11045        ("location.search", "?q=1"),
11046        ("location.hash", "#h"),
11047        ("location.origin", "https://example.com"),
11048        ("window.location.href", "https://example.com/foo/bar?q=1#h"),
11049        ("document.location.pathname", "/foo/bar"),
11050        ("location.toString()", "https://example.com/foo/bar?q=1#h"),
11051        ("window.location === document.location", "true"),
11052        // `location.protocol`/`.host`/`.hostname`/`.port`への代入は仕様上
11053        // 再ナビゲーションを要求すべきだが、`href`/`hash`/`pathname`/`search`
11054        // だけがナビゲーション要求(`_pending_location`)に変換されており、
11055        // この4つは常に黙って見かけ上の`.props`値だけ更新され、実際には
11056        // どこへも「移動しない」バグだった。
11057        // `location_cases`は1つの`rt`を全ケースで使い回す(前のケースの代入が
11058        // 後続へ持ち越される)ため、各ケースの先頭で`protocol`/`host`を
11059        // 明示的に既知の状態へリセットしてから検証し、実行順に依存しない
11060        // ようにする。
11061        (
11062            "location.protocol='http:'; location._pending_location",
11063            "http://example.com/foo/bar?q=1",
11064        ),
11065        (
11066            "location.protocol='https:'; location.host='example.com'; \
11067             location.hostname='other.com'; location._pending_location",
11068            "https://other.com/foo/bar?q=1",
11069        ),
11070        (
11071            "location.host='example.com'; location.port='8080'; location._pending_location",
11072            "https://example.com:8080/foo/bar?q=1",
11073        ),
11074        (
11075            "location.host='new.com:9090'; location._pending_location",
11076            "https://new.com:9090/foo/bar?q=1",
11077        ),
11078        (
11079            "location.host='new.com:9090'; location.hostname + ',' + location.port",
11080            "new.com,9090",
11081        ),
11082        // `<a>.href`/`<img>.src`/`<form>.action` は仕様上、生の属性文字列ではなく
11083        // ページURL基準で解決した絶対URLを返す必要があるが、以前はこの解決が
11084        // 一切行われず相対文字列がそのまま返るバグだった。
11085        (
11086            "var a=document.createElement('a'); a.setAttribute('href','/p3'); a.href",
11087            "https://example.com/p3",
11088        ),
11089        (
11090            "var i=document.createElement('img'); i.setAttribute('src','x.png'); i.src",
11091            "https://example.com/foo/x.png",
11092        ),
11093        (
11094            "var a=document.createElement('a'); a.setAttribute('href','https://o.com/z'); a.href",
11095            "https://o.com/z",
11096        ),
11097        // `document.URL`/`document.documentURI`/`node.baseURI`(DOM 標準。丸ごと
11098        // 未対応だった。`<base>` タグ非対応のため常に `location.href` と同値)。
11099        ("document.URL", "https://example.com/foo/bar?q=1#h"),
11100        ("document.documentURI", "https://example.com/foo/bar?q=1#h"),
11101        (
11102            "document.createElement('div').baseURI",
11103            "https://example.com/foo/bar?q=1#h",
11104        ),
11105        // `document.readyState`(HTML5。丸ごと未対応だった。この処理系は常に
11106        // "complete" を返す簡略実装)。
11107        ("document.readyState", "complete"),
11108        // `document.cookie`(丸ごと未対応だった。`expires`/`path` 等の属性は
11109        // 無視する簡略実装で `name=value` のみ反映する)。
11110        (
11111            "document.cookie='ck_a=1'; document.cookie='ck_b=2; path=/'; document.cookie",
11112            "ck_a=1; ck_b=2",
11113        ),
11114        // `cookieStore`(Cookie Store API。丸ごと未対応だった。`document.cookie`
11115        // と同じ実データを共有する非同期版。他のテストと Cookie 名が衝突しない
11116        // よう `cs_` 接頭辞を使う)。
11117        (
11118            "await cookieStore.set('cs_x', '1'); (await cookieStore.get('cs_x')).value",
11119            "1",
11120        ),
11121        ("(await cookieStore.get('cs_missing'))", "null"),
11122        (
11123            "await cookieStore.set('cs_y', '2'); \
11124             (await cookieStore.getAll('cs_y')).map(c => c.name+'='+c.value).join(',')",
11125            "cs_y=2",
11126        ),
11127        (
11128            "await cookieStore.set('cs_z', '3'); await cookieStore.delete('cs_z'); \
11129             (await cookieStore.get('cs_z'))",
11130            "null",
11131        ),
11132        (
11133            "await cookieStore.set({name:'cs_w', value:'4'}); (await cookieStore.get('cs_w')).value",
11134            "4",
11135        ),
11136        // Page Visibility API(`document.hidden`/`.visibilityState`)が丸ごと
11137        // 未対応だった。タブ/バックグラウンド化の概念が無いため常に「表示中」。
11138        ("document.hidden", "false"),
11139        ("document.visibilityState", "visible"),
11140    ];
11141    total += location_cases.len();
11142    {
11143        let mut rt = JsRuntime::new();
11144        rt.set_page_url("https://example.com/foo/bar?q=1#h");
11145        for (src, expect) in location_cases {
11146            match rt.eval(src) {
11147                Ok(v) if &v.to_js_string() == expect => passed += 1,
11148                Ok(v) => crate::println!(
11149                    "JS_SELFTEST FAIL: `{}` => `{}` (want `{}`)",
11150                    src,
11151                    v.to_js_string(),
11152                    expect
11153                ),
11154                Err(e) => crate::println!("JS_SELFTEST ERR:  `{}` => {}", src, e),
11155            }
11156        }
11157    }
11158
11159    // history.pushState / replaceState(location 書換え + state/length)。
11160    let history_cases: &[(&str, &str)] = &[
11161        (
11162            "history.pushState({a:1},'','/p2'); location.pathname",
11163            "/p2",
11164        ),
11165        (
11166            "history.pushState({},'','/p2'); location.href",
11167            "https://example.com/p2",
11168        ),
11169        ("history.pushState({a:9},'','/p2'); history.state.a", "9"),
11170        (
11171            "var n=history.length; history.pushState({},'','/x'); history.length - n",
11172            "1",
11173        ),
11174        (
11175            "var n=history.length; history.replaceState({},'','/y'); history.length - n",
11176            "0",
11177        ),
11178        (
11179            "history.replaceState({},'','about.html'); location.pathname",
11180            "/foo/about.html",
11181        ),
11182        ("typeof history.pushState", "function"),
11183        ("typeof history.back", "function"),
11184    ];
11185    total += history_cases.len();
11186    for (src, expect) in history_cases {
11187        let mut rt = JsRuntime::new();
11188        rt.set_page_url("https://example.com/foo/bar");
11189        match rt.eval(src) {
11190            Ok(v) if &v.to_js_string() == expect => passed += 1,
11191            Ok(v) => crate::println!(
11192                "JS_SELFTEST FAIL: `{}` => `{}` (want `{}`)",
11193                src,
11194                v.to_js_string(),
11195                expect
11196            ),
11197            Err(e) => crate::println!("JS_SELFTEST ERR:  `{}` => {}", src, e),
11198        }
11199    }
11200
11201    // 相対URL解決(resolve_url 純関数。fetch/XHR の base 基準解決)。
11202    let resolve_cases: &[(&str, &str, &str)] = &[
11203        ("http://h.com/a/b.html", "/api", "http://h.com/api"),
11204        ("http://h.com/a/b.html", "x.json", "http://h.com/a/x.json"),
11205        ("http://h.com/a/", "x.json", "http://h.com/a/x.json"),
11206        (
11207            "http://h.com/a/b.html",
11208            "https://o.com/z",
11209            "https://o.com/z",
11210        ),
11211        ("http://h.com/a/b.html", "data:,hi", "data:,hi"),
11212        ("https://h.com/", "/p/q", "https://h.com/p/q"),
11213        ("http://h.com", "y", "http://h.com/y"),
11214        ("", "/api", "/api"),
11215        // `.`/`..` セグメント解決(以前は文字列結合のみで未解決のまま残っていた)。
11216        ("https://h.com/a/b/c", "../style.css", "https://h.com/a/style.css"),
11217        ("https://h.com/a/b/c", "./style.css", "https://h.com/a/b/style.css"),
11218        ("https://h.com/a/b/c/d", "../../x", "https://h.com/a/x"),
11219    ];
11220    total += resolve_cases.len();
11221    for (base, url, expect) in resolve_cases {
11222        let got = builtins::resolve_url(base, url);
11223        if &got == expect {
11224            passed += 1;
11225        } else {
11226            crate::println!(
11227                "JS_SELFTEST FAIL: resolve_url({:?},{:?}) => `{}` (want `{}`)",
11228                base,
11229                url,
11230                got,
11231                expect
11232            );
11233        }
11234    }
11235
11236    // HTML5 制約バリデーション(checkValidity / setCustomValidity / validity)。
11237    let validity_cases: &[(&str, &str, &str)] = &[
11238        // (html, script, expect)
11239        ("<input id='a' required value=''>", "document.getElementById('a').checkValidity()", "false"),
11240        ("<input id='a' required value='x'>", "document.getElementById('a').checkValidity()", "true"),
11241        ("<input id='a' value='hi'>", "document.getElementById('a').checkValidity()", "true"),
11242        ("<input id='a' type='email' value='nope'>", "document.getElementById('a').checkValidity()", "false"),
11243        ("<input id='a' type='email' value='x@y.com'>", "document.getElementById('a').checkValidity()", "true"),
11244        ("<input id='a' type='number' min='5' value='3'>", "document.getElementById('a').checkValidity()", "false"),
11245        ("<input id='a' type='number' min='5' value='9'>", "document.getElementById('a').checkValidity()", "true"),
11246        ("<input id='a' minlength='3' value='ab'>", "document.getElementById('a').checkValidity()", "false"),
11247        ("<input id='a' maxlength='2' value='abc'>", "document.getElementById('a').checkValidity()", "false"),
11248        ("<input id='a' value='ok'>", "var e=document.getElementById('a'); e.setCustomValidity('bad'); e.checkValidity()", "false"),
11249        ("<input id='a' value='ok'>", "var e=document.getElementById('a'); e.setCustomValidity('bad'); e.setCustomValidity(''); e.checkValidity()", "true"),
11250        ("<input id='a' required value=''>", "document.getElementById('a').validity.valueMissing", "true"),
11251        ("<input id='a' required value='x'>", "document.getElementById('a').validity.valid", "true"),
11252        ("<input id='a' value='hi'>", "document.getElementById('a').willValidate", "true"),
11253        ("<input id='a' type='submit'>", "document.getElementById('a').willValidate", "false"),
11254        // `pattern` 属性が以前はメタ文字を含む複雑なパターンを「誤検知回避のため」
11255        // 無条件で通過させる簡易近似だった。本物の RegExp エンジンで `^(?:pattern)$`
11256        // として正しく検証するよう修正(`\d+`/`[0-9]{3}` 等、通常の JS RegExp 構文)。
11257        ("<input id='a' pattern='[0-9]{3}' value='123'>", "document.getElementById('a').checkValidity()", "true"),
11258        ("<input id='a' pattern='[0-9]{3}' value='ab'>", "document.getElementById('a').checkValidity()", "false"),
11259        ("<input id='a' pattern='\\d+' value='123'>", "document.getElementById('a').checkValidity()", "true"),
11260        ("<input id='a' pattern='\\d+' value='abc'>", "document.getElementById('a').checkValidity()", "false"),
11261        // 空値は非 required なら pattern チェック自体を適用しない(仕様どおり)。
11262        ("<input id='a' pattern='[0-9]{3}' value=''>", "document.getElementById('a').checkValidity()", "true"),
11263        // `stepMismatch`(HTML5 制約検証。min/max はあったが step が丸ごと未対応だった)。
11264        ("<input id='a' type='number' step='2' value='4'>", "document.getElementById('a').checkValidity()", "true"),
11265        ("<input id='a' type='number' step='2' value='3'>", "document.getElementById('a').checkValidity()", "false"),
11266        // step の基準点は min(無ければ 0)。min=1, step=2 なら 1,3,5,... が有効。
11267        ("<input id='a' type='number' min='1' step='2' value='5'>", "document.getElementById('a').checkValidity()", "true"),
11268        ("<input id='a' type='number' min='1' step='2' value='4'>", "document.getElementById('a').checkValidity()", "false"),
11269        // `step=\"any\"` は制約なし。
11270        ("<input id='a' type='number' step='any' value='3.14159'>", "document.getElementById('a').checkValidity()", "true"),
11271        // `validity` オブジェクトが `valid`/`valueMissing`/`customError` の3つしか
11272        // 公開しておらず、`patternMismatch`/`typeMismatch`/`rangeOverflow`/
11273        // `rangeUnderflow`/`stepMismatch`/`tooLong`/`tooShort`/`badInput` という
11274        // 特定の制約を狙い撃ちする定番パターンが常に `undefined` になっていた。
11275        ("<input id='a' pattern='[0-9]{3}' value='ab'>", "document.getElementById('a').validity.patternMismatch", "true"),
11276        ("<input id='a' pattern='[0-9]{3}' value='123'>", "document.getElementById('a').validity.patternMismatch", "false"),
11277        ("<input id='a' type='email' value='nope'>", "document.getElementById('a').validity.typeMismatch", "true"),
11278        ("<input id='a' type='number' min='5' value='3'>", "document.getElementById('a').validity.rangeUnderflow", "true"),
11279        ("<input id='a' type='number' max='5' value='9'>", "document.getElementById('a').validity.rangeOverflow", "true"),
11280        ("<input id='a' type='number' step='2' value='3'>", "document.getElementById('a').validity.stepMismatch", "true"),
11281        ("<input id='a' maxlength='2' value='abc'>", "document.getElementById('a').validity.tooLong", "true"),
11282        ("<input id='a' minlength='3' value='ab'>", "document.getElementById('a').validity.tooShort", "true"),
11283        ("<input id='a' type='number' value='abc'>", "document.getElementById('a').validity.badInput", "true"),
11284        // **重要**: `<form>.checkValidity()` が子孫コントロールを一切見ず、`<form>`
11285        // タグ自身に対する検証(常に無条件で true)を返すだけだったバグ。
11286        (
11287            "<form id='f3'><input required value=''></form>",
11288            "document.getElementById('f3').checkValidity()",
11289            "false",
11290        ),
11291        (
11292            "<form id='f3'><input required value='x'></form>",
11293            "document.getElementById('f3').checkValidity()",
11294            "true",
11295        ),
11296        (
11297            "<form id='f3'><input required value='x'><input type='email' value='nope'></form>",
11298            "document.getElementById('f3').checkValidity()",
11299            "false",
11300        ),
11301        // `checkValidity()`/`.validationMessage`/`.validity`が`get_attr(idx,"value")`
11302        // だけを見ており、`value`属性を持たない`<select>`(選択状態は子の
11303        // `<option selected>`が持つ)や、初期値がテキストノードで表現される
11304        // `<textarea>`では、実際には値があっても常に空文字列=未入力として
11305        // 誤って`required`違反になっていたバグ。`.value`ゲッターは既に正しい
11306        // フォールバックを持っていたが、制約バリデーション側に伝わっていなかった。
11307        (
11308            "<select id='a' required><option value='x' selected>X</option></select>",
11309            "document.getElementById('a').checkValidity()",
11310            "true",
11311        ),
11312        (
11313            "<select id='a' required><option value='x' selected>X</option></select>",
11314            "document.getElementById('a').validity.valueMissing",
11315            "false",
11316        ),
11317        (
11318            "<textarea id='a' required>hello</textarea>",
11319            "document.getElementById('a').checkValidity()",
11320            "true",
11321        ),
11322        (
11323            "<textarea id='a' required></textarea>",
11324            "document.getElementById('a').checkValidity()",
11325            "false",
11326        ),
11327        (
11328            "<form id='f4'><select required><option value='x' selected>X</option></select></form>",
11329            "document.getElementById('f4').checkValidity()",
11330            "true",
11331        ),
11332        // `required`のcheckbox/radioは「値」でなく「チェック状態」で判定すべき
11333        // (HTML5仕様)だが、以前は他のinputと同じ「value属性が空か」で判定して
11334        // いたため、value属性を持たないcheckedなチェックボックスが常にrequired
11335        // 違反(valueが空文字列扱い)、逆にvalue属性だけ設定した未チェックの
11336        // チェックボックスが常に妥当、というチェック状態と無関係な結果になっていた。
11337        (
11338            "<input id='a' type='checkbox' required>",
11339            "document.getElementById('a').checkValidity()",
11340            "false",
11341        ),
11342        (
11343            "<input id='a' type='checkbox' required checked>",
11344            "document.getElementById('a').checkValidity()",
11345            "true",
11346        ),
11347        (
11348            "<input id='a' type='checkbox' value='yes' required>",
11349            "document.getElementById('a').validity.valueMissing",
11350            "true",
11351        ),
11352        (
11353            "<input id='a' type='checkbox' required checked>",
11354            "document.getElementById('a').validity.valueMissing",
11355            "false",
11356        ),
11357        // radioはグループ内のいずれかがcheckedであれば充足(自身がcheckedで
11358        // なくても良い)。
11359        (
11360            "<input id='a' type='radio' name='g' required><input type='radio' name='g' checked>",
11361            "document.getElementById('a').checkValidity()",
11362            "true",
11363        ),
11364        (
11365            "<input id='a' type='radio' name='g' required><input type='radio' name='g'>",
11366            "document.getElementById('a').checkValidity()",
11367            "false",
11368        ),
11369        // `type="range"`は`type="number"`と同じmin/max/step制約検証規則を持つ
11370        // (`.stepUp()`/`.valueAsNumber`は既に両者を同列に扱っていたが、
11371        // `validity.rangeOverflow`/`.rangeUnderflow`/`.stepMismatch`だけ
11372        // `number`型限定になっており、range型では常にfalse固定だった)。
11373        (
11374            "<input id='a' type='range' min='0' max='10' value='20'>",
11375            "document.getElementById('a').validity.rangeOverflow",
11376            "true",
11377        ),
11378        (
11379            "<input id='a' type='range' min='0' max='10' value='-5'>",
11380            "document.getElementById('a').validity.rangeUnderflow",
11381            "true",
11382        ),
11383        (
11384            "<input id='a' type='range' min='0' max='10' value='5'>",
11385            "document.getElementById('a').checkValidity()",
11386            "true",
11387        ),
11388        (
11389            "<input id='a' type='range' min='0' max='10' step='2' value='3'>",
11390            "document.getElementById('a').validity.stepMismatch",
11391            "true",
11392        ),
11393        // `type="date"`/`type="month"`の形式チェックが丸ごと未対応だった
11394        // (`input.valueAsDate`は既存の`input_value_as_date_ms()`で妥当性を
11395        // 判定していたが、`validity.typeMismatch`には配線されておらず、
11396        // 不正な日付文字列を代入しても常に`typeMismatch: false`だった)。
11397        (
11398            "<input id='a' type='date' value='2026-07-17'>",
11399            "document.getElementById('a').validity.typeMismatch",
11400            "false",
11401        ),
11402        (
11403            "<input id='a' type='date' value='not-a-date'>",
11404            "document.getElementById('a').validity.typeMismatch",
11405            "true",
11406        ),
11407        (
11408            "<input id='a' type='month' value='2026-07'>",
11409            "document.getElementById('a').checkValidity()",
11410            "true",
11411        ),
11412        (
11413            "<input id='a' type='date' value='2026-13-99'>",
11414            "document.getElementById('a').checkValidity()",
11415            "false",
11416        ),
11417        // `<input type="email" multiple>`はカンマ区切りで複数アドレスを入力できる
11418        // 仕様だが、以前は`is_valid_email(value)`を値全体にそのまま適用しており、
11419        // 2件目以降のアドレスやカンマを含む正当な値が常に不正判定されていた。
11420        (
11421            "<input id='a' type='email' multiple value='a@b.com,c@d.com'>",
11422            "document.getElementById('a').checkValidity()",
11423            "true",
11424        ),
11425        (
11426            "<input id='a' type='email' multiple value='a@b.com, c@d.com'>",
11427            "document.getElementById('a').checkValidity()",
11428            "true",
11429        ),
11430        (
11431            "<input id='a' type='email' multiple value='a@b.com,nope'>",
11432            "document.getElementById('a').checkValidity()",
11433            "false",
11434        ),
11435        (
11436            // `multiple`が無ければ従来どおりカンマ区切りは単一アドレスとして不正。
11437            "<input id='a' type='email' value='a@b.com,c@d.com'>",
11438            "document.getElementById('a').checkValidity()",
11439            "false",
11440        ),
11441        // `type="date"`/`type="month"`の`min`/`max`範囲制約(`type="number"`と同様に
11442        // 対応可能な仕様なのに丸ごと欠けていた)。
11443        (
11444            "<input id='a' type='date' min='2026-01-01' max='2026-12-31' value='2025-12-31'>",
11445            "document.getElementById('a').validity.rangeUnderflow",
11446            "true",
11447        ),
11448        (
11449            "<input id='a' type='date' min='2026-01-01' max='2026-12-31' value='2027-01-01'>",
11450            "document.getElementById('a').validity.rangeOverflow",
11451            "true",
11452        ),
11453        (
11454            "<input id='a' type='date' min='2026-01-01' max='2026-12-31' value='2026-06-15'>",
11455            "document.getElementById('a').checkValidity()",
11456            "true",
11457        ),
11458        (
11459            "<input id='a' type='month' min='2026-03' max='2026-09' value='2026-01'>",
11460            "document.getElementById('a').checkValidity()",
11461            "false",
11462        ),
11463        // `<fieldset disabled>`の子孫コントロールは自身に`disabled`属性が無くても
11464        // 暗黙に無効化される(HTML5仕様)。以前は要素自身の`disabled`属性しか
11465        // 見ておらず、`.disabled`が常に`false`・制約バリデーションも無効化
11466        // されずに常に対象内のままだった。
11467        (
11468            "<fieldset disabled><input id='a' required></fieldset>",
11469            "document.getElementById('a').disabled",
11470            "true",
11471        ),
11472        (
11473            "<fieldset disabled><input id='a' required></fieldset>",
11474            "document.getElementById('a').checkValidity()",
11475            "true",
11476        ),
11477        (
11478            "<fieldset><input id='a' required></fieldset>",
11479            "document.getElementById('a').disabled",
11480            "false",
11481        ),
11482        (
11483            // 無効化されている以上、値が実際には空でも valueMissing にはならない
11484            // (disabled要素は制約バリデーションの対象外という仕様どおり)。
11485            "<fieldset disabled><input id='a' required value=''></fieldset>",
11486            "document.getElementById('a').validity.valueMissing",
11487            "false",
11488        ),
11489        // `form="formId"`属性(HTML5仕様の「form owner」)による、`<form>`の外に
11490        // 置かれたコントロールとの明示的な関連付けが丸ごと未対応だった。
11491        // `element.form`は祖先探索(`closest_tag`)しか見ておらず、
11492        // `<form>.checkValidity()`もフォームの子孫しか走査していなかったため、
11493        // フォーム外配置のコントロールが両方から漏れていた。
11494        (
11495            "<form id='f5'></form><input id='a' form='f5'>",
11496            "document.getElementById('a').form === document.getElementById('f5')",
11497            "true",
11498        ),
11499        (
11500            "<form id='f5'></form><input id='a' form='f5' required>",
11501            "document.getElementById('f5').checkValidity()",
11502            "false",
11503        ),
11504        (
11505            "<form id='f5'></form><input id='a' form='f5' required value='x'>",
11506            "document.getElementById('f5').checkValidity()",
11507            "true",
11508        ),
11509        (
11510            // `form`属性が無い通常の input はこれまでどおり祖先探索のみ。
11511            "<div><input id='a'></div>",
11512            "document.getElementById('a').form",
11513            "null",
11514        ),
11515        // `type="datetime-local"`の`validity.typeMismatch`/`min`/`max`が丸ごと
11516        // 未対応だった。`input_value_as_date_ms()`は既存の`parse_iso_date`が
11517        // `YYYY-MM-DDTHH:MM`形式を既にサポートしているため、`date`/`month`と
11518        // 同じ扱いに含めるだけで対応できた。
11519        (
11520            "<input id='a' type='datetime-local' value='2026-07-17T14:30'>",
11521            "document.getElementById('a').validity.typeMismatch",
11522            "false",
11523        ),
11524        (
11525            "<input id='a' type='datetime-local' value='not-a-datetime'>",
11526            "document.getElementById('a').checkValidity()",
11527            "false",
11528        ),
11529        (
11530            "<input id='a' type='datetime-local' min='2026-01-01T00:00' max='2026-12-31T23:59' value='2025-06-01T00:00'>",
11531            "document.getElementById('a').validity.rangeUnderflow",
11532            "true",
11533        ),
11534        // `<details name="...">`排他グループの初期状態正規化(HTML5。
11535        // 丸ごと未対応だった)。同じ`name`を持つ複数の`<details open>`が
11536        // HTML記述時点で並んでいた場合、文書順で最後の1つだけが開いた
11537        // ままで残り、それより前のものは`build_from`(パース直後)の
11538        // 時点で自動的に閉じられる必要がある。2026-07-18 発見・実装)。
11539        (
11540            "<details id='a' name='g' open></details><details id='b' name='g' open></details>",
11541            "document.getElementById('a').open+','+document.getElementById('b').open",
11542            "false,true",
11543        ),
11544        (
11545            "<details id='a' name='g' open></details><details id='b' open></details>",
11546            "document.getElementById('a').open+','+document.getElementById('b').open",
11547            "true,true",
11548        ),
11549        // `HTMLCollection` / `HTMLFormControlsCollection` の `item(index)` / `namedItem(name)`
11550        // および `classList.value` ゲッター/セッター。
11551        (
11552            "<div id='wrap'><p id='t' name='foo'></p><span id='s'></span></div>",
11553            "document.getElementById('wrap').children.item(0).id + ',' + document.getElementById('wrap').children.namedItem('s').tagName + ',' + document.getElementById('wrap').children.namedItem('foo').id",
11554            "t,SPAN,t",
11555        ),
11556        (
11557            "<div id='wrap'><span></span></div>",
11558            "String(document.getElementById('wrap').children.item(99))",
11559            "null",
11560        ),
11561        (
11562            "<form id='f'><input id='i' name='user'></form>",
11563            "document.getElementById('f').elements.item(0).id + ',' + document.getElementById('f').elements.namedItem('user').id",
11564            "i,i",
11565        ),
11566        (
11567            "<form id='f'><input type='radio' name='r' value='v1'><input type='radio' name='r' value='v2' checked></form>",
11568            "var f=document.getElementById('f'); var list=f.elements.namedItem('r'); var v1=list.value; var len=list.length; list.value='v1'; var v2=list.value; var c0=list[0].checked; v1+','+len+','+v2+','+c0",
11569            "v2,2,v1,true",
11570        ),
11571        (
11572            "<div id='d' class='a b'></div>",
11573            "var d=document.getElementById('d'); var v=d.classList.value; d.classList.value='c d'; v+','+d.className",
11574            "a b,c d",
11575        ),
11576    ];
11577    total += validity_cases.len();
11578    for (html, src, expect) in validity_cases {
11579        let mut rt = JsRuntime::new();
11580        rt.dom()
11581            .borrow_mut()
11582            .build_from(&crate::os_lib::dom::parse_html(html));
11583        match rt.eval(src) {
11584            Ok(v) if &v.to_js_string() == expect => passed += 1,
11585            Ok(v) => crate::println!(
11586                "JS_SELFTEST FAIL: `{}` => `{}` (want `{}`)",
11587                src,
11588                v.to_js_string(),
11589                expect
11590            ),
11591            Err(e) => crate::println!("JS_SELFTEST ERR:  `{}` => {}", src, e),
11592        }
11593    }
11594
11595    // ES modules(import/export): 複数モジュールを define_module で登録し、
11596    // import 側スクリプトを評価して名前解決・default・namespace・再エクスポートを検証。
11597    {
11598        // 単純な named export を持つ算術モジュール。
11599        let math_src = "export const PI = 3; export function sq(x){ return x*x; } \
11600                        const e = 2; export { e as E };";
11601        // default export と named export の混在。
11602        let greet_src = "export default function(n){ return 'hi ' + n; } \
11603                          export const lang = 'ja';";
11604        // 別モジュールからの再エクスポート(集約モジュール)。
11605        let index_src = "export { PI, sq } from 'math'; export * from 'math';";
11606        // 循環 import: a は b を import し、b は a を import する。
11607        let cyc_a = "import { bVal } from 'cycb'; export const aVal = 10; \
11608                      export function getB(){ return bVal; }";
11609        let cyc_b = "import { aVal } from 'cyca'; export const bVal = 20;";
11610
11611        let module_checks: &[(&str, &str)] = &[
11612            // named import + 関数呼び出し。
11613            ("import { PI, sq } from 'math'; sq(PI)", "9"),
11614            // as による別名 export を import。
11615            ("import { E } from 'math'; E", "2"),
11616            // default import。
11617            ("import greet from 'greet'; greet('bob')", "hi bob"),
11618            // default + named を同時 import。
11619            ("import greet, { lang } from 'greet'; greet(lang)", "hi ja"),
11620            // namespace import。
11621            ("import * as M from 'math'; M.sq(4) + M.PI", "19"),
11622            // 再エクスポート(named)。
11623            ("import { PI } from 'index'; PI", "3"),
11624            // 再エクスポート(export *)経由の関数。
11625            ("import { sq } from 'index'; sq(5)", "25"),
11626            // 循環 import: a 経由で b の値を取得。
11627            ("import { getB } from 'cyca'; getB()", "20"),
11628            // 副作用のみ import(エラーにならず undefined 評価が通ること)。
11629            ("import 'math'; 42", "42"),
11630        ];
11631        total += module_checks.len();
11632        for (src, expect) in module_checks {
11633            let mut rt = JsRuntime::new();
11634            rt.define_module("math", math_src);
11635            rt.define_module("greet", greet_src);
11636            rt.define_module("index", index_src);
11637            rt.define_module("cyca", cyc_a);
11638            rt.define_module("cycb", cyc_b);
11639            match rt.eval(src) {
11640                Ok(v) if &v.to_js_string() == expect => passed += 1,
11641                Ok(v) => crate::println!(
11642                    "JS_SELFTEST FAIL: `{}` => `{}` (want `{}`)",
11643                    src,
11644                    v.to_js_string(),
11645                    expect
11646                ),
11647                Err(e) => crate::println!("JS_SELFTEST ERR:  `{}` => {}", src, e),
11648            }
11649        }
11650    }
11651
11652    // `window.scrollTo(x, y)`/`window.scrollBy(x, y)`(丸ごと未対応だった。
11653    // 以前は`scrollTo`が孤立した`SCROLL_Y` staticへ書くだけ、`scrollBy`は
11654    // `dom_noop`のままで、どちらも`window.scrollY`や実際の描画位置に一切
11655    // 反映されない死んだ経路だった。2026-07-16 発見・実装)。実際の視覚的
11656    // 反映は`web_engine/render.rs`の`draw()`側で行われヘッドレスJS自己テスト
11657    // からは駆動できないため、ここではJS→`DomBridge`への配線(`window_
11658    // scroll_to`/`window_scroll_by`が正しい保留値を書き込むこと)のみを
11659    // 直接Rustレベルで検証する。
11660    {
11661        total += 1;
11662        let mut rt = JsRuntime::new();
11663        let _ = rt.eval("window.scrollTo(0, 120);");
11664        let y = rt.dom().borrow().pending_scroll_abs_y;
11665        if y == Some(120) {
11666            passed += 1;
11667        } else {
11668            crate::println!(
11669                "JS_SELFTEST FAIL: window.scrollTo pending_scroll_abs_y => `{:?}` (want `Some(120)`)",
11670                y
11671            );
11672        }
11673    }
11674    {
11675        total += 1;
11676        let mut rt = JsRuntime::new();
11677        let _ = rt.eval("window.scrollBy(0, 30); window.scrollBy(0, 15);");
11678        let dy = rt.dom().borrow().pending_scroll_by_y;
11679        if dy == Some(45) {
11680            passed += 1;
11681        } else {
11682            crate::println!(
11683                "JS_SELFTEST FAIL: window.scrollBy pending_scroll_by_y (累積) => `{:?}` (want `Some(45)`)",
11684                dy
11685            );
11686        }
11687    }
11688    // `element.scrollIntoView()`が丸ごとno-opだった(実サイト www.sugi-lab.net の
11689    // ナビゲーションリンクの`target.scrollIntoView({behavior:'smooth',
11690    // block:'start'})`が完全に無効化されていた。2026-07-22発見・修正)。
11691    // `window.scrollTo`と同じ`pending_scroll_abs_y`機構を再利用しているかを
11692    // 直接Rustレベルで検証する(対象要素のY座標250px、scrollY=0の状態から
11693    // `scrollIntoView()`を呼ぶと、絶対Y座標250へスクロールする保留値が
11694    // 設定されるはず)。
11695    {
11696        total += 1;
11697        let mut rt = JsRuntime::new();
11698        rt.dom()
11699            .borrow_mut()
11700            .build_from(&crate::os_lib::dom::parse_html("<div id='t'></div>"));
11701        let idx = rt.dom().borrow().get_element_by_id("t");
11702        if let Some(i) = idx {
11703            rt.dom().borrow_mut().set_rect(i, 0, 250, 100, 50);
11704        }
11705        let _ = rt.eval("document.getElementById('t').scrollIntoView();");
11706        let y = rt.dom().borrow().pending_scroll_abs_y;
11707        if y == Some(250) {
11708            passed += 1;
11709        } else {
11710            crate::println!(
11711                "JS_SELFTEST FAIL: element.scrollIntoView pending_scroll_abs_y => `{:?}` (want `Some(250)`)",
11712                y
11713            );
11714        }
11715    }
11716
11717    let dom_parser_cases: &[(&str, &str)] = &[
11718        (
11719            "var p = new DOMParser(); var doc = p.parseFromString('<div id=\"dp\">hello</div>', 'text/html'); doc.getElementById('dp').textContent",
11720            "hello",
11721        ),
11722        (
11723            "var p = new DOMParser(); var doc = p.parseFromString('<svg viewBox=\"0 0 100 100\"><clipPath id=\"cp\"><rect width=\"50\"/></clipPath></svg>', 'image/svg+xml'); doc.contentType === 'image/svg+xml' && doc.documentElement.tagName === 'svg' && doc.querySelector('clipPath').getAttribute('id') === 'cp' && doc.querySelector('rect').getAttribute('width') === '50'",
11724            "true",
11725        ),
11726        (
11727            "var p = new DOMParser(); var doc = p.parseFromString('<root><child></other></root>', 'application/xml'); var errs = doc.getElementsByTagName('parsererror'); errs.length === 1 && errs[0].textContent.includes('XML Parsing Error')",
11728            "true",
11729        ),
11730        (
11731            "var ok = false; try { new DOMParser().parseFromString('<a/>', 'text/invalid'); } catch(e) { ok = e.toString().includes('TypeError'); }; ok",
11732            "true",
11733        ),
11734    ];
11735    total += dom_parser_cases.len();
11736    for (code, expect) in dom_parser_cases {
11737        let mut rt = JsRuntime::new();
11738        let res = rt.eval(code);
11739        let got = res.map(|v| v.to_js_string()).unwrap_or_else(|e| alloc::format!("ERR: {:?}", e));
11740        if &got == expect {
11741            passed += 1;
11742        } else {
11743            crate::println!(
11744                "JS_SELFTEST FAIL: DOMParser code {:?} => `{}` (want `{}`)",
11745                code,
11746                got,
11747                expect
11748            );
11749        }
11750    }
11751
11752    // DOMMatrix / DOMPoint / URLPattern / Iterator.concat / Iterator.from 自己テスト
11753    let geom_web_cases = [
11754        ("const m = new DOMMatrix([1,0,0,1,10,20]); m.a === 1 && m.e === 10", "true"),
11755        ("const m = new DOMMatrix(); m.translateSelf(10, 20); m.e === 10 && m.f === 20", "true"),
11756        ("const m = new DOMMatrix(); m.scaleSelf(2, 3); m.a === 2 && m.d === 3", "true"),
11757        ("const m = new DOMMatrix(); const p = new DOMPoint(5, 10); const p2 = m.translate(10, 20).transformPoint(p); p2.x === 15 && p2.y === 30", "true"),
11758        ("const m2 = DOMMatrix.fromMatrix({a: 2, d: 3, e: 5, f: 10}); m2.a === 2 && m2.e === 5", "true"),
11759        ("const p3 = new DOMPoint(1, 2).matrixTransform(new DOMMatrix([2,0,0,3,10,20])); p3.x === 12 && p3.y === 26", "true"),
11760        ("const pat = new URLPattern({ pathname: '/api/*' }); pat.test('/api/users')", "true"),
11761        ("const res = new URLPattern({ pathname: '/users/:id' }).exec('https://example.com/users/42'); res.pathname.groups.id", "42"),
11762        ("const it = Iterator.concat([1, 2], [3, 4]); it.toArray().join(',')", "1,2,3,4"),
11763        ("const it = Iterator.from([10, 20, 30]); it.take(2).toArray().join(',')", "10,20"),
11764        ("new Intl.DurationFormat('en', {style:'long'}).format({hours:1, minutes:30})", "1 hour, 30 minutes"),
11765        ("new Intl.DurationFormat('en').resolvedOptions().locale", "en-US"),
11766        ("Iterator.range(1, 5).toArray().join(',')", "1,2,3,4"),
11767        ("Iterator.range(0, 10, 2).toArray().join(',')", "0,2,4,6,8"),
11768        ("Iterator.range(5, 1, -1).toArray().join(',')", "5,4,3,2"),
11769    ];
11770    total += geom_web_cases.len();
11771    for (code, expect) in geom_web_cases {
11772        let mut rt = JsRuntime::new();
11773        let res = rt.eval(code);
11774        let got = res.map(|v| v.to_js_string()).unwrap_or_else(|e| alloc::format!("ERR: {:?}", e));
11775        if got == expect {
11776            passed += 1;
11777        } else {
11778            crate::println!(
11779                "JS_SELFTEST FAIL: Geom/Web API code {:?} => `{}` (want `{}`)",
11780                code,
11781                got,
11782                expect
11783            );
11784        }
11785    }
11786
11787    let template_html = r#"<div><template id="tmpl"><span>Hello</span></template></div>"#;
11788    let template_cases = [
11789        ("document.createElement('template') instanceof HTMLTemplateElement", "true"),
11790        ("const t = document.createElement('template'); t.content.nodeType === 11", "true"),
11791        ("const t = document.getElementById('tmpl'); t.content.childNodes.length", "1"),
11792        ("const t = document.getElementById('tmpl'); t.content.children[0].tagName", "SPAN"),
11793        ("const t = document.getElementById('tmpl'); const f = t.content.cloneNode(true); f.nodeType === 11 && f.children[0].textContent === 'Hello'", "true"),
11794        ("const s = document.createElement('select'); const o = document.createElement('option'); o.value='v1'; o.text='t1'; s.add(o); s.options.length === 1 && s.value === 'v1'", "true"),
11795        ("const u = new URL('https://www.sugi-lab.net/?a=1'); u.searchParams.set('b', '2'); u.search === '?a=1&b=2'", "true"),
11796        ("const div = document.createElement('div'); div.setAttribute('id', 'd1'); const c = div.cloneNode(true); c.id === 'd1' && c !== div", "true"),
11797        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx !== null && ctx.canvas === cv", "true"),
11798        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.measureText('test').width > 0", "true"),
11799        ("const cv = document.createElement('canvas'); cv.toDataURL().startsWith('data:image/png;base64,')", "true"),
11800        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.lineWidth = 10; ctx.reset(); ctx.lineWidth === 1", "true"),
11801        ("const p = new Path2D('M10 10 H 90 V 90 H 10 Z'); typeof p.moveTo === 'function' && typeof p.roundRect === 'function'", "true"),
11802        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); const p = new Path2D('M 10 10 H 90 V 90 Z'); ctx.fill(p); ctx.stroke(p); ctx.clip(p); true", "true"),
11803        ("const p1 = new Path2D(); p1.rect(0, 0, 10, 10); const p2 = new Path2D(p1); p2.addPath(p1); typeof p2.closePath === 'function'", "true"),
11804        ("const div = document.createElement('div'); div.getRootNode() === div", "true"),
11805        ("const div = document.getElementById('tmpl'); div.getRootNode() === document", "true"),
11806        ("const el = document.createElement('div'); document.adoptNode(el) === el", "true"),
11807        ("const el = document.createElement('div'); document.importNode(el, true) !== null", "true"),
11808        ("ArrayBuffer.isView(new Uint8Array(5)) && !ArrayBuffer.isView(new ArrayBuffer(5))", "true"),
11809        ("Math.clamp(15, 0, 10) === 10 && Math.clamp(-5, 0, 10) === 0 && Math.clamp(5, 0, 10) === 5", "true"),
11810        ("const io = new IntersectionObserver(()=>{}); typeof io.takeRecords === 'function' && io.takeRecords().length === 0", "true"),
11811        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.fillStyle = 'red'; ctx.save(); ctx.fillStyle = 'blue'; ctx.restore(); ctx.fillStyle === 'red'", "true"),
11812        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.strokeStyle = 'green'; ctx.font = '24px serif'; ctx.save(); ctx.strokeStyle = 'purple'; ctx.font = '12px sans-serif'; ctx.restore(); ctx.strokeStyle === 'green' && ctx.font === '24px serif'", "true"),
11813        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); typeof ctx.strokeText === 'function'", "true"),
11814        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.imageSmoothingEnabled === true", "true"),
11815        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.imageSmoothingEnabled = false; ctx.imageSmoothingEnabled === false", "true"),
11816        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.imageSmoothingEnabled = false; ctx.save(); ctx.imageSmoothingEnabled = true; ctx.restore(); ctx.imageSmoothingEnabled === false", "true"),
11817        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); const g = ctx.createLinearGradient(0, 0, 100, 0); g.addColorStop(0, 'red'); g.addColorStop(1, 'blue'); ctx.fillStyle = g; typeof ctx.fillRect === 'function'", "true"),
11818        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); const g = ctx.createRadialGradient(50, 50, 0, 50, 50, 50); g.addColorStop(0, 'white'); g.addColorStop(1, 'black'); ctx.fillStyle = g; ctx.fillRect(0, 0, 100, 100); true", "true"),
11819        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.beginPath(); ctx.moveTo(0, 0); ctx.arcTo(100, 0, 100, 100, 20); ctx.stroke(); typeof ctx.arcTo === 'function'", "true"),
11820        ("const p = new Path2D(); p.moveTo(0, 0); p.arcTo(50, 0, 50, 50, 10); typeof p.arcTo === 'function'", "true"),
11821        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); const g = ctx.createConicGradient(0, 50, 50); g.addColorStop(0, 'red'); g.addColorStop(1, 'yellow'); ctx.fillStyle = g; ctx.fillRect(0, 0, 100, 100); true", "true"),
11822        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.beginPath(); ctx.rect(10, 10, 80, 80); ctx.isPointInPath(50, 50) === true && ctx.isPointInPath(5, 5) === false", "true"),
11823        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.beginPath(); ctx.moveTo(0, 50); ctx.lineTo(100, 50); ctx.lineWidth = 10; ctx.isPointInStroke(50, 52) === true && ctx.isPointInStroke(50, 60) === false", "true"),
11824        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); const m = ctx.getTransform(); m.a === 1 && m.d === 1 && m.e === 0 && m.f === 0 && m.is2D === true && m.isIdentity === true", "true"),
11825        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.translate(30, 40); ctx.scale(2, 3); const m = ctx.getTransform(); m.a === 2 && m.d === 3 && m.e === 30 && m.f === 40 && m.isIdentity === false", "true"),
11826        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.setTransform(1, 2, 3, 4, 5, 6); const m = ctx.getTransform(); m.a === 1 && m.b === 2 && m.c === 3 && m.d === 4 && m.e === 5 && m.f === 6", "true"),
11827        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.beginPath(); ctx.roundRect(0, 0, 100, 100, [10, 20]); true", "true"),
11828        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); let caught = false; try { ctx.roundRect(0, 0, 10, 10, -5); } catch (e) { caught = e.name === 'RangeError'; } caught", "true"),
11829        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); let caught = false; try { ctx.roundRect(0, 0, 10, 10, [1, 2, 3, 4, 5]); } catch (e) { caught = e.name === 'RangeError'; } caught", "true"),
11830        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); let caught = false; try { ctx.roundRect(0, 0, 10, 10, []); } catch (e) { caught = e.name === 'RangeError'; } caught", "true"),
11831        ("let caught = false; try { const p = new Path2D(); p.roundRect(0, 0, 10, 10, -1); } catch (e) { caught = e.name === 'RangeError'; } caught", "true"),
11832        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.shadowColor === 'rgba(0, 0, 0, 0)' && ctx.shadowBlur === 0 && ctx.shadowOffsetX === 0 && ctx.shadowOffsetY === 0", "true"),
11833        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.shadowColor = 'red'; ctx.shadowBlur = 5; ctx.shadowOffsetX = 10; ctx.shadowOffsetY = 15; ctx.shadowColor === 'red' && ctx.shadowBlur === 5 && ctx.shadowOffsetX === 10 && ctx.shadowOffsetY === 15", "true"),
11834        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.shadowColor = 'red'; ctx.shadowOffsetX = 8; ctx.save(); ctx.shadowColor = 'blue'; ctx.shadowOffsetX = 20; ctx.restore(); ctx.shadowColor === 'red' && ctx.shadowOffsetX === 8", "true"),
11835        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.shadowColor = 'rgba(0,0,0,0.5)'; ctx.shadowOffsetX = 4; ctx.shadowOffsetY = 4; ctx.fillRect(0, 0, 50, 50); ctx.strokeRect(0, 0, 50, 50); ctx.fillText('test', 10, 10); ctx.strokeText('test', 10, 30); true", "true"),
11836        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.filter === 'none'", "true"),
11837        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.filter = 'blur(5px) grayscale(100%)'; ctx.filter === 'blur(5px) grayscale(100%)'", "true"),
11838        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.filter = 'invert(100%)'; ctx.save(); ctx.filter = 'contrast(200%)'; ctx.restore(); ctx.filter === 'invert(100%)'", "true"),
11839        ("const p = new Path2D('M 0 0 A 50 50 0 0 1 100 0'); const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.fill(p); ctx.stroke(p); true", "true"),
11840        ("const p = new Path2D('M 0 0 Q 10 20 50 0 T 100 0 Z'); const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.fill(p); true", "true"),
11841        ("const p1 = new Path2D(); const p2 = new Path2D('M 10 10 L 20 20'); p1.addPath(p2, {a: 1, b: 0, c: 0, d: 1, e: 100, f: 100}); const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.stroke(p1); true", "true"),
11842        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.globalCompositeOperation === 'source-over'", "true"),
11843        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.globalCompositeOperation = 'destination-out'; ctx.save(); ctx.globalCompositeOperation = 'lighter'; ctx.restore(); ctx.globalCompositeOperation === 'destination-out'", "true"),
11844        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.globalCompositeOperation = 'destination-out'; ctx.fillRect(0, 0, 10, 10); true", "true"),
11845        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); const img = ctx.createImageData(2, 2); const pat = ctx.createPattern(img, 'repeat'); typeof pat === 'object' && typeof pat.setTransform === 'function'", "true"),
11846        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); const img = ctx.createImageData(2, 2); const pat = ctx.createPattern(img, 'repeat'); pat.setTransform({a: 2, b: 0, c: 0, d: 2, e: 10, f: 10}); ctx.fillStyle = pat; ctx.fillRect(0, 0, 50, 50); true", "true"),
11847        ("const cv1 = document.createElement('canvas'); cv1.width = 10; cv1.height = 10; const cv2 = document.createElement('canvas'); const ctx2 = cv2.getContext('2d'); const pat = ctx2.createPattern(cv1, 'no-repeat'); ctx2.fillStyle = pat; ctx2.beginPath(); ctx2.rect(0, 0, 100, 100); ctx2.fill(); true", "true"),
11848        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.direction === 'inherit'", "true"),
11849        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.direction = 'rtl'; ctx.direction === 'rtl'", "true"),
11850        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.direction = 'rtl'; ctx.save(); ctx.direction = 'ltr'; ctx.restore(); ctx.direction === 'rtl'", "true"),
11851        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.direction = 'rtl'; ctx.textAlign = 'start'; ctx.fillText('abc', 100, 100); ctx.strokeText('abc', 100, 100); true", "true"),
11852        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); const g = ctx.createLinearGradient(0, 0, 100, 0); g.addColorStop(0, 'red'); g.addColorStop(1, 'blue'); ctx.strokeStyle = g; ctx.lineWidth = 4; ctx.strokeRect(10, 10, 80, 80); true", "true"),
11853        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); const g = ctx.createLinearGradient(0, 0, 100, 0); g.addColorStop(0, 'red'); g.addColorStop(1, 'blue'); ctx.strokeStyle = g; ctx.lineWidth = 4; ctx.beginPath(); ctx.moveTo(10, 10); ctx.lineTo(90, 90); ctx.stroke(); true", "true"),
11854        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); const img = ctx.createImageData(2, 2); const pat = ctx.createPattern(img, 'repeat'); ctx.strokeStyle = pat; ctx.lineWidth = 6; ctx.strokeRect(10, 10, 80, 80); true", "true"),
11855        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); const img = ctx.createImageData(100, 50); img.width === 100 && img.height === 50 && img.data.length === 20000 && img.colorSpace === 'srgb'", "true"),
11856        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); const img = ctx.createImageData(10, 10, { colorSpace: 'display-p3' }); img.colorSpace === 'display-p3'", "true"),
11857        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); const img1 = ctx.createImageData(20, 30); const img2 = ctx.createImageData(img1); img2.width === 20 && img2.height === 30 && img2.colorSpace === 'srgb'", "true"),
11858        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.fillStyle = 'red'; ctx.fillRect(0, 0, 10, 10); const d = ctx.getImageData(0, 0, 2, 2, { colorSpace: 'display-p3' }); d.width === 2 && d.height === 2 && d.data[0] === 255 && d.data[1] === 0 && d.data[2] === 0 && d.data[3] === 255 && d.colorSpace === 'display-p3'", "true"),
11859        ("const img = new ImageData(30, 20); img.width === 30 && img.height === 20 && img.colorSpace === 'srgb'", "true"),
11860        ("const img = new ImageData(30, 20, { colorSpace: 'display-p3' }); img.colorSpace === 'display-p3'", "true"),
11861        ("typeof window.ImageData === 'function' && typeof ImageData === 'function'", "true"),
11862        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.beginPath(); ctx.moveTo(0, 50); ctx.lineTo(100, 50); ctx.lineWidth = 10; ctx.setLineDash([20, 20]); ctx.isPointInStroke(10, 50) === true && ctx.isPointInStroke(30, 50) === false", "true"),
11863        ("const cv = document.createElement('canvas'); const ctx = cv.getContext('2d'); ctx.lineWidth = 10; const p = new Path2D('M 0 50 L 100 50'); ctx.isPointInStroke(p, 50, 50) === true && ctx.isPointInStroke(p, 60) === false", "true"),
11864        ("const ro = new ResizeObserver(()=>{}); typeof ro.unobserve === 'function' && typeof ro.disconnect === 'function'", "true"),
11865        ("let count = 0; const el = document.createElement('div'); const ro = new ResizeObserver(entries => { count += entries.length; }); ro.observe(el); ro.observe(el); count === 1", "true"),
11866        ("let count = 0; const el = document.createElement('div'); const ro = new ResizeObserver(entries => { count++; }); ro.unobserve(el); ro.disconnect(); count === 0", "true"),
11867        ("let matchTarget = false; const el = document.createElement('div'); const ro = new ResizeObserver(entries => { matchTarget = (entries[0].target === el); }); ro.observe(el, { box: 'border-box' }); matchTarget === true", "true"),
11868        ("NodeFilter.SHOW_ELEMENT === 1 && NodeFilter.FILTER_ACCEPT === 1 && NodeFilter.FILTER_REJECT === 2 && NodeFilter.FILTER_SKIP === 3", "true"),
11869        ("window.NodeFilter.SHOW_ALL === 0xFFFFFFFF && NodeFilter.SHOW_TEXT === 4", "true"),
11870        ("const root = document.createElement('div'); const tw = document.createTreeWalker(root, NodeFilter.SHOW_ALL); tw.root === root && tw.currentNode === root", "true"),
11871        ("const p = document.createElement('p'); const b = document.createElement('b'); p.appendChild(b); const tw = document.createTreeWalker(p, NodeFilter.SHOW_ELEMENT); tw.firstChild() === b && tw.currentNode === b && tw.parentNode() === p", "true"),
11872        ("const div = document.createElement('div'); const s1 = document.createElement('span'); const s2 = document.createElement('b'); div.appendChild(s1); div.appendChild(s2); const tw = document.createTreeWalker(div, NodeFilter.SHOW_ELEMENT, (n) => n.tagName === 'SPAN' ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP); tw.nextNode() === s1 && tw.nextNode() === null", "true"),
11873        ("const div = document.createElement('div'); const c1 = document.createElement('p'); const c2 = document.createElement('span'); div.appendChild(c1); div.appendChild(c2); const ni = document.createNodeIterator(div, NodeFilter.SHOW_ELEMENT); ni.root === div && ni.referenceNode === div && ni.pointerBeforeReferenceNode === true", "true"),
11874        ("const div = document.createElement('div'); const c1 = document.createElement('p'); div.appendChild(c1); const ni = document.createNodeIterator(div, NodeFilter.SHOW_ELEMENT); ni.nextNode() === div && ni.nextNode() === c1 && ni.nextNode() === null && ni.previousNode() === c1", "true"),
11875        ("typeof document.createRange().createContextualFragment === 'function'", "true"),
11876        ("const r = document.createRange(); const frag = r.createContextualFragment('<span>A</span><b>B</b>'); frag.nodeType === 11 && frag.childNodes.length === 2 && frag.childNodes[0].tagName === 'SPAN'", "true"),
11877        ("const r = document.createRange(); const frag = r.createContextualFragment('<div>Hello</div>'); const container = document.createElement('div'); container.appendChild(frag); container.children.length === 1 && container.children[0].textContent === 'Hello'", "true"),
11878        ("const table = document.createElement('table'); const r = document.createRange(); r.selectNodeContents(table); const frag = r.createContextualFragment('<tr><td>Cell</td></tr>'); frag.childNodes.length === 1 && frag.childNodes[0].tagName === 'TR'", "true"),
11879        ("MediaSource.isTypeSupported('video/mp4; codecs=\"avc1.4d401f\"; width=1280; height=720; framerate=30') && !MediaSource.isTypeSupported('video/mp4; codecs=\"avc1.4d401f\"; width=99999') && !MediaSource.isTypeSupported('video/mp4; codecs=\"avc1.4d401f\"; framerate=999')", "true"),
11880        ("const ms = new MediaSource(); const sb = ms.addSourceBuffer('video/mp4; codecs=\"avc1.4d401f\"'); sb.mode === 'segments' && sb.timestampOffset === 0 && sb.appendWindowStart === 0 && sb.appendWindowEnd === Infinity", "true"),
11881        ("const v = document.createElement('video'); const ms = new MediaSource(); v.src = URL.createObjectURL(ms); v.volume = 0.5; v.playbackRate = 1.5; const q = v.getVideoPlaybackQuality(); v.networkState === 2 && v.volume === 0.5 && v.playbackRate === 1.5 && typeof q.totalVideoFrames === 'number'", "true"),
11882        ("const ms = new MediaSource(); const sb = ms.addSourceBuffer('video/mp4; codecs=\"avc1.42E01E\"'); sb.changeType('video/mp4; codecs=\"avc1.640028\"'); ms.setLiveSeekableRange(5, 30); ms.clearLiveSeekableRange(); sb.mimeType === 'video/mp4; codecs=\"avc1.640028\"'", "true"),
11883        ("let fsCount = 0; document.addEventListener('fullscreenchange', () => { fsCount++; }); const el = document.getElementById('tmpl'); el.webkitRequestFullscreen(); const inFs = (document.webkitFullscreenElement === el); document.webkitExitFullscreen(); inFs && document.fullscreenElement === null && fsCount === 2", "true"),
11884        // この試験群の文書(`template_html`)は `<body>` を持たない断片なので、`document.body` ではなく
11885        // 既存の `<div>` へ繋ぐ(2026-10-27。`document.body` が null で例外になっていた)。
11886        ("const host = document.createElement('div'); const sr = host.attachShadow({mode:'open'}); const child = document.createElement('span'); sr.appendChild(child); document.getElementById('tmpl').parentNode.appendChild(host); child.isConnected === true && child.getRootNode() === sr && child.getRootNode({composed: true}) === document", "true"),
11887        ("const host = document.createElement('div'); const sr = host.attachShadow({mode:'open'}); const child = document.createElement('span'); child.id = 'inner'; sr.appendChild(child); sr.getElementById('inner') === child", "true"),
11888        // A2: 組込みメソッドのシングルトンキャッシュ&同名・別型メソッドの非衝突検証
11889        ("(function(){}).bind === (function(){}).bind && Promise.resolve(1).then === Promise.resolve(2).then && (new Map()).get === (new Map()).get && (new Set()).add === (new Set()).add && (/a/).test === (/b/).test && (new Date()).getTime === (new Date()).getTime && localStorage.getItem === localStorage.getItem && [].slice !== ''.slice && [1,2,3].slice(1).join(',') === '2,3' && 'hello'.slice(1) === 'ello'", "true"),
11890    ];
11891    total += template_cases.len();
11892    for (src, expect) in template_cases {
11893        let mut rt = JsRuntime::new();
11894        rt.dom()
11895            .borrow_mut()
11896            .build_from(&crate::os_lib::dom::parse_html(template_html));
11897        match rt.eval(src) {
11898            Ok(v) if v.to_js_string() == expect => passed += 1,
11899            Ok(v) => crate::println!(
11900                "JS_SELFTEST FAIL: Template test `{}` => `{}` (want `{}`)",
11901                src,
11902                v.to_js_string(),
11903                expect
11904            ),
11905            Err(e) => crate::println!("JS_SELFTEST ERR:  Template test `{}` => {}", src, e),
11906        }
11907    }
11908
11909    // 子 `<iframe>` の `window.parent` / `window.top` 分離およびフレーム間 `postMessage` 配送の検証
11910    {
11911        total += 1;
11912        let mut child_rt = JsRuntime::new();
11913        child_rt.set_page_url("https://www.youtube.com/embed/abc");
11914        child_rt.set_frame_depth(1);
11915        let check = child_rt
11916            .eval("window.self !== window.parent && window.self !== window.top && (window.parent.postMessage('yt-ready', '*'), true)")
11917            .map(|v| v.to_js_string())
11918            .unwrap_or_default();
11919        let queued = child_rt.dom().borrow_mut().pending_parent_messages.pop();
11920        let mut parent_rt = JsRuntime::new();
11921        let _ = parent_rt.eval("window._gotMsg = ''; window.addEventListener('message', e => { window._gotMsg = e.data + '@' + e.origin; });");
11922        if let Some((data, origin)) = queued {
11923            parent_rt.deliver_message(data, &origin);
11924        }
11925        let parent_got = parent_rt
11926            .eval("window._gotMsg")
11927            .map(|v| v.to_js_string())
11928            .unwrap_or_default();
11929        if check == "true" && parent_got == "yt-ready@https://www.youtube.com" {
11930            passed += 1;
11931        } else {
11932            crate::println!(
11933                "JS_SELFTEST FAIL: cross-frame postMessage check={} parent_got={}",
11934                check,
11935                parent_got
11936            );
11937        }
11938    }
11939
11940    // 親から子への `iframe.contentWindow` プロキシプロパティおよび `iframe.contentWindow.postMessage` 配送検証
11941    {
11942        total += 1;
11943        let mut parent_rt = JsRuntime::new();
11944        parent_rt.set_page_url("https://www.youtube.com/watch?v=123");
11945        // `querySelector` で見つかるよう、iframe を含む文書を組む(`JsRuntime::new()`
11946        // の文書は空で、`create_element` で作っただけの要素は文書の外)。
11947        parent_rt.dom().borrow_mut().build_from(&crate::os_lib::dom::parse_html(
11948            "<html><body><iframe src=\"https://www.youtube.com/embed/123\"></iframe></body></html>",
11949        ));
11950        let check = parent_rt
11951            .eval("var f = document.querySelector('iframe'); f.contentWindow !== window && f.contentWindow.parent === window && f.contentWindow.top === window && f.contentWindow.self === f.contentWindow && f.contentWindow.window === f.contentWindow && f.contentWindow === f.contentWindow")
11952            .map(|v| v.to_js_string())
11953            .unwrap_or_else(|e| alloc::format!("ERR:{}", e));
11954        let _ = parent_rt.eval("window._parentGot = false; window.addEventListener('message', () => { window._parentGot = true; }); f.contentWindow.postMessage('hello-from-parent', '*');");
11955        let parent_got = parent_rt.eval("window._parentGot").map(|v| v.to_js_string()).unwrap_or_default();
11956        let queued = parent_rt.dom().borrow_mut().pending_child_messages.pop();
11957        let mut child_rt = JsRuntime::new();
11958        child_rt.set_page_url("https://www.youtube.com/embed/123");
11959        child_rt.set_frame_depth(1);
11960        let _ = child_rt.eval("window._childGotMsg = ''; window.addEventListener('message', e => { window._childGotMsg = e.data + '@' + e.origin; });");
11961        let mut child_got = alloc::string::String::new();
11962        if let Some((target_src, data, origin)) = queued {
11963            if target_src == "https://www.youtube.com/embed/123" {
11964                child_rt.deliver_message(data, &origin);
11965                child_got = child_rt.eval("window._childGotMsg").map(|v| v.to_js_string()).unwrap_or_default();
11966            }
11967        }
11968        if check == "true" && parent_got == "false" && child_got == "hello-from-parent@https://www.youtube.com" {
11969            passed += 1;
11970        } else {
11971            crate::println!(
11972                "JS_SELFTEST FAIL: iframe contentWindow postMessage check={} parent_got={} child_got={}",
11973                check,
11974                parent_got,
11975                child_got
11976            );
11977        }
11978    }
11979
11980    // document.currentScript の動的設定と解除(スクリプト実行中のみ有効)
11981    {
11982        total += 1;
11983        let mut rt = JsRuntime::new();
11984        let s_idx = rt.dom().borrow_mut().create_element("script");
11985        rt.set_current_script(Some(s_idx));
11986        let during = rt.eval("document.currentScript !== null && document.currentScript.tagName === 'SCRIPT'").map(|v| v.to_js_string()).unwrap_or_default();
11987        rt.set_current_script(None);
11988        let after = rt.eval("document.currentScript === null").map(|v| v.to_js_string()).unwrap_or_default();
11989        if during == "true" && after == "true" {
11990            passed += 1;
11991        } else {
11992            crate::println!("JS_SELFTEST FAIL: document.currentScript during={} after={}", during, after);
11993        }
11994    }
11995
11996    // document.createElement('script') の async 既定値(true)とプロパティ操作(W3C HTML 仕様準拠)
11997    {
11998        total += 1;
11999        let mut rt = JsRuntime::new();
12000        let res = rt
12001            .eval(
12002                "const s = document.createElement('script');
12003                 const def_async = s.async;
12004                 const def_defer = s.defer;
12005                 s.async = false;
12006                 const toggled = s.async;
12007                 def_async === true && def_defer === false && toggled === false",
12008            )
12009            .map(|v| v.to_js_string())
12010            .unwrap_or_default();
12011        if res == "true" {
12012            passed += 1;
12013        } else {
12014            crate::println!("JS_SELFTEST FAIL: script element async default got={}", res);
12015        }
12016    }
12017
12018    // eval_module によるトップレベル ES モジュールの評価と document.currentScript === null 検証
12019    {
12020        total += 1;
12021        let mut rt = JsRuntime::new();
12022        let mod_code = "
12023            export const magic = 42;
12024            globalThis.__mod_val = magic * 2;
12025            globalThis.__mod_cur_script = document.currentScript;
12026        ";
12027        let mod_res = rt.eval_module("test_module_top", mod_code);
12028        let val_check = rt.eval("globalThis.__mod_val === 84").map(|v| v.to_js_string()).unwrap_or_default();
12029        let cur_check = rt.eval("globalThis.__mod_cur_script === null").map(|v| v.to_js_string()).unwrap_or_default();
12030        if mod_res.is_ok() && val_check == "true" && cur_check == "true" {
12031            passed += 1;
12032        } else {
12033            let err_str = mod_res.err().unwrap_or_default();
12034            crate::println!("JS_SELFTEST FAIL: eval_module top-level err={} val={} cur={}", err_str, val_check, cur_check);
12035        }
12036    }
12037
12038    // 動的に作った要素があるとき、描画用の木の走査順からノードの添字へ戻せること
12039    // (getComputedStyle・要素の矩形の取り違えの回帰防止、2026-11-01)。
12040    {
12041        total += 1;
12042        let mut rt = JsRuntime::new();
12043        rt.dom().borrow_mut().build_from(&crate::os_lib::dom::parse_html(
12044            "<html><body><div id=\"a\"></div><div id=\"b\"></div></body></html>",
12045        ));
12046        // 後から作った要素を、先にある要素の前へ入れる(添字と木の順が逆になる)。
12047        let _ = rt.eval("var n=document.createElement('p'); n.id='new'; var a=document.getElementById('a'); a.parentNode.insertBefore(n,a);");
12048        let dom = rt.dom().borrow();
12049        let order = dom.tree_order();
12050        let ids: alloc::vec::Vec<&str> = order
12051            .iter()
12052            .filter_map(|&i| dom.nodes.get(i).map(|n| n.id.as_str()))
12053            .filter(|s| !s.is_empty())
12054            .collect();
12055        let id_map = dom.build_id_index();
12056        let by_id = crate::os_lib::web_apis::dom_bridge::DomBridge::resolve_element_id(&id_map, "a");
12057        let by_name = crate::os_lib::web_apis::dom_bridge::DomBridge::resolve_element_id(&id_map, "_node_idx_7");
12058        if ids == ["new", "a", "b"] && by_id == dom.get_element_by_id("a") && by_name == Some(7) {
12059            passed += 1;
12060        } else {
12061            crate::println!("JS_SELFTEST FAIL: tree_order ids={:?} by_id={:?} by_name={:?}", ids, by_id, by_name);
12062        }
12063    }
12064
12065    // `display: none` の部分木の判定と、組み直しの原因の計数(TODO P4、2026-11-14)。
12066    {
12067        total += 1;
12068        let mut rt = JsRuntime::new();
12069        rt.dom().borrow_mut().build_from(&crate::os_lib::dom::parse_html(
12070            "<html><body><div id=\"h\" style=\"display:none\"><span id=\"in\"></span></div><div id=\"v\"><span id=\"vin\"></span></div></body></html>",
12071        ));
12072        let _ = rt.eval("var d=document.createElement('p'); d.id='detached';");
12073        let (h, inner, v, vin, det) = {
12074            let dom = rt.dom().borrow();
12075            let f = |id: &str| dom.nodes.iter().position(|n| n.id == id).map(|i| dom.is_in_display_none_subtree(i));
12076            (f("h"), f("in"), f("v"), f("vin"), f("detached"))
12077        };
12078        // 直前の配置で決まった値(computed)でも隠れていると分かること。インラインの指定があればそちらが勝つ。
12079        let (by_computed, inline_wins) = {
12080            let mut dom = rt.dom().borrow_mut();
12081            let vi = dom.nodes.iter().position(|n| n.id == "v").unwrap_or(0);
12082            let mut m = alloc::collections::BTreeMap::new();
12083            m.insert(alloc::string::String::from("display"), alloc::string::String::from("none"));
12084            dom.computed_styles.insert(vi, alloc::rc::Rc::new(m));
12085            let vin_i = dom.nodes.iter().position(|n| n.id == "vin").unwrap_or(0);
12086            let a = dom.is_in_display_none_subtree(vin_i);
12087            dom.set_style(vi, "display", "block");
12088            let b = !dom.is_in_display_none_subtree(vin_i);
12089            (a, b)
12090        };
12091        // 原因の計数: 同じ原因はまとめ、多い順に取り出して 0 へ戻る。
12092        let causes_ok = {
12093            let mut dom = rt.dom().borrow_mut();
12094            let _ = dom.take_dirty_causes();
12095            dom.note_dirty_cause("a");
12096            dom.note_dirty_cause("b");
12097            dom.note_dirty_cause("b");
12098            dom.mark_structural_dirty_attr("aria-label");
12099            let got = dom.take_dirty_causes();
12100            let want = [("b", 2u32), ("a", 1), ("attr:aria-label", 1)];
12101            got.len() == want.len()
12102                && got.iter().zip(want.iter()).all(|((k, n), (wk, wn))| k == wk && n == wn)
12103                && dom.take_dirty_causes().is_empty()
12104        };
12105        if h == Some(true) && inner == Some(true) && v == Some(false) && vin == Some(false) && det == Some(true) && by_computed && inline_wins && causes_ok {
12106            passed += 1;
12107        } else {
12108            crate::println!(
12109                "JS_SELFTEST FAIL: display-none subtree h={:?} in={:?} v={:?} vin={:?} detached={:?} computed={} inline={} causes={}",
12110                h, inner, v, vin, det, by_computed, inline_wins, causes_ok
12111            );
12112        }
12113    }
12114
12115    // ステップ上限はタスクごと: 小さなタスクの合計では打ち切らず、無限ループは止める(2026-11-01)。
12116    {
12117        total += 1;
12118        let mut rt = JsRuntime::new();
12119        rt.max_steps = 20_000;
12120        let _ = rt.eval("globalThis.n=0; function f(){ for(var i=0;i<50;i++){} n++; if(n<2000) queueMicrotask(f); } f();");
12121        let mut pumps = 0;
12122        while pumps < 5000 && rt.pump_timers(30) {
12123            pumps += 1;
12124        }
12125        let done = rt.eval("n").map(|v| v.to_js_string()).unwrap_or_default();
12126        let _ = rt.eval("globalThis.c=0; while(true){ c++; }");
12127        let stopped = rt.eval("c > 0 && c < 100000").map(|v| v.to_js_string()).unwrap_or_default();
12128        if done == "2000" && pumps > 0 && stopped == "true" {
12129            passed += 1;
12130        } else {
12131            crate::println!("JS_SELFTEST FAIL: step budget done={} pumps={} stopped={}", done, pumps, stopped);
12132        }
12133    }
12134
12135    // `Response.clone()` の本文はバイト列のストリーム(先頭のバイトを見る YouTube の `get_watch`)。
12136    {
12137        total += 1;
12138        let mut rt = JsRuntime::new();
12139        let _ = rt.eval("globalThis.b0=0; new Response('[1]').clone().body.getReader().read().then(function(x){b0=x.value[0]});");
12140        let got = rt.eval("b0").map(|v| v.to_js_string()).unwrap_or_default();
12141        if got == "91" {
12142            passed += 1;
12143        } else {
12144            crate::println!("JS_SELFTEST FAIL: Response.clone body first byte={}", got);
12145        }
12146    }
12147
12148    // has_due_timers のマイクロタスク(Promise/queueMicrotask)検知と pump_timers 消化連動検証
12149    {
12150        total += 1;
12151        let mut rt = JsRuntime::new();
12152        let init_due = rt.has_due_timers();
12153        // `eval` はスクリプトの終わりでマイクロタスクを流し切る(HTML の
12154        // microtask checkpoint)ため、スクリプト内の `queueMicrotask` では
12155        // 「積まれたまま」を作れない。ネイティブ側(通信の完了など)から
12156        // 積まれた状況を、ジョブを直接積んで再現する。
12157        let handler = rt
12158            .eval("globalThis.__micro_fired = false; (() => { globalThis.__micro_fired = true; })")
12159            .ok();
12160        rt.microtasks.borrow_mut().push_back(crate::os_lib::ecma::value::Job {
12161            handler,
12162            arg: crate::os_lib::ecma::value::Value::Undefined,
12163            is_fulfill: true,
12164            result: alloc::rc::Rc::new(core::cell::RefCell::new(
12165                crate::os_lib::ecma::value::PromiseState::pending(),
12166            )),
12167        });
12168        let after_queue_due = rt.has_due_timers();
12169        let pumped = rt.pump_timers(30);
12170        let after_pump_due = rt.has_due_timers();
12171        let fired = rt.eval("globalThis.__micro_fired === true").map(|v| v.to_js_string()).unwrap_or_default();
12172        if !init_due && after_queue_due && pumped && !after_pump_due && fired == "true" {
12173            passed += 1;
12174        } else {
12175            crate::println!(
12176                "JS_SELFTEST FAIL: has_due_timers microtasks init={} queued={} pumped={} after={} fired={}",
12177                init_due,
12178                after_queue_due,
12179                pumped,
12180                after_pump_due,
12181                fired
12182            );
12183        }
12184    }
12185
12186    // A7 / A1: Scope/PropKey/Obj サイズ不変条件とバイトコード(let/const ブロック・for(let)・単項演算・PropSlot)検証
12187    {
12188        total += 1;
12189        let sizes_ok = core::mem::size_of::<crate::os_lib::ecma::value::PropKey>() == 16
12190            && core::mem::size_of::<crate::os_lib::ecma::value::ObjKind>() == 32
12191            && core::mem::size_of::<crate::os_lib::ecma::value::Obj>() == 80
12192            && core::mem::size_of::<crate::os_lib::ecma::interp::Scope>() == 40;
12193        let mut rt = JsRuntime::new();
12194        let script = r#"
12195            class Base {
12196                baseAdd(x) { return x + 10; }
12197            }
12198            class Sub extends Base {
12199                calc(n) {
12200                    let acc = 0;
12201                    const fns = [];
12202                    for (let i = 0; i < n; i++) {
12203                        let step = i + 1;
12204                        if (step === 2) {
12205                            let inner = 99;
12206                            acc += inner - 98;
12207                            continue;
12208                        }
12209                        if (step > 4) {
12210                            let stop = 1;
12211                            acc += stop;
12212                            break;
12213                        }
12214                        fns.push(() => i * 10 + step);
12215                        acc += this.baseAdd(step);
12216                    }
12217                    let closureSum = 0;
12218                    for (let k = 0; k < fns.length; k++) {
12219                        closureSum += fns[k]();
12220                    }
12221                    let u = (typeof undeclaredXyz === 'undefined' ? 1 : 0)
12222                        + (typeof acc === 'number' ? 2 : 0)
12223                        + (void 0 === undefined ? 4 : 0)
12224                        + (-(-3) === 3 ? 8 : 0)
12225                        + (+'5' === 5 ? 16 : 0)
12226                        + (~0 === -1 ? 32 : 0);
12227                    return acc + ',' + closureSum + ',' + u;
12228                }
12229            }
12230            const s = new Sub();
12231            const r1 = s.calc(6);
12232            const r2 = s.calc(6);
12233            const r3 = s.calc(6);
12234            r1 === r2 && r2 === r3 ? r3 : 'MISMATCH:' + r1 + '/' + r2 + '/' + r3
12235        "#;
12236        let got = rt.eval(script).map(|v| v.to_js_string()).unwrap_or_default();
12237        if sizes_ok && got == "40,58,63" {
12238            passed += 1;
12239        } else {
12240            crate::println!(
12241                "JS_SELFTEST FAIL: A1/A7 bytecode & sizes sizes_ok={} got={}",
12242                sizes_ok,
12243                got
12244            );
12245        }
12246    }
12247
12248    // A1 段階 1/3: 配列・オブジェクト・new・テンプレート・複合メンバ/添字代入・メンバ/添字増減・delete・論理代入・for-of/for-in・switch・try/catch のバイトコード一致検証
12249    {
12250        total += 1;
12251        let mut rt = JsRuntime::new();
12252        let script = r#"
12253            function Box(v) { this.v = v; }
12254            function runAll(seed) {
12255                let dynKey = 'k' + seed;
12256                let obj = { a: seed, [dynKey]: 10, tmp: 99, delIdx: 88, anon: function() {} };
12257                delete obj.tmp;
12258                let dk = 'delIdx';
12259                delete obj[dk];
12260                obj.a += 5;
12261                let oldMember = obj.a++;
12262                let newMember = ++obj.a;
12263
12264                let arr = [seed, 10, 20];
12265                arr[1] += 3;
12266                let oldIdx = arr[2]++;
12267                let newIdx = ++arr[2];
12268
12269                let la = 0, lb = 5, lc = null;
12270                la ||= 7;
12271                lb &&= 9;
12272                lc ??= 11;
12273
12274                let box = new Box(obj.a + arr[1] + arr[2]);
12275                let sumOf = 0;
12276                let closures = [];
12277                for (let x of arr) {
12278                    if (x === 13) {
12279                        switch (x) {
12280                            case 13:
12281                                sumOf += 100;
12282                                continue;
12283                            default:
12284                                sumOf += 999;
12285                        }
12286                    }
12287                    closures.push(() => x);
12288                    sumOf += x;
12289                }
12290                let sumIn = 0;
12291                for (let k in { p: 1, q: 2, r: 3 }) {
12292                    switch (k) {
12293                        case 'p':
12294                            sumIn += 1;
12295                            break;
12296                        case 'q':
12297                            sumIn += 2;
12298                        default:
12299                            sumIn += 10;
12300                            break;
12301                    }
12302                }
12303                let caughtMsg = '';
12304                let loopTry = 0;
12305                while (loopTry < 5) {
12306                    try {
12307                        let innerLet = loopTry + 1;
12308                        if (innerLet === 3) {
12309                            throw 'boom:' + innerLet;
12310                        }
12311                        loopTry += 1;
12312                    } catch (err) {
12313                        caughtMsg = err;
12314                        break;
12315                    }
12316                }
12317                return `${box.v}|${oldMember},${newMember}|${oldIdx},${newIdx}|${la},${lb},${lc}|${sumOf},${closures[0]()}|${sumIn}|${caughtMsg}|${obj.anon.name}|${'tmp' in obj},${'delIdx' in obj}`;
12318            }
12319            let first = runAll(2);
12320            let ok = true;
12321            for (let i = 0; i < 12; i++) {
12322                let cur = runAll(2);
12323                if (cur !== first) {
12324                    ok = false;
12325                }
12326            }
12327            ok ? first : 'MISMATCH:' + first
12328        "#;
12329        let got = rt.eval(script).map(|v| v.to_js_string()).unwrap_or_default();
12330        let expected = "44|7,9|20,22|7,9,11|124,2|23|boom:3|anon|false,false";
12331        if got == expected {
12332            passed += 1;
12333        } else {
12334            crate::println!(
12335                "JS_SELFTEST FAIL: A1 stage 1/3 extended bytecode got={} expected={}",
12336                got,
12337                expected
12338            );
12339        }
12340    }
12341
12342    // A1 optional chaining bytecode テスト(8回以上反復でバイトコード実行と短絡評価を検証)
12343    {
12344        total += 1;
12345        let mut rt = JsRuntime::new();
12346        let script = r#"
12347            function testOptional(obj, dummy) {
12348                let sideEffectIndex = false;
12349                let sideEffectArg = false;
12350                let val1 = obj?.a?.b?.c;
12351                let val2 = obj?.sub?.['key'];
12352                let val3 = obj?.fn?.(10);
12353                let val4 = obj?.calc?.(sideEffectArg = true);
12354                let val5 = obj?.['missing']?.[sideEffectIndex = true];
12355                let val6 = obj?.greet?.('AtmOS');
12356                return `${val1}|${val2}|${val3}|${sideEffectArg}|${sideEffectIndex}|${val6}`;
12357            }
12358
12359            let normalObj = {
12360                a: { b: { c: 100 } },
12361                sub: { key: 'hit' },
12362                fn: (x) => x * 3,
12363                calc: (x) => x ? 'arg_ok' : 'arg_ng',
12364                greet: (name) => 'hello ' + name
12365            };
12366
12367            let nullObj = null;
12368
12369            let firstNormal = testOptional(normalObj, 0);
12370            let firstNull = testOptional(nullObj, 0);
12371
12372            let ok = true;
12373            for (let i = 0; i < 15; i++) {
12374                let curN = testOptional(normalObj, i);
12375                let curNull = testOptional(nullObj, i);
12376                if (curN !== firstNormal || curNull !== firstNull) {
12377                    ok = false;
12378                }
12379            }
12380
12381            ok ? `${firstNormal}__${firstNull}` : 'MISMATCH'
12382        "#;
12383        let got = rt.eval(script).map(|v| v.to_js_string()).unwrap_or_default();
12384        let expected = "100|hit|30|true|false|hello AtmOS__undefined|undefined|undefined|false|false|undefined";
12385        if got == expected {
12386            passed += 1;
12387        } else {
12388            crate::println!(
12389                "JS_SELFTEST FAIL: A1 optional chaining bytecode got={} expected={}",
12390                got,
12391                expected
12392            );
12393        }
12394    }
12395
12396    // A1 spread & logical assign bytecode テスト(オブジェクト/配列スプレッド & メンバー/添字論理代入)
12397    {
12398        total += 1;
12399        let mut rt = JsRuntime::new();
12400        let script = r#"
12401            function testExtendedOps(step) {
12402                let baseObj = { x: 10, y: 0, z: 'init' };
12403                let copyObj = { ...baseObj, added: 99 };
12404                copyObj.x ??= 100;
12405                copyObj.y ||= 200;
12406                copyObj.z &&= 'updated';
12407                copyObj.missing ??= 'created';
12408
12409                let idxObj = { 'dyn': null };
12410                idxObj['dyn'] ??= 'assigned';
12411                idxObj['dyn'] ??= 'skipped';
12412
12413                let baseArr = [10, 20];
12414                let copyArr = [...baseArr, 30, ...[40, 50]];
12415
12416                return `${copyObj.x},${copyObj.y},${copyObj.z},${copyObj.missing},${copyObj.added}|${idxObj.dyn}|${copyArr.join('-')}`;
12417            }
12418
12419            let first = testExtendedOps(0);
12420            let ok = true;
12421            for (let i = 0; i < 15; i++) {
12422                let cur = testExtendedOps(i);
12423                if (cur !== first) {
12424                    ok = false;
12425                }
12426            }
12427
12428            ok ? first : 'MISMATCH:' + first
12429        "#;
12430        let got = rt.eval(script).map(|v| v.to_js_string()).unwrap_or_default();
12431        let expected = "10,200,updated,created,99|assigned|10-20-30-40-50";
12432        if got == expected {
12433            passed += 1;
12434        } else {
12435            crate::println!(
12436                "JS_SELFTEST FAIL: A1 spread & logical assign bytecode got={} expected={}",
12437                got,
12438                expected
12439            );
12440        }
12441    }
12442
12443    // A1 bitwise & spread call bytecode テスト(ビット演算/剰余インライン高速パス & 引数スプレッド呼び出し)
12444    {
12445        total += 1;
12446        let mut rt = JsRuntime::new();
12447        let script = r#"
12448            function testBitwiseAndSpreadCall(step) {
12449                let a = 0x12345678;
12450                let b = -1698898192; // 0x9abcdef0 as signed i32
12451                let bitAnd = a & b;
12452                let bitOr = a | b;
12453                let bitXor = a ^ b;
12454                let shl = (a << 3);
12455                let shr = (b >> 4);
12456                let ushr = (b >>> 4);
12457                let rem = 12345 % 100;
12458
12459                function sum4(w, x, y, z) {
12460                    return w + x + y + z;
12461                }
12462                let mid = [20, 30];
12463                let resCall = sum4(10, ...mid, 40);
12464
12465                let calcObj = {
12466                    joinItems: function(prefix, a, b, c) {
12467                        return prefix + ':' + a + '-' + b + '-' + c;
12468                    }
12469                };
12470                let parts = ['x', 'y', 'z'];
12471                let resMethod = calcObj.joinItems('RES', ...parts);
12472
12473                return `${bitAnd}|${bitOr}|${bitXor}|${shl}|${shr}|${ushr}|${rem}__${resCall}__${resMethod}`;
12474            }
12475
12476            let first = testBitwiseAndSpreadCall(0);
12477            let ok = true;
12478            for (let i = 0; i < 15; i++) {
12479                let cur = testBitwiseAndSpreadCall(i);
12480                if (cur !== first) {
12481                    ok = false;
12482                }
12483            }
12484
12485            ok ? first : 'MISMATCH:' + first
12486        "#;
12487        let got = rt.eval(script).map(|v| v.to_js_string()).unwrap_or_default();
12488        // 期待値は Node.js で確かめた値(2026-11-10)。以前の値は手計算の誤りで、エンジンの方が正しかった。
12489        let expected = "305419888|-1698898184|-2004318072|-1851608128|-106181137|162254319|45__100__RES:x-y-z";
12490        if got == expected {
12491            passed += 1;
12492        } else {
12493            crate::println!(
12494                "JS_SELFTEST FAIL: A1 bitwise & spread call bytecode got={} expected={}",
12495                got,
12496                expected
12497            );
12498        }
12499    }
12500
12501    // A1 array builtin inlining, string index & bimorphic IC テスト
12502    {
12503        total += 1;
12504        let mut rt = JsRuntime::new();
12505        let script = r#"
12506            function testFastArrayAndBimorphicIC(step) {
12507                // 1. 配列メソッドのインライン実行・高速解決
12508                let arr = [10, 20];
12509                let pLen = arr.push(30, 40);
12510                let popVal = arr.pop();
12511                let shiftVal = arr.shift();
12512                let sliceArr = arr.slice(0, 2);
12513
12514                // 2. 文字列添字プロパティの高速取得・設定
12515                let dict = {};
12516                dict["foo"] = 100;
12517                dict["bar"] = 200;
12518                let dictSum = dict["foo"] + dict["bar"];
12519
12520                // 3. Bimorphic IC 検証(異なる形状 A, B を交互にアクセス)
12521                let shapeA = { alpha: 1, beta: 2 };
12522                let shapeB = { beta: 20, alpha: 10 };
12523                let icTotal = 0;
12524                for (let j = 0; j < 4; j++) {
12525                    let obj = (j % 2 === 0) ? shapeA : shapeB;
12526                    icTotal += obj.alpha + obj.beta;
12527                }
12528
12529                return `${pLen}|${popVal}|${shiftVal}|${sliceArr.length}|${dictSum}|${icTotal}`;
12530            }
12531
12532            let first = testFastArrayAndBimorphicIC(0);
12533            let ok = true;
12534            for (let i = 0; i < 15; i++) {
12535                let cur = testFastArrayAndBimorphicIC(i);
12536                if (cur !== first) {
12537                    ok = false;
12538                }
12539            }
12540
12541            ok ? first : 'MISMATCH:' + first
12542        "#;
12543        let got = rt.eval(script).map(|v| v.to_js_string()).unwrap_or_default();
12544        let expected = "4|40|10|2|300|66";
12545        if got == expected {
12546            passed += 1;
12547        } else {
12548            crate::println!(
12549                "JS_SELFTEST FAIL: A1 array builtin inlining, string index & bimorphic IC got={} expected={}",
12550                got,
12551                expected
12552            );
12553        }
12554    }
12555
12556    // A1 string indexing, array extension & string-number concatenation bytecode
12557    {
12558        total += 1;
12559        let mut rt = JsRuntime::new();
12560        let script = r#"
12561            function testStringIndexAndArrayExtension(step) {
12562                // 1. 文字列インデックスアクセス (str[i])
12563                let text = "AtmOS_Engine";
12564                let chars = text[0] + text[5] + text[6];
12565
12566                // 2. 配列逐次拡張 (arr[arr.length] = v, arr[i] = v)
12567                let arr = [];
12568                for (let i = 0; i < 5; i++) {
12569                    arr[i] = i * 10;
12570                }
12571                arr[6] = 99;
12572
12573                // 3. 文字列+数値 / 数値+文字列 / 文字列+真偽値
12574                let s1 = "count: " + 42;
12575                let s2 = 100 + "px";
12576                let s3 = "flag=" + true;
12577
12578                return `${chars}__${arr.length}_${arr[0]}_${arr[4]}_${arr[6]}__${s1}|${s2}|${s3}`;
12579            }
12580
12581            let first = testStringIndexAndArrayExtension(0);
12582            let ok = true;
12583            for (let i = 0; i < 15; i++) {
12584                let cur = testStringIndexAndArrayExtension(i);
12585                if (cur !== first) {
12586                    ok = false;
12587                }
12588            }
12589
12590            ok ? first : 'MISMATCH:' + first
12591        "#;
12592        let got = rt.eval(script).map(|v| v.to_js_string()).unwrap_or_default();
12593        let expected = "A_E__7_0_40_99__count: 42|100px|flag=true";
12594        if got == expected {
12595            passed += 1;
12596        } else {
12597            crate::println!(
12598                "JS_SELFTEST FAIL: A1 string indexing & array extension got={} expected={}",
12599                got,
12600                expected
12601            );
12602        }
12603    }
12604
12605    // A1 destructuring declarations, for-of destructuring (with closure), try-catch pattern bytecode
12606    {
12607        total += 1;
12608        let mut rt = JsRuntime::new();
12609        let script = r#"
12610            function testDestructuringBytecode(step) {
12611                // 1. let/const/var オブジェクト&配列分割代入
12612                const { x, y: renamed = 50, ...objRest } = { x: 10, z: 30, w: 40 };
12613                let [a, b = 20, ...arrRest] = [1, undefined, 3, 4];
12614                if (true) {
12615                    var { hoistedVal } = { hoistedVal: 7 };
12616                }
12617
12618                // 2. for-of 分割代入 + ループ内クロージャ捕捉分離
12619                const pairs = [['k1', 100], ['k2', 200]];
12620                const fns = [];
12621                let sum = 0;
12622                for (const [k, v] of pairs) {
12623                    sum += v;
12624                    fns.push(() => k + ':' + v);
12625                }
12626                const cap = fns[0]() + ',' + fns[1]();
12627
12628                // 3. try-catch パターン分割代入
12629                let caught = '';
12630                try {
12631                    throw { code: 404, msg: 'notfound' };
12632                } catch ({ code, msg }) {
12633                    caught = code + ':' + msg;
12634                }
12635
12636                return `${x + renamed + objRest.z}|${a + b + arrRest.length}|${hoistedVal}|${sum}|${cap}|${caught}`;
12637            }
12638
12639            let first = testDestructuringBytecode(0);
12640            let ok = true;
12641            for (let i = 0; i < 6; i++) {
12642                if (testDestructuringBytecode(i) !== first) {
12643                    ok = false;
12644                }
12645            }
12646            ok ? first : 'MISMATCH:' + first
12647        "#;
12648        let got = rt.eval(script).map(|v| v.to_js_string()).unwrap_or_default();
12649        let expected = "90|23|7|300|k1:100,k2:200|404:notfound";
12650        if got == expected {
12651            passed += 1;
12652        } else {
12653            crate::println!(
12654                "JS_SELFTEST FAIL: A1 destructuring bytecode got={} expected={}",
12655                got,
12656                expected
12657            );
12658        }
12659    }
12660
12661    // A1 fast call dispatch, batch hoist & inline string/math builtins
12662    {
12663        total += 1;
12664        let mut rt = JsRuntime::new();
12665        let script = r#"
12666            function dupParam(a, a) {
12667                return a;
12668            }
12669
12670            function bigVarsFn(p0, p1) {
12671                var p0;
12672                var v0 = 1, v1 = 2, v2 = 3, v3 = 4, v4 = 5, v5 = 6, v6 = 7, v7 = 8;
12673                return p0 + p1 + v0 + v1 + v2 + v3 + v4 + v5 + v6 + v7;
12674            }
12675
12676            function withFuncDecl(x) {
12677                return hoistedDouble(x) + lateVar;
12678                var lateVar = 5;
12679                function hoistedDouble(n) {
12680                    return n * 2;
12681                }
12682            }
12683
12684            function withArgsSum(a) {
12685                return a + arguments.length + arguments[1];
12686            }
12687
12688            function testFastCallAndBuiltins(i) {
12689                const s = 'ABC';
12690                const c0 = s.charCodeAt(1);
12691                const c1 = s.charAt(2);
12692                const cNaN = isNaN(s.charCodeAt(9));
12693                let side = 0;
12694                const cSide = String.fromCharCode({ valueOf() { side += 1; return 66; } });
12695                const fcc = String.fromCharCode(65);
12696                const m1 = Math.floor(-2.3) + Math.ceil(1.2) + Math.round(2.5) + Math.trunc(-3.9) + Math.abs(-5);
12697                const mSide = Math.floor({ valueOf() { side += 10; return -1.1; } });
12698                const im = Math.imul(0xffffffff, 5);
12699                const isArr = `${Array.isArray([])},${Array.isArray(new Int8Array(2))},${Array.isArray(new Proxy([], {}))}`;
12700
12701                const addBase = function(b) { return this.x + b; };
12702                const bound = addBase.bind({ x: 10 }, 5);
12703                const pfn = new Proxy((v) => v + 1, {
12704                    apply(target, _t, args) { return target(args[0]) * 10; }
12705                });
12706                let errOk = false;
12707                try {
12708                    const notFn = 123;
12709                    notFn();
12710                } catch (e) {
12711                    errOk = true;
12712                }
12713
12714                return `${dupParam(1, 2)}|${bigVarsFn(10, 20)}|${isNaN(withFuncDecl(4))}|${withArgsSum(10, 7)}|${c0}_${c1}_${cNaN}_${fcc}_${cSide}_${side}|${m1}_${mSide}_${im}|${isArr}|${bound()}_${pfn(2)}_${errOk}`;
12715            }
12716
12717            const first = testFastCallAndBuiltins(0);
12718            let ok = true;
12719            for (let i = 0; i < 12; i++) {
12720                if (testFastCallAndBuiltins(i) !== first) {
12721                    ok = false;
12722                }
12723            }
12724            ok ? first : 'MISMATCH:' + first
12725        "#;
12726        let got = rt.eval(script).map(|v| v.to_js_string()).unwrap_or_default();
12727        let expected = "2|66|true|19|66_C_true_A_B_11|4_-2_-5|true,false,true|15_30_true";
12728        if got == expected {
12729            passed += 1;
12730        } else {
12731            crate::println!(
12732                "JS_SELFTEST FAIL: A1 fast call & inline builtins got={} expected={}",
12733                got,
12734                expected
12735            );
12736        }
12737    }
12738
12739    // Math.* / String.fromCharCode の引数の ToPrimitive(valueOf を呼ぶ・左から順)(2026-11-11)
12740    {
12741        total += 1;
12742        let mut rt = JsRuntime::new();
12743        let script = r#"
12744            let order = '';
12745            const v = (n, tag) => ({ valueOf() { order += tag; return n; } });
12746            const r = [
12747                Math.max(v(3, 'a'), v(7, 'b'), 5),
12748                Math.min(v(3, 'c'), v(-2, 'd')),
12749                Math.pow(v(2, 'e'), v(10, 'f')),
12750                Math.sqrt(v(81, 'g')),
12751                Math.sign(v(-4, 'h')),
12752                Math.hypot(v(3, 'i'), v(4, 'j')),
12753                String.fromCharCode(v(72, 'k'), v(105, 'l')),
12754                Math.abs({ toString() { return '-12'; } }),
12755                Math.floor([7.9]),
12756            ];
12757            r.join(',') + '|' + order
12758        "#;
12759        let got = rt.eval(script).map(|v| v.to_js_string()).unwrap_or_default();
12760        // 期待値は Node.js で確かめた値。
12761        let expected = "7,-2,1024,9,-1,5,Hi,12,7|abcdefghijkl";
12762        if got == expected {
12763            passed += 1;
12764        } else {
12765            crate::println!("JS_SELFTEST FAIL: Math ToPrimitive got={} expected={}", got, expected);
12766        }
12767    }
12768
12769    (passed, total)
12770}
12771
12772
12773
12774