mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-30 00:55:00 +00:00
c68765639a
Because we have a node for <table>, we also need one for <caption>, otherwise we'll try to alienate it and fail. Added the test case as a separate example document so Ed can use it for his tests. Removed test case asserting <caption> is alienated. Change-Id: I3a917db58e6c0eb97899b214b07d01fc8d86b56d
45 lines
1.1 KiB
JavaScript
45 lines
1.1 KiB
JavaScript
/*!
|
|
* VisualEditor DataModel TableCaptionNode class.
|
|
*
|
|
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* DataModel table caption node.
|
|
*
|
|
* @class
|
|
* @extends ve.dm.BranchNode
|
|
* @constructor
|
|
* @param {ve.dm.BranchNode[]} [children] Child nodes to attach
|
|
* @param {Object} [element] Reference to element in linear model
|
|
*/
|
|
ve.dm.TableCaptionNode = function VeDmTableCaptionNode( children, element ) {
|
|
// Parent constructor
|
|
ve.dm.BranchNode.call( this, children, element );
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
ve.inheritClass( ve.dm.TableCaptionNode, ve.dm.BranchNode );
|
|
|
|
/* Static Properties */
|
|
|
|
ve.dm.TableCaptionNode.static.name = 'tableCaption';
|
|
|
|
ve.dm.TableCaptionNode.static.parentNodeTypes = [ 'table' ];
|
|
|
|
ve.dm.TableCaptionNode.static.matchTagNames = [ 'caption' ];
|
|
|
|
ve.dm.TableCaptionNode.static.toDataElement = function () {
|
|
return { 'type': 'tableCaption' };
|
|
};
|
|
|
|
ve.dm.TableCaptionNode.static.toDomElements = function ( dataElement, doc ) {
|
|
return [ doc.createElement( 'caption' ) ];
|
|
};
|
|
|
|
/* Registration */
|
|
|
|
ve.dm.modelRegistry.register( ve.dm.TableCaptionNode );
|