diff --git a/src/js/select2/data/select.js b/src/js/select2/data/select.js
index 6865a47d..b36b9760 100644
--- a/src/js/select2/data/select.js
+++ b/src/js/select2/data/select.js
@@ -244,7 +244,7 @@ define([
};
SelectAdapter.prototype._normalizeItem = function (item) {
- if (!$.isPlainObject(item)) {
+ if(item !== Object(item)){
item = {
id: item,
text: item
diff --git a/tests/data/array-tests.js b/tests/data/array-tests.js
index 65a6e32c..cbea97c5 100644
--- a/tests/data/array-tests.js
+++ b/tests/data/array-tests.js
@@ -4,6 +4,15 @@ var ArrayData = require('select2/data/array');
var $ = require('jquery');
var Options = require('select2/options');
+var UserDefinedType = function( id, text ){
+ var self=this;
+
+ self.id=id;
+ self.text=text;
+
+ return self;
+};
+
var arrayOptions = new Options({
data: [
{
@@ -17,7 +26,8 @@ var arrayOptions = new Options({
{
id: '2',
text: '2'
- }
+ },
+ new UserDefinedType(1, 'aaaaaa')
]
});
@@ -216,7 +226,7 @@ test('option tags are automatically generated', function (assert) {
assert.equal(
$select.find('option').length,
- 3,
+ 4,
'An
+
+