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'
|
width: 'auto'
|
||||||
})
|
})
|
||||||
.options(options || {})
|
.options(options || {})
|
||||||
.attr(Ox.extend({
|
.attr({
|
||||||
|
disabled: self.options.disabled,
|
||||||
type: self.options.type == 'text' ? 'button' : 'image'
|
type: self.options.type == 'text' ? 'button' : 'image'
|
||||||
}, self.options.disabled ? {
|
})
|
||||||
disabled: 'disabled'
|
|
||||||
} : {}))
|
|
||||||
.addClass('OxButton Ox' + Ox.toTitleCase(self.options.size) +
|
.addClass('OxButton Ox' + Ox.toTitleCase(self.options.size) +
|
||||||
(self.options.disabled ? ' OxDisabled': '') +
|
(self.options.disabled ? ' OxDisabled': '') +
|
||||||
(self.options.selected ? ' OxSelected': '') +
|
(self.options.selected ? ' OxSelected': '') +
|
||||||
|
@ -132,12 +131,8 @@ Ox.Button = function(options, self) {
|
||||||
|
|
||||||
self.setOption = function(key, value) {
|
self.setOption = function(key, value) {
|
||||||
if (key == 'disabled') {
|
if (key == 'disabled') {
|
||||||
if (value) {
|
that.attr({disabled: value})
|
||||||
that.attr({disabled: 'disabled'})
|
.toggleClass('OxDisabled');
|
||||||
} else {
|
|
||||||
that.removeAttr('disabled');
|
|
||||||
}
|
|
||||||
that.toggleClass('OxDisabled');
|
|
||||||
} else if (key == 'selected') {
|
} else if (key == 'selected') {
|
||||||
if (value != that.hasClass('OxSelected')) { // fixme: neccessary?
|
if (value != that.hasClass('OxSelected')) { // fixme: neccessary?
|
||||||
that.toggleClass('OxSelected');
|
that.toggleClass('OxSelected');
|
||||||
|
|
|
@ -37,9 +37,9 @@ Ox.Checkbox = function(options, self) {
|
||||||
(self.options.overlap == 'none' ? '' : ' OxOverlap' +
|
(self.options.overlap == 'none' ? '' : ' OxOverlap' +
|
||||||
Ox.toTitleCase(self.options.overlap))
|
Ox.toTitleCase(self.options.overlap))
|
||||||
)
|
)
|
||||||
.attr(self.options.disabled ? {
|
.attr({
|
||||||
disabled: 'disabled'
|
disabled: self.options.disabled
|
||||||
} : {});
|
});
|
||||||
|
|
||||||
if (self.options.title) {
|
if (self.options.title) {
|
||||||
self.options.width != 'auto' && that.css({
|
self.options.width != 'auto' && that.css({
|
||||||
|
@ -102,11 +102,7 @@ Ox.Checkbox = function(options, self) {
|
||||||
if (key == 'checked') {
|
if (key == 'checked') {
|
||||||
that.toggleChecked();
|
that.toggleChecked();
|
||||||
} else if (key == 'disabled') {
|
} else if (key == 'disabled') {
|
||||||
if (value) {
|
that.attr({disabled: value})
|
||||||
that.attr({disabled: 'disabled'})
|
|
||||||
} else {
|
|
||||||
that.removeAttr('disabled');
|
|
||||||
}
|
|
||||||
} else if (key == 'title') {
|
} else if (key == 'title') {
|
||||||
self.$title.options({title: value});
|
self.$title.options({title: value});
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,11 +205,10 @@ Ox.Input = function(options, self) {
|
||||||
|
|
||||||
self.$input = $(self.options.type == 'textarea' ? '<textarea>' : '<input>')
|
self.$input = $(self.options.type == 'textarea' ? '<textarea>' : '<input>')
|
||||||
.addClass('OxInput OxMedium Ox' + Ox.toTitleCase(self.options.style))
|
.addClass('OxInput OxMedium Ox' + Ox.toTitleCase(self.options.style))
|
||||||
.attr(Ox.extend({
|
.attr({
|
||||||
|
disabled: self.options.disabled,
|
||||||
type: self.options.type == 'password' ? 'password' : 'text'
|
type: self.options.type == 'password' ? 'password' : 'text'
|
||||||
}, self.options.disabled ? {
|
})
|
||||||
disabled: 'disabled'
|
|
||||||
} : {}))
|
|
||||||
.css(Ox.extend({
|
.css(Ox.extend({
|
||||||
width: self.inputWidth + 'px',
|
width: self.inputWidth + 'px',
|
||||||
textAlign: self.options.textAlign
|
textAlign: self.options.textAlign
|
||||||
|
@ -794,11 +793,7 @@ Ox.Input = function(options, self) {
|
||||||
}
|
}
|
||||||
self.bindKeyboard = self.options.autocomplete || self.options.autovalidate;
|
self.bindKeyboard = self.options.autocomplete || self.options.autovalidate;
|
||||||
} else if (key == 'disabled') {
|
} else if (key == 'disabled') {
|
||||||
if (value) {
|
self.$input.attr({disabled: value});
|
||||||
self.$input.attr({disabled: 'disabled'});
|
|
||||||
} else {
|
|
||||||
self.$input.removeAttr('disabled');
|
|
||||||
}
|
|
||||||
} else if (key == 'height') {
|
} else if (key == 'height') {
|
||||||
that.css({
|
that.css({
|
||||||
height: value + 'px'
|
height: value + 'px'
|
||||||
|
|
Loading…
Reference in a new issue