Skip to content

Commit

Permalink
BEMHTML: use proper boolean values for attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Angelina Konstantinova committed Feb 10, 2016
1 parent 2318775 commit f994f18
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 15 deletions.
@@ -1,3 +1,3 @@
block('button').mod('togglable', 'check').attrs()(function() {
return this.extend(applyNext(), { 'aria-pressed' : !!this.mods.checked });
return this.extend(applyNext(), { 'aria-pressed' : (!!this.mods.checked).toString() });
});
@@ -1,3 +1,3 @@
block('button').mod('togglable', 'radio').attrs()(function() {
return this.extend(applyNext(), { 'aria-pressed' : !!this.mods.checked });
return this.extend(applyNext(), { 'aria-pressed' : (!!this.mods.checked).toString() });
});
2 changes: 1 addition & 1 deletion common.blocks/button/_type/button_type_link.bemhtml
Expand Up @@ -7,7 +7,7 @@ block('button').mod('type', 'link')(

ctx.target && (attrs.target = ctx.target);
this.mods.disabled?
attrs['aria-disabled'] = true :
attrs['aria-disabled'] = 'true' :
attrs.href = ctx.url;

return this.extend(applyNext(), attrs);
Expand Down
2 changes: 1 addition & 1 deletion common.blocks/button/button.bemhtml
Expand Up @@ -27,7 +27,7 @@ block('button')(
};

this.mods.disabled &&
!this._isRealButton && (attrs['aria-disabled'] = true);
!this._isRealButton && (attrs['aria-disabled'] = 'true');

return attrs;
},
Expand Down
2 changes: 1 addition & 1 deletion common.blocks/checkbox/_type/checkbox_type_button.bemhtml
Expand Up @@ -15,7 +15,7 @@ block('checkbox').mod('type', 'button')(
attrs : {
role : 'checkbox',
'aria-pressed' : undefined,
'aria-checked' : !!mods.checked
'aria-checked' : (!!mods.checked).toString()
},
title : ctx.title,
content : [
Expand Down
Expand Up @@ -16,9 +16,9 @@ block('dropdown').mod('switcher', 'button').elem('switcher').def()(function() {
resMods.theme || (resMods.theme = dropdownMods.theme);
resMods.disabled = dropdownMods.disabled;

resAttrs['aria-haspopup'] = true;
resAttrs['aria-haspopup'] = 'true';
resAttrs['aria-controls'] = this._popupId;
resAttrs['aria-expanded'] = false;
resAttrs['aria-expanded'] = 'false';

res.mix = apply('mix');
}
Expand Down
Expand Up @@ -15,9 +15,9 @@ block('dropdown').mod('switcher', 'link').elem('switcher').def()(function() {
resMods.theme || (resMods.theme = dropdownMods.theme);
resMods.disabled = dropdownMods.disabled;

resAttrs['aria-haspopup'] = true;
resAttrs['aria-haspopup'] = 'true';
resAttrs['aria-controls'] = this._popupId;
resAttrs['aria-expanded'] = false;
resAttrs['aria-expanded'] = 'false';

res.mix = apply('mix');
}
Expand Down
2 changes: 1 addition & 1 deletion common.blocks/link/link.bemhtml
Expand Up @@ -26,7 +26,7 @@ block('link')(
tabIndex = ctx.tabIndex || 0;
}
} else {
attrs['aria-disabled'] = true;
attrs['aria-disabled'] = 'true';
}

typeof tabIndex === 'undefined' || (attrs.tabindex = tabIndex);
Expand Down
4 changes: 2 additions & 2 deletions common.blocks/menu-item/menu-item.bemhtml
Expand Up @@ -17,8 +17,8 @@ block('menu-item')(
attrs = {
role : role,
id : this.generateId(),
'aria-disabled' : mods.disabled,
'aria-checked' : menuMode && !!mods.checked
'aria-disabled' : mods && mods.disabled && 'true' || undefined,
'aria-checked' : menuMode && (!!mods.checked).toString()
};

return attrs;
Expand Down
2 changes: 1 addition & 1 deletion common.blocks/menu/menu.bemhtml
Expand Up @@ -43,7 +43,7 @@ block('menu')(
var attrs = { role : 'menu' };

this.mods.disabled?
attrs['aria-disabled'] = true :
attrs['aria-disabled'] = 'true' :
attrs.tabindex = 0;

return attrs;
Expand Down
2 changes: 1 addition & 1 deletion common.blocks/modal/modal.bemhtml
Expand Up @@ -11,7 +11,7 @@ block('modal')(

attrs()({
role : 'dialog',
'aria-hidden' : true
'aria-hidden' : 'true'
}),

content()(function() {
Expand Down
2 changes: 1 addition & 1 deletion common.blocks/popup/popup.bemhtml
Expand Up @@ -9,5 +9,5 @@ block('popup')(
zIndexGroupLevel : ctx.zIndexGroupLevel
};
}),
attrs()({ 'aria-hidden' : true })
attrs()({ 'aria-hidden' : 'true' })
);

0 comments on commit f994f18

Please sign in to comment.