-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Emphasize style attribute binding should not be quoted #2461
Emphasize style attribute binding should not be quoted #2461
Conversation
Seems like a bug cc @wycats |
@balinterdi This definitely seems like a bug. For what it's worth, the exact semantics of property vs. attribute are somewhat undefined at the moment, so I'm pretty nervous about having people depend on a side effect of property vs. attribute that provides even-less-defined safe string semantics. |
Should I create a proper issue for this in the emberjs repo? I can include the example in the blog post (which I have also extracted to a gist). |
it in the template, as this would prevent Ember from seeing it as safe: | ||
|
||
```handlebars | ||
<div style={{myStyle}}></div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is exactly the same example as a few paragraphs above. Perhaps you can just add test to one of those paragraphs making this more explicit? Repeating the code doesn't seem helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, I've moved that paragraph under the definition of the myStyle
property and removed the duplicated template code snippet.
This is definitely needed right now. We distrust anything that goes through |
8656bbe
to
f87b8e8
Compare
@mixonic I'm not sure I see what you mean, what is needed? Do you consider the quoted version triggering the warning a bug? |
@balinterdi sorry for the confusing note- I'm not sure I consider it a "bug". Two safe things, when combined, may be unsafe. However I'm sure we can do better in common cases like Regardless I'd like to merge this docs improvement. @balinterdi can you also change the JS part of the example to: return Ember.String.htmlSafe("color: " + color); instead of using the Handlebars namespace? If you do this I'll ! |
f87b8e8
to
30ec9c5
Compare
Thank you, just changed it to use |
…e-binding Emphasize style attribute binding should not be quoted
Thanks @balinterdi |
I've spent quite some time debugging this (see my blog post), and although the section in the guides is correct, I think others would benefit by having this emphasized.