Optimize getAnnotationsFromOffset with ve.getObjectValues

Change-Id: I2150335b6f0fa305c1d1bc93e50d30d874c76345
This commit is contained in:
Rob Moen 2012-05-14 11:34:08 -07:00
parent f40e4f2f9d
commit 17b58db5c6

View file

@ -192,16 +192,8 @@ ve.dm.DocumentFragment.prototype.getDataFromNode = function( node ) {
* @returns {Object[]} A copy of all annotation objects offset is covered by
*/
ve.dm.DocumentFragment.prototype.getAnnotationsFromOffset = function( offset ) {
var annotations = [],
aObj = {},
a = {};
if ( ve.isArray( this.data[offset] ) ) {
aObj = this.data[offset][1];
for (a in aObj) {
annotations.push( aObj[a] );
}
return annotations;
return ve.getObjectValues( this.data[offset][1] );
}
return [];
};