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

Special syntax to disable tag name checking #110

Merged
merged 3 commits into from
Oct 21, 2018

Conversation

glmars
Copy link
Contributor

@glmars glmars commented Oct 20, 2018

Introducing a special syntax to disable tag name checking (#43 (comment)):

@dom def tag = <raw:custom-tag/>

Unfortunately, it is not possible to use the same syntax as for attributes, because data name is already busy (there is data html tag).

I have selected a raw: prefix (similar to raw""" """ string interpolator :) )

- also added a base support of prefixed tags
- also fixed a dashed tags support
@Atry
Copy link
Collaborator

Atry commented Oct 21, 2018

Is it possible to override Tags.data to override lazy val data = new TypedTag[Element] with Dynamic { ... }?

case PrefixedName(prefix, localPart) =>
localPart.split(':').foldLeft(q"$objectAccess.${TermName(NameTransformer.encode(prefix))}") {
(prefixExpr, segmentName) =>
q"$prefixExpr.${TermName(NameTransformer.encode(segmentName))}"
Copy link
Collaborator

@Atry Atry Oct 21, 2018

Choose a reason for hiding this comment

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

This change enables svg tags in the future by simply adding an additional val svg: scalatags.jsdom.SvgTags.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh! Very good! I am glad to hear it.
But when I was writing this, I was thinking about different thing (I am planning to propose a discussion about this in near future 😉). In any case, I suppose that support of an element namespace is a useful feature for Binding.scala

@Atry Atry changed the base branch from 11.2.x to 11.3.x October 21, 2018 14:59
@Atry Atry merged commit ed624fe into ThoughtWorksInc:11.3.x Oct 21, 2018
@Atry
Copy link
Collaborator

Atry commented Oct 21, 2018

I merged this PR with a little change (using data prefix instead of raw)

@glmars Thank you! You introduced so many wonderful features in Binding.scala.

}

override lazy val data = new DynamicDataTag()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A good hack 👍
If you like it, I like too 😄

@glmars
Copy link
Contributor Author

glmars commented Oct 21, 2018

Thank you for the excellent library!
I'm glad to help.

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