Skip to content

Commit 48bbb43

Browse files
committed
Never clone Group objects
1 parent 2fa3b2f commit 48bbb43

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/Group.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ $.extend( SELF.prototype, {
8181
* @return {*}
8282
*/
8383
getItemContainer: function() {
84-
// Do not allow altering the encapsulated container.
85-
return new this._GroupableCollectionConstructor( this._groupableCollection.toArray() );
84+
return this._groupableCollection;
8685
},
8786

8887
/**
@@ -101,10 +100,7 @@ $.extend( SELF.prototype, {
101100
}
102101
}
103102

104-
// Clone the container to prevent manipulation of the items using the original container.
105-
this._groupableCollection = new this._GroupableCollectionConstructor(
106-
groupableCollection.toArray()
107-
);
103+
this._groupableCollection = groupableCollection;
108104
},
109105

110106
/**

tests/Group.tests.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ QUnit.test( 'setItemContainer() & getItemContainer()', function( assert ) {
177177
newContainer = getTestContainer( 'key', 3 );
178178

179179
assert.ok(
180-
group.getItemContainer() !== container,
181-
'Not returning original container.'
180+
group.getItemContainer() === container,
181+
'Returning original container.'
182182
);
183183

184184
assert.ok(

0 commit comments

Comments
 (0)