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

Fix semantic whitespace (Issue #369) #461

Closed
wants to merge 6 commits into from

Conversation

jvanasco
Copy link
Contributor

After testing with many edge-cases, I decided two things:

  1. minimizing whitespace is far too difficult due to the design of this package. the 'stripping' of tags occurs in a place that can not look backwards enough and can not access the 'content' without a large redesign

  2. the whitespace should be a newline, not a space (as suggested in [Accessibility bug] Semantic whitespace implied by block elements isn't retained properly #369). this is because content becomes too confusing to understand with a "space" (such as list elements)

… space)

* adjusting if-condition to have a lower-cpu check for `_token_data` first, before checking for it's type via `isinstance`
2. tracking state of the last stripped tag
3. some small optimizations on __init__
* dropped tracking of the last tag; not worth it
@jvanasco
Copy link
Contributor Author

Closing in favor of a new PR against the current master.

@jvanasco jvanasco closed this Jul 23, 2021
jvanasco added a commit to jvanasco/bleach that referenced this pull request Jul 23, 2021
block elements are tracked and a newline is inserted when they are stripped.

new tests are included.
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.

None yet

1 participant