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

How are attributes with dash (-) treated? #105

Open
ivanceras opened this issue Mar 19, 2019 · 4 comments
Open

How are attributes with dash (-) treated? #105

ivanceras opened this issue Mar 19, 2019 · 4 comments

Comments

@ivanceras
Copy link
Contributor

ivanceras commented Mar 19, 2019

In this example, how is stroke-width=5 treated? The parser complains about this.

<svg>
 <circle cx="25" cy="75" r="20" stroke="red" fill="transparent" stroke-width="5"/>
</svg>
@ivanceras ivanceras changed the title How are attributes with dash (-) threated? How are attributes with dash (-) treated? Mar 19, 2019
@ivanceras
Copy link
Contributor Author

I think this could be easier if done using the same way javascript allow type to be accessed using a camel-case on the identifier that has a dash.

example: z-index could be accessed in javascript using zIndex.
so stroke-width=5 will become strokeWidth=5.

@chinedufn
Copy link
Owner

This is similar to #106 (comment) where the parser currently assumes that all attributes are composed of a single identifier.

Note the single input.parse() here.

input.parse()?


The solution is peeking for a - and if there is one parsing two more identifiers, concatenating their to_string's and then creating a new identifier using that new String.


As with #106 (comment) we'd want a test for this.

I can take a look next time I'm working on the parser. If you'd like to take a look in the meantime I'd be happy to provide more detailed instructions.


Cheers and thanks for opening the issue!!

@apps4uco
Copy link

apps4uco commented Aug 6, 2023

Hi, any chance of raising the priority of this issue as its a showstopper for Accessibility aria-* and bootstrap data-* attributes. Thanks

@EHPS-Oliver
Copy link

as well for http-equiv in meta tags

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

4 participants