Skip to content

feat: add Range field to Element parser nodes#1236

Merged
a-h merged 1 commit intoa-h:mainfrom
dgrundel:element-range
Aug 15, 2025
Merged

feat: add Range field to Element parser nodes#1236
a-h merged 1 commit intoa-h:mainfrom
dgrundel:element-range

Conversation

@dgrundel
Copy link
Copy Markdown
Contributor

@dgrundel dgrundel commented Aug 6, 2025

Hi again, back with another Range addition. This is the big one, haha.

Thank you for the reviews!

Use case notes: As mentioned previously, I'm working on a linting tool for Templ. Element seems like the most obvious in terms of being generally useful for such a tool, but I'll also throw out a few things in particular I'm thinking of.

  • Disallow certain elements entirely: For example, <iframe>s. Or, in our case, we plan to have our own custom element replacements for certain tags to ensure compatibility and accessibility for clients and we want to ensure folks can't use the standard elements.
  • Require certain attributes to be present: Obvious cases are alt for <img> and href for <a>. (I realize that dynamic attributes can make this challenging/impossible.)
  • Prevent invalid HTML: For example, nesting interactive elements (e.g. putting an <a> inside another <a>) is invalid HTML and can lead to unexpected behavior.

@a-h a-h merged commit d7f4505 into a-h:main Aug 15, 2025
5 checks passed
dgrundel added a commit to dgrundel/templ that referenced this pull request Aug 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants