1
0
mirror of synced 2024-11-25 22:36:03 +03:00

Added back select2("enable")

This also adds a console warning if the `enable` or `val` method is
called.
This commit is contained in:
Kevin Brown 2014-12-11 17:37:57 -05:00
parent 100015b205
commit 3ff78d8145
7 changed files with 127 additions and 2 deletions

View File

@ -3750,7 +3750,32 @@ define('select2/core',[
return this.$container.hasClass('select2-container--open');
};
Select2.prototype.enable = function (args) {
if (console && console.warn) {
console.warn(
'Select2: The `select2("val")` method has been deprecated and will be' +
' removed in later Select2 versions. Use $element.prop("disabled") ' +
'instead.'
);
}
if (args.length === 0) {
args = [true];
}
var disabled = !args[0];
this.$element.prop('disabled', disabled);
};
Select2.prototype.val = function (args) {
if (console && console.warn) {
console.warn(
'Select2: The `select2("val")` method has been deprecated and will be' +
' removed in later Select2 versions. Use $element.val() instead.'
);
}
if (args.length === 0) {
return this.$element.val();
}

View File

@ -3750,7 +3750,32 @@ define('select2/core',[
return this.$container.hasClass('select2-container--open');
};
Select2.prototype.enable = function (args) {
if (console && console.warn) {
console.warn(
'Select2: The `select2("val")` method has been deprecated and will be' +
' removed in later Select2 versions. Use $element.prop("disabled") ' +
'instead.'
);
}
if (args.length === 0) {
args = [true];
}
var disabled = !args[0];
this.$element.prop('disabled', disabled);
};
Select2.prototype.val = function (args) {
if (console && console.warn) {
console.warn(
'Select2: The `select2("val")` method has been deprecated and will be' +
' removed in later Select2 versions. Use $element.val() instead.'
);
}
if (args.length === 0) {
return this.$element.val();
}

View File

@ -13285,7 +13285,32 @@ define('select2/core',[
return this.$container.hasClass('select2-container--open');
};
Select2.prototype.enable = function (args) {
if (console && console.warn) {
console.warn(
'Select2: The `select2("val")` method has been deprecated and will be' +
' removed in later Select2 versions. Use $element.prop("disabled") ' +
'instead.'
);
}
if (args.length === 0) {
args = [true];
}
var disabled = !args[0];
this.$element.prop('disabled', disabled);
};
Select2.prototype.val = function (args) {
if (console && console.warn) {
console.warn(
'Select2: The `select2("val")` method has been deprecated and will be' +
' removed in later Select2 versions. Use $element.val() instead.'
);
}
if (args.length === 0) {
return this.$element.val();
}

File diff suppressed because one or more lines are too long

25
dist/js/select2.js vendored
View File

@ -4178,7 +4178,32 @@ define('select2/core',[
return this.$container.hasClass('select2-container--open');
};
Select2.prototype.enable = function (args) {
if (console && console.warn) {
console.warn(
'Select2: The `select2("val")` method has been deprecated and will be' +
' removed in later Select2 versions. Use $element.prop("disabled") ' +
'instead.'
);
}
if (args.length === 0) {
args = [true];
}
var disabled = !args[0];
this.$element.prop('disabled', disabled);
};
Select2.prototype.val = function (args) {
if (console && console.warn) {
console.warn(
'Select2: The `select2("val")` method has been deprecated and will be' +
' removed in later Select2 versions. Use $element.val() instead.'
);
}
if (args.length === 0) {
return this.$element.val();
}

File diff suppressed because one or more lines are too long

View File

@ -297,7 +297,32 @@ define([
return this.$container.hasClass('select2-container--open');
};
Select2.prototype.enable = function (args) {
if (console && console.warn) {
console.warn(
'Select2: The `select2("val")` method has been deprecated and will be' +
' removed in later Select2 versions. Use $element.prop("disabled") ' +
'instead.'
);
}
if (args.length === 0) {
args = [true];
}
var disabled = !args[0];
this.$element.prop('disabled', disabled);
};
Select2.prototype.val = function (args) {
if (console && console.warn) {
console.warn(
'Select2: The `select2("val")` method has been deprecated and will be' +
' removed in later Select2 versions. Use $element.val() instead.'
);
}
if (args.length === 0) {
return this.$element.val();
}