Fix filter/map tag disambiguation inside SVG context without keyword attrs
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 3m19s

(filter (feTurbulence ...)) inside (svg ...) has no keyword first arg,
so the keyword-only check dispatched it as a HO function. Now also
check SVG/MathML context (ns in client, _svg_context in server).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-04 14:03:02 +00:00
parent f5c266e785
commit a84916e82f
3 changed files with 18 additions and 9 deletions

View File

@@ -648,10 +648,13 @@ async def _arender_list(expr: list, env: dict[str, Any], ctx: RequestContext) ->
return await _arender_element(name[5:], expr[1:], env, ctx)
# Render-aware special forms
# If name is also an HTML tag and first arg is Keyword → tag call
# If name is also an HTML tag and (keyword arg or SVG context) → tag call
arsf = _ASYNC_RENDER_FORMS.get(name)
if arsf is not None:
if name in HTML_TAGS and len(expr) > 1 and isinstance(expr[1], Keyword):
if name in HTML_TAGS and (
(len(expr) > 1 and isinstance(expr[1], Keyword))
or _svg_context.get(False)
):
return await _arender_element(name, expr[1:], env, ctx)
return await arsf(expr, env, ctx)
@@ -1098,10 +1101,13 @@ async def _aser(expr: Any, env: dict[str, Any], ctx: RequestContext) -> Any:
# Serialize-mode special/HO forms (checked BEFORE HTML_TAGS
# because some names like "map" are both HTML tags and sx forms).
# If name is also an HTML tag and first arg is Keyword → tag call.
# If name is also an HTML tag and (keyword arg or SVG context) → tag call.
sf = _ASER_FORMS.get(name)
if sf is not None:
if name in HTML_TAGS and len(expr) > 1 and isinstance(expr[1], Keyword):
if name in HTML_TAGS and (
(len(expr) > 1 and isinstance(expr[1], Keyword))
or _svg_context.get(False)
):
return await _aser_call(name, expr[1:], env, ctx)
return await sf(expr, env, ctx)