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

Alternative class/id syntax? #35

Closed
TheNeikos opened this issue May 31, 2016 · 3 comments
Closed

Alternative class/id syntax? #35

TheNeikos opened this issue May 31, 2016 · 3 comments

Comments

@TheNeikos
Copy link
Contributor

TheNeikos commented May 31, 2016

Would it be possible to write something like this:

html! {
    .this-is-a-class#and_id {
        "Hello"
    }
}

Which would be a div with the class 'this-is-a-class' and the id 'and_id'. It would make writing a bit more ergonomic.

@lambda-fairy
Copy link
Owner

Good idea!

There is already a shorthand for classes, but you do need to write out the tag name (e.g. div.this-is-a-class). This restriction is to avoid ambiguity: if you write something like div .foo it would be unclear whether you meant two nested <div>s or just one. See #28.

There's not yet a shorthand for IDs though, and I'd welcome a PR for that :)

@lambda-fairy
Copy link
Owner

There's not yet a shorthand for IDs though, and I'd welcome a PR for that :)

Never mind, I've implemented it myself :P

@TheNeikos
Copy link
Contributor Author

Awesome! Thanks :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants