All files / src/ce/nodes ve.ce.HorizontalRuleNode.js

100% Statements 10/10
100% Branches 0/0
100% Functions 1/1
100% Lines 10/10

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                                  1x   2x       2x     2x     2x         1x   1x       1x   1x       1x  
/*!
 * VisualEditor ContentEditable HorizontalRuleNode class.
 *
 * @copyright See AUTHORS.txt
 */
 
/**
 * ContentEditable horizontal rule node.
 *
 * @class
 * @extends ve.ce.LeafNode
 * @mixes ve.ce.FocusableNode
 *
 * @constructor
 * @param {ve.dm.HorizontalRuleNode} model Model to observe
 * @param {Object} [config] Configuration options
 */
ve.ce.HorizontalRuleNode = function VeCeHorizontalRuleNode() {
	// Parent constructor
	ve.ce.HorizontalRuleNode.super.apply( this, arguments );
 
	// Wrap the <hr> in a div so the margins become focusable
	// and the user has a click target of more than 2px
	this.$element = $( '<div>' ).append( this.$element );
 
	// Mixin constructors
	ve.ce.FocusableNode.call( this );
 
	// DOM changes
	this.$element.addClass( 've-ce-horizontalRuleNode' );
};
 
/* Inheritance */
 
OO.inheritClass( ve.ce.HorizontalRuleNode, ve.ce.LeafNode );
 
OO.mixinClass( ve.ce.HorizontalRuleNode, ve.ce.FocusableNode );
 
/* Static Properties */
 
ve.ce.HorizontalRuleNode.static.name = 'horizontalRule';
 
ve.ce.HorizontalRuleNode.static.tagName = 'hr';
 
/* Registration */
 
ve.ce.nodeFactory.register( ve.ce.HorizontalRuleNode );