all files / src/dm/selections/ ve.dm.NullSelection.js

100% Statements 29/29
100% Branches 3/3
100% Functions 10/10
100% Lines 29/29
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115                        469×                                                                       415×                   35×                                   752×                 635×          
/*!
 * VisualEditor Null Selection class.
 *
 * @copyright 2011-2019 VisualEditor Team and others; see http://ve.mit-license.org
 */
 
/**
 * @class
 * @extends ve.dm.Selection
 * @constructor
 */
ve.dm.NullSelection = function VeDmNullSelection() {
	// Parent constructor
	ve.dm.NullSelection.super.call( this );
};
 
/* Inheritance */
 
OO.inheritClass( ve.dm.NullSelection, ve.dm.Selection );
 
/* Static Properties */
 
ve.dm.NullSelection.static.name = 'null';
 
/* Static Methods */
 
/**
 * @inheritdoc
 */
ve.dm.NullSelection.static.newFromHash = function () {
	return new ve.dm.NullSelection();
};
 
/* Methods */
 
/**
 * @inheritdoc
 */
ve.dm.NullSelection.prototype.toJSON = function () {
	return {
		type: this.constructor.static.name
	};
};
 
/**
 * @inheritdoc
 */
ve.dm.NullSelection.prototype.getDescription = function () {
	return 'Null';
};
 
/**
 * Used as a shortcut for methods which make no modification
 *
 * @private
 * @return {ve.dm.NullSelection} The selection itself
 */
ve.dm.NullSelection.prototype.self = function () {
	return this;
};
 
ve.dm.NullSelection.prototype.collapseToStart = ve.dm.NullSelection.prototype.self;
 
ve.dm.NullSelection.prototype.collapseToEnd = ve.dm.NullSelection.prototype.self;
 
ve.dm.NullSelection.prototype.collapseToFrom = ve.dm.NullSelection.prototype.self;
 
ve.dm.NullSelection.prototype.collapseToTo = ve.dm.NullSelection.prototype.self;
 
/**
 * @inheritdoc
 */
ve.dm.NullSelection.prototype.isCollapsed = function () {
	return true;
};
 
ve.dm.NullSelection.prototype.translateByTransaction = ve.dm.NullSelection.prototype.self;
 
ve.dm.NullSelection.prototype.translateByTransactionWithAuthor = ve.dm.NullSelection.prototype.self;
 
/**
 * @inheritdoc
 */
ve.dm.NullSelection.prototype.getRanges = function () {
	return [];
};
 
/**
 * @inheritdoc
 */
ve.dm.NullSelection.prototype.getCoveringRange = function () {
	return null;
};
 
/**
 * @inheritdoc
 */
ve.dm.NullSelection.prototype.equals = function ( other ) {
	return this === other || (
		!!other &&
		other.constructor === this.constructor
	);
};
 
/**
 * @inheritdoc
 */
ve.dm.NullSelection.prototype.isNull = function () {
	return true;
};
 
/* Registration */
 
ve.dm.selectionFactory.register( ve.dm.NullSelection );