mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 18:39:52 +00:00
Optimize getAnnotationsFromOffset with ve.getObjectValues
Change-Id: I2150335b6f0fa305c1d1bc93e50d30d874c76345
This commit is contained in:
parent
f40e4f2f9d
commit
17b58db5c6
|
@ -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 [];
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue