forked from 0x2620/oxjs
simpler fix for changes in jquery attr()
This commit is contained in:
parent
cd9a26dab5
commit
f2490fe771
3 changed files with 13 additions and 27 deletions
|
|
@ -43,11 +43,10 @@ Ox.Button = function(options, self) {
|
|||
width: 'auto'
|
||||
})
|
||||
.options(options || {})
|
||||
.attr(Ox.extend({
|
||||
.attr({
|
||||
disabled: self.options.disabled,
|
||||
type: self.options.type == 'text' ? 'button' : 'image'
|
||||
}, self.options.disabled ? {
|
||||
disabled: 'disabled'
|
||||
} : {}))
|
||||
})
|
||||
.addClass('OxButton Ox' + Ox.toTitleCase(self.options.size) +
|
||||
(self.options.disabled ? ' OxDisabled': '') +
|
||||
(self.options.selected ? ' OxSelected': '') +
|
||||
|
|
@ -132,12 +131,8 @@ Ox.Button = function(options, self) {
|
|||
|
||||
self.setOption = function(key, value) {
|
||||
if (key == 'disabled') {
|
||||
if (value) {
|
||||
that.attr({disabled: 'disabled'})
|
||||
} else {
|
||||
that.removeAttr('disabled');
|
||||
}
|
||||
that.toggleClass('OxDisabled');
|
||||
that.attr({disabled: value})
|
||||
.toggleClass('OxDisabled');
|
||||
} else if (key == 'selected') {
|
||||
if (value != that.hasClass('OxSelected')) { // fixme: neccessary?
|
||||
that.toggleClass('OxSelected');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue