fix a regression with regards to the disabled state of form elements (jquery 1.6 attr() has changed)
This commit is contained in:
parent
609f834cd3
commit
e1eb3feb49
3 changed files with 25 additions and 13 deletions
|
@ -43,10 +43,11 @@ Ox.Button = function(options, self) {
|
|||
width: 'auto'
|
||||
})
|
||||
.options(options || {})
|
||||
.attr({
|
||||
disabled: self.options.disabled ? 'disabled' : '',
|
||||
.attr(Ox.extend({
|
||||
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': '') +
|
||||
|
@ -131,10 +132,12 @@ Ox.Button = function(options, self) {
|
|||
|
||||
self.setOption = function(key, value) {
|
||||
if (key == 'disabled') {
|
||||
that.attr({
|
||||
disabled: value ? 'disabled' : ''
|
||||
})
|
||||
.toggleClass('OxDisabled');
|
||||
if (value) {
|
||||
that.attr({disabled: 'disabled'})
|
||||
} else {
|
||||
that.removeAttr('disabled');
|
||||
}
|
||||
that.toggleClass('OxDisabled');
|
||||
} else if (key == 'selected') {
|
||||
if (value != that.hasClass('OxSelected')) { // fixme: neccessary?
|
||||
that.toggleClass('OxSelected');
|
||||
|
|
|
@ -101,6 +101,12 @@ Ox.Checkbox = function(options, self) {
|
|||
self.setOption = function(key, value) {
|
||||
if (key == 'checked') {
|
||||
that.toggleChecked();
|
||||
} else if (key == 'disabled') {
|
||||
if (value) {
|
||||
that.attr({disabled: 'disabled'})
|
||||
} else {
|
||||
that.removeAttr('disabled');
|
||||
}
|
||||
} else if (key == 'title') {
|
||||
self.$title.options({title: value});
|
||||
}
|
||||
|
|
|
@ -205,10 +205,11 @@ Ox.Input = function(options, self) {
|
|||
|
||||
self.$input = $(self.options.type == 'textarea' ? '<textarea>' : '<input>')
|
||||
.addClass('OxInput OxMedium Ox' + Ox.toTitleCase(self.options.style))
|
||||
.attr({
|
||||
disabled: self.options.disabled ? 'disabled' : '',
|
||||
.attr(Ox.extend({
|
||||
type: self.options.type == 'password' ? 'password' : 'text'
|
||||
})
|
||||
}, self.options.disabled ? {
|
||||
disabled: 'disabled'
|
||||
} : {})
|
||||
.css(Ox.extend({
|
||||
width: self.inputWidth + 'px',
|
||||
textAlign: self.options.textAlign
|
||||
|
@ -793,9 +794,11 @@ Ox.Input = function(options, self) {
|
|||
}
|
||||
self.bindKeyboard = self.options.autocomplete || self.options.autovalidate;
|
||||
} else if (key == 'disabled') {
|
||||
self.$input.attr({
|
||||
disabled: value ? 'disabled' : ''
|
||||
});
|
||||
if (value) {
|
||||
self.$input.attr({disabled: 'disabled'});
|
||||
} else {
|
||||
self.$input.removeAttr('disabled');
|
||||
}
|
||||
} else if (key == 'height') {
|
||||
that.css({
|
||||
height: value + 'px'
|
||||
|
|
Loading…
Reference in a new issue