Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closing tags should not be allowed to have attributes #115

Open
alexr00 opened this issue Aug 18, 2021 · 0 comments
Open

Closing tags should not be allowed to have attributes #115

alexr00 opened this issue Aug 18, 2021 · 0 comments

Comments

@alexr00
Copy link

alexr00 commented Aug 18, 2021

Originally from @barabo in microsoft/vscode#130284

Issue Type: Bug

I had a copy/paste error in my source HTML that led to a very subtle bug in my rendered HTML.

Consider this input:

<div id="client-secret">
    <label>Client Secret</label>
    <textarea class="form-control" ></textarea>
    <br/>
</div>
</div id="jwks-uri">
    <label>JWKS URI</label>
    <input type="text" class="form-control" placeholder="JWKS URI" name="jwks-uri" autocomplete="on">
    <br/>
</div>
</div id="jwks-inline">
    <label>JWKS Inline</label>
    <textarea class="form-control" ></textarea>
</div>

The final two of three DIV element tags are actually end tags when they were intended to be start tags. The browser handled this by eliding the end tags entirely.

The DOM effectively had this instead:

<div id="client-secret">
    <label>Client Secret</label>
    <textarea class="form-control" ></textarea>
    <br/>
</div>
    <label>JWKS URI</label>
    <input type="text" class="form-control" placeholder="JWKS URI" name="jwks-uri" autocomplete="on">
    <br/>
    <label>JWKS Inline</label>
    <textarea class="form-control" ></textarea>

Now consider how the syntax is highlighted:
image

I noticed this later when I used jquery to select the elements with affected ids - there were no div elements at all with the ids I expected, but the label and input elements were present. So, the page looked correct, but I couldn't select the entered values using jquery because the needed div with the ID wasn't there.

So, please improve the HTML syntax highlighter to visually "complain" about end tags that have attributes. This is not valid HTML and should never be allowed.

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

No branches or pull requests

1 participant