Better support for HTML5 attributes #102

Merged
merged 18 commits into from Sep 26, 2016

Conversation

Projects
None yet
3 participants
@gcacars
Contributor

gcacars commented Sep 17, 2016

Better support for HTML5 attributes in Spacebars helpers. Before HTML5 boolean attributes is not handled properly.
Fixes: #52

Better support for HTML5 attributes
Better support for HTML5 attributes in Spacebars Helpers. Before HTML5 is not handled properly.
@meteor-bot

This comment has been minimized.

Show comment
Hide comment
@meteor-bot

meteor-bot Sep 17, 2016

@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/

@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/

packages/blaze/attrs.js
+ return new BooleanHandler(name, value);
+ } else if (name === 'spellcheck' && elem.contentEditable === 'true' ||
+ (elem.tagName === 'TEXTAREA' ||
+ (elem.tagName === 'INPUT' && elem.type !== 'password'))) {

This comment has been minimized.

@mitar

mitar Sep 17, 2016

Collaborator

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?

@mitar

mitar Sep 17, 2016

Collaborator

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?

This comment has been minimized.

@gcacars

gcacars Sep 17, 2016

Contributor

Changed. This way is better?

@gcacars

gcacars Sep 17, 2016

Contributor

Changed. This way is better?

@mitar

This comment has been minimized.

Show comment
Hide comment
@mitar

mitar Sep 17, 2016

Collaborator

Can you please also add some tests for these changes?

Collaborator

mitar commented Sep 17, 2016

Can you please also add some tests for these changes?

gcacars added some commits Sep 17, 2016

packages/blaze/attrs.js
+ 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')) {

This comment has been minimized.

@mitar

mitar Sep 17, 2016

Collaborator

Hm, maybe:

(name === 'spellcheck' && (elem.contentEditable === 'true' || elem.tagName === 'TEXTAREA' || (elem.tagName === 'INPUT' && elem.type !== 'password'))
@mitar

mitar Sep 17, 2016

Collaborator

Hm, maybe:

(name === 'spellcheck' && (elem.contentEditable === 'true' || elem.tagName === 'TEXTAREA' || (elem.tagName === 'INPUT' && elem.type !== 'password'))

This comment has been minimized.

@gcacars

gcacars Sep 17, 2016

Contributor

Hmmm... right, I understood now! contenteditable was wrong before. Changed.

@gcacars

gcacars Sep 17, 2016

Contributor

Hmmm... right, I understood now! contenteditable was wrong before. Changed.

packages/blaze/attrs.js
+ name === 'controls' || name === 'loop' || name === 'muted')) {
+ return new BooleanHandler(name, value);
+ } else if (name === 'spellcheck' &&
+ (elem.contentEditable === 'true' || elem.tagName === 'TEXTAREA' ||

This comment has been minimized.

@mitar

mitar Sep 17, 2016

Collaborator

Indent this for one space.

@mitar

mitar Sep 17, 2016

Collaborator

Indent this for one space.

This comment has been minimized.

@gcacars

gcacars Sep 18, 2016

Contributor

Changed. I did this to be clear that a parenthesis is inside another.

@gcacars

gcacars Sep 18, 2016

Contributor

Changed. I did this to be clear that a parenthesis is inside another.

This comment has been minimized.

@mitar

mitar Sep 18, 2016

Collaborator

Hm, I thought you will add one space, not remove it. ;-)

@mitar

mitar Sep 18, 2016

Collaborator

Hm, I thought you will add one space, not remove it. ;-)

This comment has been minimized.

@mitar

mitar Sep 18, 2016

Collaborator

So that second and third are indented once, but at the same level.

@mitar

mitar Sep 18, 2016

Collaborator

So that second and third are indented once, but at the same level.

This comment has been minimized.

@gcacars

gcacars Sep 18, 2016

Contributor

Sorry, I had not understood. Now is correct?

@gcacars

gcacars Sep 18, 2016

Contributor

Sorry, I had not understood. Now is correct?

@mitar

This comment has been minimized.

Show comment
Hide comment
@mitar

mitar Sep 17, 2016

Collaborator

Also, add tests please.

Collaborator

mitar commented Sep 17, 2016

Also, add tests please.

@gcacars

This comment has been minimized.

Show comment
Hide comment
@gcacars

gcacars Sep 18, 2016

Contributor

I have no idea which tests you need. Can you help me with this?

Contributor

gcacars commented Sep 18, 2016

I have no idea which tests you need. Can you help me with this?

gcacars added some commits Sep 18, 2016

@mitar

This comment has been minimized.

Show comment
Hide comment
@mitar

mitar Sep 18, 2016

Collaborator

Tests. Something like this, just for boolean variables. So you would like to make sure some of those variables are rendered as boolean variables.

Collaborator

mitar commented Sep 18, 2016

Tests. Something like this, just for boolean variables. So you would like to make sure some of those variables are rendered as boolean variables.

Add Tests to better support for HTML5 attributes
- Alphabetic order for constructors of HTML elements
- Issue #52, PR #102
@mitar

This comment has been minimized.

Show comment
Hide comment
@mitar

mitar Sep 18, 2016

Collaborator

Tests failed on CircleCI. I am rerunning them.

Collaborator

mitar commented Sep 18, 2016

Tests failed on CircleCI. I am rerunning them.

gcacars added some commits Sep 18, 2016

Fix JS HTML attribute names
- Removed autocomplete (not a boolean attribute)
- Fix names of DOM properties
@mitar

This comment has been minimized.

Show comment
Hide comment
@mitar

mitar Sep 18, 2016

Collaborator

Hm, why those attributes have to be camel case?

Collaborator

mitar commented Sep 18, 2016

Hm, why those attributes have to be camel case?

gcacars added some commits Sep 18, 2016

Removed spellcheck property
- Spellcheck attribute is a boolean, but is handled like strings.
- Fix iframe sandbox with others values
- Removed <script> async
Removed spellcheck test
- Spellcheck attribute is a boolean, but is handled like strings.
- Removed <script> async
@mitar

This comment has been minimized.

Show comment
Hide comment
@mitar

mitar Sep 18, 2016

Collaborator

Can you explain why removing those?

Collaborator

mitar commented Sep 18, 2016

Can you explain why removing those?

@gcacars

This comment has been minimized.

Show comment
Hide comment
@gcacars

gcacars Sep 18, 2016

Contributor

Fixed some bugs. I removed that script async for now. I don't know what happened with him.
Spellcheck has values "true" and "false", is not a trully boolean

speelcheck="true"
Contributor

gcacars commented Sep 18, 2016

Fixed some bugs. I removed that script async for now. I don't know what happened with him.
Spellcheck has values "true" and "false", is not a trully boolean

speelcheck="true"
@mitar

This comment has been minimized.

Show comment
Hide comment
@mitar

mitar Sep 18, 2016

Collaborator

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 templating package for the format of the line I think suitable for this pull request as well.

Collaborator

mitar commented Sep 18, 2016

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 templating package for the format of the line I think suitable for this pull request as well.

@mitar

This comment has been minimized.

Show comment
Hide comment
@mitar

mitar Sep 18, 2016

Collaborator

Good that we have tests. :-) Please add tests for all those cases you found as tricky.

Collaborator

mitar commented Sep 18, 2016

Good that we have tests. :-) Please add tests for all those cases you found as tricky.

@mitar

This comment has been minimized.

Show comment
Hide comment
@mitar

mitar Sep 18, 2016

Collaborator

Tell me when you think this is ready and complete.

Collaborator

mitar commented Sep 18, 2016

Tell me when you think this is ready and complete.

@gcacars

This comment has been minimized.

Show comment
Hide comment
@gcacars

gcacars Sep 26, 2016

Contributor

@mitar for me, it's all ok.

Contributor

gcacars commented Sep 26, 2016

@mitar for me, it's all ok.

@gcacars gcacars closed this Sep 26, 2016

@gcacars gcacars reopened this Sep 26, 2016

@mitar mitar merged commit e9959eb into meteor:master Sep 26, 2016

2 checks passed

CLA Author has signed the Meteor CLA.
Details
ci/circleci Your tests passed on CircleCI!
Details
@mitar

This comment has been minimized.

Show comment
Hide comment
@mitar

mitar Sep 26, 2016

Collaborator

Thanks!

Collaborator

mitar commented Sep 26, 2016

Thanks!

@gcacars gcacars deleted the gcacars:patch-1 branch Oct 1, 2016

+ } 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)

This comment has been minimized.

@mitar

mitar Dec 30, 2016

Collaborator

@gcacars: Why is sandbox handled differently?

@mitar

mitar Dec 30, 2016

Collaborator

@gcacars: Why is sandbox handled differently?

This comment has been minimized.

@gcacars

gcacars Dec 31, 2016

Contributor

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">
@gcacars

gcacars Dec 31, 2016

Contributor

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">

mitar added a commit that referenced this pull request Dec 31, 2016

Fixes regression reported in #151.
Reverted #102 and made a different fix for removing attributes for
`false` values in dynamic attributes (#52). Fixes #151.
@mitar

This comment has been minimized.

Show comment
Hide comment
@mitar

mitar Dec 31, 2016

Collaborator

A different fix has been implemented in 84c58a6.

Collaborator

mitar commented Dec 31, 2016

A different fix has been implemented in 84c58a6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment