mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-01 09:26:37 +00:00
26 lines
671 B
JavaScript
26 lines
671 B
JavaScript
|
/**
|
||
|
* VisualEditor AnnotationSet class.
|
||
|
*
|
||
|
* @copyright 2011-2012 VisualEditor Team and others; see AUTHORS.txt
|
||
|
* @license The MIT License (MIT); see LICENSE.txt
|
||
|
*/
|
||
|
|
||
|
ve.AnnotationSet = function ( annotations ) {
|
||
|
// Inheritance
|
||
|
ve.OrderedHashSet.call( this, ve.getHash, annotations );
|
||
|
};
|
||
|
|
||
|
ve.AnnotationSet.prototype.clone = function () {
|
||
|
return new ve.AnnotationSet( this );
|
||
|
};
|
||
|
|
||
|
ve.AnnotationSet.prototype.getAnnotationsOfType = function ( type ) {
|
||
|
return this.filter( 'type', type );
|
||
|
};
|
||
|
|
||
|
ve.AnnotationSet.prototype.hasAnnotationOfType = function ( type ) {
|
||
|
return this.containsMatching( 'type', type );
|
||
|
};
|
||
|
|
||
|
ve.extendClass( ve.AnnotationSet, ve.OrderedHashSet );
|