Skip to content

🧹 Add checks for duplicate HTML element IDs#6055

Open
rix0rrr wants to merge 21 commits into
mainfrom
check-duplicate-ids
Open

🧹 Add checks for duplicate HTML element IDs#6055
rix0rrr wants to merge 21 commits into
mainfrom
check-duplicate-ids

Conversation

@rix0rrr

@rix0rrr rix0rrr commented Dec 18, 2024

Copy link
Copy Markdown
Member

In the course of investigating other issues, I've found that we are emitting invalid HTML. For example, multiple elements with the same id="..." attribute.

This doesn't cause loud errors in the browser, but interferes with the proper functioning HTML selectors and Cypress tests don't always behave like they should.

Add the start of a postprocessing step where we are going to validate the HTML that is generated in Flask templates and crash loudly if it is illegal.

There are many id="..." attributes in our HTML that seem like they're not being used at all by TypeScript code or by HTMX annotations, so I write a little script to identify ones that are definitely unused and removed them. This probably leaves a number of unused id attributes that I couldn't definitely determine as unused, and I don't want to spend time figuring it out for each of them because there are loads.

How to test

This currently breaks the tests because we have illegal templates, but I need to go through this at a later time.

rix0rrr and others added 21 commits December 18, 2024 12:39
In the course of investigating other issues, I've found that we are
emitting invalid HTML. For example, multiple elements with the same
`id="..."` attribute.

This doesn't cause loud errors in the browser, but interferes with the
proper functioning HTML selectors and Cypress tests don't always behave
like they should.

Add the start of a postprocessing step where we are going to validate
the HTML that is generated in Flask templates and crash loudly if it is
illegal.
@rix0rrr rix0rrr force-pushed the main branch 6 times, most recently from 674bb9f to 207fc8b Compare July 14, 2025 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants