2012-07-19 00:11:26 +00:00
|
|
|
/**
|
|
|
|
* VisualEditor data model TableRowNode class.
|
2012-07-19 21:25:16 +00:00
|
|
|
*
|
2012-07-19 00:11:26 +00:00
|
|
|
* @copyright 2011-2012 VisualEditor Team and others; see AUTHORS.txt
|
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
2012-02-06 23:50:56 +00:00
|
|
|
/**
|
2012-06-20 01:20:28 +00:00
|
|
|
* DataModel node for a table row.
|
|
|
|
*
|
2012-02-06 23:50:56 +00:00
|
|
|
* @class
|
|
|
|
* @constructor
|
|
|
|
* @extends {ve.dm.BranchNode}
|
2012-06-20 01:20:28 +00:00
|
|
|
* @param {ve.dm.BranchNode[]} [children] Child nodes to attach
|
|
|
|
* @param {Object} [attributes] Reference to map of attribute key/value pairs
|
2012-02-06 23:50:56 +00:00
|
|
|
*/
|
2012-08-07 01:50:44 +00:00
|
|
|
ve.dm.TableRowNode = function ( children, attributes ) {
|
2012-02-06 23:50:56 +00:00
|
|
|
// Inheritance
|
2012-06-20 01:20:28 +00:00
|
|
|
ve.dm.BranchNode.call( this, 'tableRow', children, attributes );
|
2012-02-06 23:50:56 +00:00
|
|
|
};
|
|
|
|
|
2012-06-20 01:20:28 +00:00
|
|
|
/* Static Members */
|
2012-02-06 23:50:56 +00:00
|
|
|
|
|
|
|
/**
|
2012-06-20 01:20:28 +00:00
|
|
|
* Node rules.
|
|
|
|
*
|
|
|
|
* @see ve.dm.NodeFactory
|
|
|
|
* @static
|
|
|
|
* @member
|
2012-02-06 23:50:56 +00:00
|
|
|
*/
|
2012-06-20 01:20:28 +00:00
|
|
|
ve.dm.TableRowNode.rules = {
|
|
|
|
'isWrapped': true,
|
|
|
|
'isContent': false,
|
|
|
|
'canContainContent': false,
|
|
|
|
'childNodeTypes': ['tableCell'],
|
|
|
|
'parentNodeTypes': ['tableSection']
|
2012-02-06 23:50:56 +00:00
|
|
|
};
|
|
|
|
|
2012-06-20 01:20:28 +00:00
|
|
|
/**
|
|
|
|
* Node converters.
|
|
|
|
*
|
|
|
|
* @see {ve.dm.Converter}
|
|
|
|
* @static
|
|
|
|
* @member
|
|
|
|
*/
|
|
|
|
ve.dm.TableRowNode.converters = {
|
|
|
|
'domElementTypes': ['tr'],
|
2012-08-07 01:50:44 +00:00
|
|
|
'toDomElement': function ( type, element ) {
|
2012-06-20 01:20:28 +00:00
|
|
|
return document.createElement( 'tr' );
|
|
|
|
},
|
2012-08-07 01:50:44 +00:00
|
|
|
'toDataElement': function ( tag, element ) {
|
2012-06-20 01:20:28 +00:00
|
|
|
return { 'type': 'tableRow' };
|
|
|
|
}
|
|
|
|
};
|
2012-02-06 23:50:56 +00:00
|
|
|
|
2012-06-20 01:20:28 +00:00
|
|
|
/* Registration */
|
2012-02-06 23:50:56 +00:00
|
|
|
|
2012-06-20 01:20:28 +00:00
|
|
|
ve.dm.nodeFactory.register( 'tableRow', ve.dm.TableRowNode );
|
2012-02-06 23:50:56 +00:00
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
|
|
|
ve.extendClass( ve.dm.TableRowNode, ve.dm.BranchNode );
|