HS-plan: log window global fn fallback blocked

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-24 06:19:02 +00:00
parent 87cafaaa3f
commit c4da069815
5 changed files with 36 additions and 2 deletions

View File

@@ -1123,6 +1123,25 @@ def parse_dev_body(body, elements, var_names):
ops.append(f'(host-call {target} "remove")')
continue
# evaluate(() => document.querySelector(SEL).classList.(add|remove|toggle)("X"))
m = re.match(
r'''evaluate\(\s*\(\)\s*=>\s*document\.querySelector\(\s*([\'"])([^\'"]+)\1\s*\)\.classList\.(add|remove|toggle)\(\s*([\'"])([^\'"]+)\4\s*\)\s*\)\s*$''',
stmt_na, re.DOTALL,
)
if m and seen_html:
sel = m.group(2)
sel = re.sub(r'^#work-area\s+', '', sel)
target = selector_to_sx(sel, elements, var_names)
op = m.group(3)
cls = m.group(5)
if op == 'add':
ops.append(f'(dom-add-class {target} "{cls}")')
elif op == 'remove':
ops.append(f'(dom-remove-class {target} "{cls}")')
elif op == 'toggle':
ops.append(f'(if (dom-has-class? {target} "{cls}") (dom-remove-class {target} "{cls}") (dom-add-class {target} "{cls}"))')
continue
if not seen_html:
continue
if add_action(stmt_na):