Skip to content

Conversation

@StabbarN
Copy link
Collaborator

What's the expected result of div(".a b")?
As the example in https://htpy.dev/usage/#idclass-shorthand shows it should be div(".a.b").

Disallow .a b would be a breaking change so maybe we don't want that? In any case, should there be a test for it?

@StabbarN StabbarN requested a review from pelme August 26, 2025 06:45
@StabbarN StabbarN force-pushed the classes-space-delimiter-test branch from 0617255 to c62b751 Compare August 26, 2025 07:03
@pelme
Copy link
Owner

pelme commented Aug 26, 2025

I think it should be an error, just like div("foo") already is an error. it would be backward incompatible but the current behavior is also broken and leads to frustration when the class just not appears as expected. I think it is worth breaking the backward compatibility to avoid this silent error.

Copy link
Owner

@pelme pelme left a comment

Choose a reason for hiding this comment

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

I think we should be strict and raise errors instead.

StabbarN added a commit to StabbarN/htpy that referenced this pull request Aug 27, 2025
StabbarN added a commit to StabbarN/htpy that referenced this pull request Aug 27, 2025
@StabbarN
Copy link
Collaborator Author

Got it. I created another PR.

@StabbarN StabbarN closed this Aug 28, 2025
pelme pushed a commit that referenced this pull request Aug 28, 2025
* Minor fixes in streaming docs

* Test to assert result with '.a b'

* Raise error for whitespace in class shorthand

See discussion in #152.
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