-
Notifications
You must be signed in to change notification settings - Fork 95
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
Content is not allowed inside an HtmlLiteral #1428
Comments
Will it work then? I think it will then issue another error that binding
|
I've found a workaround: passing the string constant into the |
Ok you are right, our CDATA parsing logic is broken, that should be definitely fixed. And the script tags don't get special handling, I didn't remember that correctly :/ I wonder how people manage to write inline scripts without using |
|
The whole issue from my point of view is that {{ }} is standard for html templates of any kind. Someone can realistically combine DotVVM with another framework that uses {{ }} syntax for it's templates, especially when integrating with legacy systems. There should be a way to 'disable' binding parsing, so the {{blablabla}} will not become DothtmlBindingNode but just part of attribute value/literal. |
Not sure what we can reasonably do about this issue. I fixed the CDATA thing in #1444, so it should be reasonably possible to work around this issue. Enabling content in HtmlLiteral is possible, but won't solve anything. We should IMO also fix the |
In HTML, the content of <script> and <style> tags should not be parsed as HTML, the parser should simply look for the end tag. This eliminates the need to HTML-encode all `<` operators (or even HTML inlined in string literals). To align dothtml and HTML, the patch implements this behavior in dothtml. The change may easily break someone's code, if they already have a script element with entities like <, so it is possible to configure which tags will be parsed as "raw text". By default, it is script, style and also dot:InlineScript and dot:HtmlLiteral (as suggested in #1428). This setting is up for debate. resolves #1445
Currently, DotVVM issues an error when I attempt to do this:
This is useful in cases when DotVVM is not used for string interpolation using the
{{ value }}
syntax, but some other client-side templating library is.The error says "Content is not allowed inside the property 'HtmlLiteral.Html'! (Conflicting node: Node DothtmlElementNode)". This is despite the fact that HtmlLiteral has a
[ControlMarkupOptions(DefaultContentProperty = nameof(Html))]
attibute.IMHO we should allow hard-coded HTML inside an HtmlLiteral and not just a binding.
EDIT: It has occured to me, that maybe I'm not explaining the sample clearly enough. I want for the
{{ columns }}
string to be passed to the browser without any processing (i.e. binding resolution).WORKAROUND: A resource binding on the
HtmlLiteral.Html
property to a string const in C# land.The text was updated successfully, but these errors were encountered: