Skip to content

Decide whether format_attrs refuses the names c-bind refuses #700

Closed

Description

@JuroOravec

The question

Should format_attrs() refuse the attribute names that c-bind refuses (on*, innerHTML, outerHTML, srcdoc, and names Vue reads as code)?

What happens today

format_attrs (packages/py/citry/citry/attrs.py:834) runs validate_html_attr_name only. The template callers add reject_vue_code_attr_name and reject_script_capable_attr_name, but the public helper does not. Its result is Markup, so Python code that builds a tag with it, such as Markup("<div {}>").format(format_attrs(data)), writes a key such as onclick taken from data as it is.

A template cannot place a value inside a start tag, so only Python code that builds markup is affected.

docs_site/content/advanced/html-attributes.md ("Format as HTML") said the helper "follows the same rules as attributes in a template". The PR for #603 adds a sentence there and in the docstring that the names must come from the app's own code. This issue decides whether the helper should refuse those names instead, which would match c-bind.

Options

  1. Apply reject_script_capable_attr_name (and reject_vue_code_attr_name) in format_attrs. Callers inside Citry that pass names a template wrote (for example <c-element>, static attribute re-formatting on the node path) need a path that skips the check for authored names.
  2. Keep the helper as it is, with the documented rule.

🤖 Generated with Claude Code

Activity

  1. added
    next-sprint
    on Nov 15, 2026
  2. added this to the 1.1.0 milestone on Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    next-sprint

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions