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

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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                      1x   922x         1x       1x             1x 7x               1x 9x               1x 1x                 1x 447x     1x   1x   1x   1x         1x 19115x     1x   1x         1x 1x           1x 8x           1x 845x                 1x 19901x         1x  
/*!
 * VisualEditor Null Selection class.
 *
 * @copyright See AUTHORS.txt
 */
 
/**
 * @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 );