Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-102555 Increase HTML standard compliance for closing comment tags#117406

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Privat33r-dev wants to merge7 commits intopython:main
base:main
Choose a base branch
Loading
fromPrivat33r-dev:patch-1

Conversation

Privat33r-dev
Copy link
Contributor

@Privat33r-devPrivat33r-dev commentedMar 31, 2024
edited by bedevere-appbot
Loading

@Privat33r-dev
Copy link
ContributorAuthor

Privat33r-dev commentedMar 31, 2024
edited
Loading

We might as well handle the<!--> case (test case:<!--><script>alert(document.domain)</script>) and add some test cases, but it might as well be a subject for a different PR. Let me know how would you prefer it.

Copy link
Member

@ezio-melottiezio-melotti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks for the PR. Before reviewing and merging, tests should be added.

@@ -9,7 +9,7 @@

_declname_match = re.compile(r'[a-zA-Z][-_.a-zA-Z0-9]*\s*').match
_declstringlit_match = re.compile(r'(\'[^\']*\'|"[^"]*")\s*').match
_commentclose = re.compile(r'--\s*>')
_commentclose = re.compile(r'--!?>')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I would leave the\s*, even though I should double check what the HTML5 specs say exactly.

Copy link
ContributorAuthor

@Privat33r-devPrivat33r-devApr 1, 2024
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I would leave the\s*, even though I should double check what the HTML5 specs say exactly.

I provided the links to HTML5 specification earlier and "\s*" mentioned nowhere, moreover, my tests with latest versions of Firefox and Chrome has shown that it's in fact an incorrect behaviour and is not considered a closing tag by modern browsers. Thus I see no reason in keeping it (nor spec, nor common practice).

ezio-melotti reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

https://html.spec.whatwg.org/#comment-end-state is the section of the specs I was looking for. It does indeed mention the! but not the spaces, so updating the code accordingly sounds good to me.

Do you want to add tests to check these (-->,--!>,-- >,--x>,--->, etc.) cases?

Privat33r-dev reacted with thumbs up emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

https://html.spec.whatwg.org/#comment-end-state is the section of the specs I was looking for. It does indeed mention the! but not the spaces, so updating the code accordingly sounds good to me.

Do you want to add tests to check these (-->,--!>,-- >,--x>,--->, etc.) cases?

I am thinking about improving the solution to even include<!-->, unexpected EOF and similar other test cases (that were mentioned in asimilar PR), but at the moment, unfortunately, I am lacking time to work on this PR. Hopefully, in the week (or at the weekend at worst) I can add the test cases and change a few other parts of the code to handle even wider variety of edge cases.

ezio-melotti reacted with thumbs up emoji
@Privat33r-dev
Copy link
ContributorAuthor

@ezio-melotti EOF edge-case (described here:https://html.spec.whatwg.org/multipage/parsing.html#parse-error-eof-in-comment ) appears to be a bit more complicated, I will try to resolve it today as well anyway.

Currently added short comment (<!-->) edge-case handling with tests.

ezio-melotti reacted with thumbs up emoji

@Privat33r-dev
Copy link
ContributorAuthor

Privat33r-dev commentedApr 6, 2024
edited
Loading

New EOF behaviour seems to be consistent with chromium-based browser.

There is still an edge case with EOF-ending abrupt comment case, but the case is relatively hard to handle and quite rare (html after tag that starts with<! should not contain any closing tags), that's why I decided to skip it, at least for this PR (since the PR already is beyond and above the initial issue).

http://www.w3.org/TR/html5/tokenization.html#bogus-comment-state
EOF:<! some comment ->('comment', ' some comment')


Ready for review.

@Privat33r-dev
Copy link
ContributorAuthor

@ezio-melotti it would be nice if you can review the change soon :)

@ezio-melotti
Copy link
Member

I would like to give this a proper review before merging, but unfortunately I probably won't have time to look at this until the end of May. If I haven't replied by then, feel free to ping me again, and thanks for working on this!

Privat33r-dev reacted with thumbs up emoji

@Privat33r-dev
Copy link
ContributorAuthor

I would like to give this a proper review before merging, but unfortunately I probably won't have time to look at this until the end of May. If I haven't replied by then, feel free to ping me again, and thanks for working on this!

Thanks for updating me on the review status, glad to know that it's planned 👍🏻

@Privat33r-dev
Copy link
ContributorAuthor

I would like to give this a proper review before merging, but unfortunately I probably won't have time to look at this until the end of May. If I haven't replied by then, feel free to ping me again, and thanks for working on this!

Hi. It's the last day of May, so I decided to ping you :)

ezio-melotti reacted with thumbs up emoji

@Privat33r-dev
Copy link
ContributorAuthor

@ezio-melotti I wonder if you might have some time this time? :)

@Privat33r-dev
Copy link
ContributorAuthor

Privat33r-dev commentedFeb 13, 2025
edited
Loading

@ezio-melotti I appreciate your earlier willingness to review the PR, and I understand that sometimes time is tight. Would you like to review it now? :)

@serhiy-storchakaserhiy-storchaka self-requested a reviewMay 7, 2025 11:38
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ezio-melottiezio-melottiAwaiting requested review from ezio-melottiezio-melotti is a code owner

@serhiy-storchakaserhiy-storchakaAwaiting requested review from serhiy-storchaka

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@Privat33r-dev@ezio-melotti

[8]ページ先頭

©2009-2025 Movatter.jp