Skip to content
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

Merged
merged 18 commits into from
Sep 26, 2016
Merged
23 changes: 23 additions & 0 deletions packages/blaze/attrs.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,29 @@ Blaze._makeAttributeHandler = function (elem, name, value) {
} else if ((elem.tagName === 'OPTION' && name === 'selected') ||
(elem.tagName === 'INPUT' && name === 'checked')) {
return new BooleanHandler(name, value);
} else if (name === 'autocomplete' || name === 'autofocus' || name === 'disabled' ||
name === 'hidden' || name === 'readonly' || name === 'required') {
return new BooleanHandler(name, value);
} else if (elem.tagName === 'FORM' && name === 'novalidate') {
return new BooleanHandler(name, value);
} else if (elem.tagName === 'IFRAME' && name === 'sandbox') {
return new BooleanHandler(name, value);
} else if (elem.tagName === 'IMG' && name === 'ismap') {
return new BooleanHandler(name, value);
} else if ((elem.tagName === 'INPUT' || elem.tagName === 'SELECT')
&& name === 'multiple') {
return new BooleanHandler(name, value);
} else if (elem.tagName === 'OL' && name === 'reversed') {
return new BooleanHandler(name, value);
} else if (elem.tagName === 'SCRIPT' && (name === 'async' || name === 'defer')) {
return new BooleanHandler(name, value);
} else if (elem.tagName === 'VIDEO' && (name === 'autoplay' ||
name === 'controls' || name === 'loop' || name === 'muted')) {
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')) {
Copy link
Contributor

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'))

Copy link
Contributor Author

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.

return new BooleanHandler(name, value);
} else if ((elem.tagName === 'TEXTAREA' || elem.tagName === 'INPUT')
&& name === 'value') {
// internally, TEXTAREAs tracks their value in the 'value'
Expand Down