button.js revision a7e9ca67d735ae1bcdc1f7deb35ab98dd9c9f614
function ButtonWidget(config) {
}
initializer: function(config) {
},
CONTENT_TEMPLATE: null,
bindUI: function() {
var button = this;
},
_uiSetSelected: function(value) {
this.get('contentBox').toggleClass('yui3-button-selected', value).set('aria-pressed', value); // TODO should support aria-checked (if applicable)
},
_afterLabelChange: function(e) {
this._uiSetLabel(e.newVal);
},
_afterDisabledChange: function(e) {
this._uiSetDisabled(e.newVal);
},
_afterSelectedChange: function(e) {
this._uiSetSelected(e.newVal);
},
syncUI: function() {
},
}, {
NAME: 'button',
});
ButtonWidget.ATTRS = {
label: {
},
disabled: {
value: false
},
selected: {
value: false
}
};
return this._uiGetLabel();
},
},
}
};
function ToggleButton(config) {
}
// TODO: move to ButtonCore subclass to enable toggle plugin, widget, etc.
trigger: 'click',
select: function() {
this.set('selected', true);
},
unselect: function() {
this.set('selected', false);
},
toggle: function() {
var button = this;
},
bindUI: function() {
var button = this;
}
}, {
NAME: 'toggleButton'
});
// Export
Y.Button = ButtonWidget;
Y.ToggleButton = ToggleButton;