-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
Better support for HTML5 attributes #102
Conversation
Better support for HTML5 attributes in Spacebars Helpers. Before HTML5 is not handled properly.
@gcacars: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/ |
return new BooleanHandler(name, value); | ||
} else if (name === 'spellcheck' && elem.contentEditable === 'true' || | ||
(elem.tagName === 'TEXTAREA' || | ||
(elem.tagName === 'INPUT' && elem.type !== 'password'))) { |
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.
Hm, I think in our code style we are aligning all those (
?
Can you improve order/readability/add more parenthesis here because it is unclear how this conditions combine?
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.
Changed. This way is better?
Can you please also add some tests for these changes? |
return new BooleanHandler(name, value); | ||
} else if ((name === 'spellcheck' && elem.contentEditable === 'true') || | ||
(name === 'spellcheck' && elem.tagName === 'TEXTAREA') || | ||
(name === 'spellcheck' && elem.tagName === 'INPUT' && elem.type !== 'password')) { |
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.
Hm, maybe:
(name === 'spellcheck' && (elem.contentEditable === 'true' || elem.tagName === 'TEXTAREA' || (elem.tagName === 'INPUT' && elem.type !== 'password'))
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.
Hmmm... right, I understood now! contenteditable was wrong before. Changed.
name === 'controls' || name === 'loop' || name === 'muted')) { | ||
return new BooleanHandler(name, value); | ||
} else if (name === 'spellcheck' && | ||
(elem.contentEditable === 'true' || elem.tagName === 'TEXTAREA' || |
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.
Indent this for one space.
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.
Changed. I did this to be clear that a parenthesis is inside another.
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.
Hm, I thought you will add one space, not remove it. ;-)
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.
So that second and third are indented once, but at the same level.
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.
Sorry, I had not understood. Now is correct?
Also, add tests please. |
I have no idea which tests you need. Can you help me with this? |
Tests. Something like this, just for boolean variables. So you would like to make sure some of those variables are rendered as boolean variables. |
- Alphabetic order for constructors of HTML elements - Issue meteor#52, PR meteor#102
Tests failed on CircleCI. I am rerunning them. |
- Removed autocomplete (not a boolean attribute) - Fix names of DOM properties
Hm, why those attributes have to be camel case? |
- Spellcheck attribute is a boolean, but is handled like strings. - Fix iframe sandbox with others values - Removed <script> async
- Spellcheck attribute is a boolean, but is handled like strings. - Removed <script> async
Can you explain why removing those? |
Fixed some bugs. I removed that script async for now. I don't know what happened with him.
|
Also, add a line to HISTORY file explaining this pull request. So that once it is merged, history will be up-to-date. See example of split |
Good that we have tests. :-) Please add tests for all those cases you found as tricky. |
Tell me when you think this is ready and complete. |
@mitar for me, it's all ok. |
Thanks! |
} else if (elem.tagName === 'FORM' && name === 'novalidate') { | ||
return new BooleanHandler(name, value); | ||
} else if (elem.tagName === 'IFRAME' && name === 'sandbox' && !value) { | ||
// Disable sandbox mode (others values will be handled as a normal attr) |
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.
@gcacars: Why is sandbox handled differently?
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.
Because we can have:
<iframe sandbox>
And this way, the attribute is simply true or false.
Or we can have this others values:
<iframe sandbox="allow-forms">
<iframe sandbox="allow-pointer-lock">
A different fix has been implemented in 84c58a6. |
Better support for HTML5 attributes in Spacebars helpers. Before HTML5 boolean attributes is not handled properly.
Fixes: #52