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

Allow many ':' in attributes #393

Closed
wants to merge 0 commits into from
Closed

Conversation

RedPhoenixQ
Copy link
Contributor

To do this, try_namespace_name now looks for nested namespaces. Because try_name'gets called, another Ident must be consumed to prevent and early return, which means that :: would not be valid, but a:b-c:d would be fine.

This allows for more custom attributes from different frameworks, specifically htmx's hx-on as mentioned in #194 (comment).

This is my first PR, I'll gladly take critique and make any changes necessary

@fraschm1998
Copy link

Could you add support for alpine.js as well for '.':

x-on:scroll.window="showBar = (window.pageYOffset > 20) ? true : false"

@RedPhoenixQ
Copy link
Contributor Author

Could you add support for alpine.js as well for '.':

x-on:scroll.window="showBar = (window.pageYOffset > 20) ? true : false"

I don't think this is easily done while keeping the class shorthand. Since the macro doesn't see whitespace foo.bar is the same as foo .bar which would be a valid attribute and then a class name via the shorthand.

The only way to do this would to somehow replace or escape the period . in the attribute name or add an escape character that would have to be a recognized Rust token. \ cannot be used as it isn't part of Rust syntax. Something like *. or ^. could work but isn't very elegant.

I don't want to make a change like class shorthand can only appear immediately after the element since that would be a breaking change.

@fraschm1998
Copy link

Any idea how difficult it would be to add quoted attribute supported as mentioned here

@RedPhoenixQ
Copy link
Contributor Author

Though about it and just tried it. I seem to have it working and will be making a new PR for that change, since it is not related to the changes in this PR.

@RedPhoenixQ
Copy link
Contributor Author

#396 Now fixes the same issue by allowing "literals"="true"

@dacbd
Copy link

dacbd commented Nov 5, 2023

Would like to see this feature too 👍 #396 would be just as good 👍

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.

3 participants