-
Notifications
You must be signed in to change notification settings - Fork 35
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
Address vhtml#11: Add ability to directly set innerHTML of a component using the dangerouslySetInnerHTML
attribute.
#12
Address vhtml#11: Add ability to directly set innerHTML of a component using the dangerouslySetInnerHTML
attribute.
#12
Conversation
…t using the `dangerouslySetInnerHTML` attribute.
+1 for this |
I think we can slim this down a bit without losing much functionality, but inlining the property name and skipping one of the conditionals: if (attrs && attrs.dangerouslySetInnerHTML) {
s += attrs.dangerouslySetInnerHTML.__html;
} |
Good call on dropping the extra check, no need for However I did find |
Saves 3 bytes.
This allows us to assume that `attrs` is a plain object, and remove multiple guards. Saves 6B.
Aha, whoops maybe I should've looked here before implementing #17… #17 does pass one test that this doesn't, though I'm not sure whether it "should" according to the spec. The test is: it('should support dangerouslySetInnerHTML (without __html)', () => {
expect(
<div dangerouslySetInnerHTML>foo</div>
).to.equal(
'<div></div>'
);
}); In this case, this PR returns |
@ithinkihaveacat - I'm going to merge Peter's here, since it's substantially smaller. I personally don't care what we return for the case of a boolean dangerouslySetInnerHTML value - since that actually throws in React most folks wouldn't be using it. |
Should take care of #11.
New Size:.630B
New Size:.624B
New Size:
615B
.50B
is kinda significant 😢 but I consider this a useful feature.This was initially a
50B
increase in size but is now worked down to35B
increase in size.