-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Double-quotes HTML-encoded in attribute values #969
Comments
The behavior jade has is correct. You could try persuading angularJS to support HTML encoded attributes. Alternatively you could do: li(ng-repeat='item in collection | orderBy:\'order\'') |
This is "correct"? Not for me! This makes Jade quite useless for AngularJS ( or at least clumsy and awkward ), which is a shame. Simply putting the blame on Angular is no solution either! Why would you encode attribute values? |
dramatic, much? li(ng-repeat="item in collection | orderBy:'order'") |
well, that's ok, i guess but...is there just no way to get double-quotes inside an attribute value? |
Why are you guys complain about this so much? I'm pretty sure that in normal HTML you write attribute values in double quotes. So what's the deal? <div data-message="Wouldn't this be the way you would code this?"></div> If you want to use ONLY single quotes then just escape them, as @ForbesLindesay commented above. |
Ok, so maybe I can live without the double-quote character, but what about the "less-than" character?
It is escaping my less-than character:
Gives me this:
...which does not work. How can I do this? |
We have an un-escaped variant for attributes: li(ng-class!="{active: thing.score < 50 }") gives <li ng-class=" { active : thing.score < 50 } "></li> You also could try and improve angularJS by making it understand html encoded attributes. It's arguably a bug that it doesn't do so at the moment. |
Cool! That helps a lot! I am not convinced, however, that this should be considered a bug in Angular.js. Anyway, thanks a lot for the help! |
The point is that html encoding is the only (correct) way to put double quotes in an html attribute (whether you're generating it with jade or writing it by hand) |
No, it makes AngularJS quite useless, because they are ones who don't support spec. Vanilla javascript with all the frameworks I know deal with encoded attributes correctly: console.log($('<input value="test "<>" test"/>')[0].getAttribute('value'))
test "<>" test
console.log($('<input value="test "<>" test"/>').attr('value'))
test "<>" test
Jade is designed to compile to a valid well-formed html. If you want something like this: |
@ rlidwka 👍 It seems Angular guys should fix this issue. Should we consider moving this to their issue tracker? |
@crissdev I already did that with angular/angular.js#2525. It was ignored, then auto-closed. But if you are concerned with this issue, it probably would be a good idea to ask for it to be reopened or just make a new issue - let the Angular devs know that more than one person cares about this. |
Dear all Chart Id: {{item.ChartId}}
@_<script id="javaScriptValue" type="text/javascript" src="{{item.ChartScript}}"></script>_@
{{ item.ChartScript | limitTo:item.ChartScript.length}} what can I do? |
Chart Id: {{item.ChartId}}
{{ item.ChartScript | limitTo:item.ChartScript.length}} i need remove double quotes from html attr |
li(ng-repeat='item in collection | orderBy:"order"')
yields
<li ng-repeat="item in collection | orderBy:"order"">
and does not get processed properly by angular.
Backslash-escaping the double-quotes in jade seems to have no effect.
Currently solving this by inverting the single and double-quotes
li(ng-repeat="item in collection | orderBy:'order'")
, but would like to keep single-quoted attribute definitions to be consistent with the rest of the project.Seems like it would be better if jade inverted double-quotes wrapped within single-quotes, or just maintained the quote style of the original definition (when variable interpolation is not involved)
The text was updated successfully, but these errors were encountered: