2013-04-03 18:21:10 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor DataModel GeneratedContentNode class.
|
|
|
|
*
|
|
|
|
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
|
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* DataModel generated content node.
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @abstract
|
|
|
|
* @constructor
|
|
|
|
* @param {number} [length] Length of content data in document; ignored and overridden to 0
|
|
|
|
* @param {Object} [element] Reference to element in linear model
|
|
|
|
*/
|
2013-05-29 01:35:42 +00:00
|
|
|
ve.dm.GeneratedContentNode = function VeDmGeneratedContentNode() {
|
2013-04-03 18:21:10 +00:00
|
|
|
};
|
|
|
|
|
2013-06-24 16:27:35 +00:00
|
|
|
/* Static methods */
|
2013-04-03 18:21:10 +00:00
|
|
|
|
2013-05-29 01:35:42 +00:00
|
|
|
ve.dm.GeneratedContentNode.static = {};
|
2013-04-03 18:21:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Store HTML of DOM elements, hashed on data element
|
2013-10-23 20:08:47 +00:00
|
|
|
* @static
|
2013-04-03 18:21:10 +00:00
|
|
|
* @param {Object} dataElement Data element
|
2013-10-15 17:37:03 +00:00
|
|
|
* @param {Object|string|Array} generatedContents Generated contents
|
2013-04-03 18:21:10 +00:00
|
|
|
* @param {ve.dm.IndexValueStore} store Index-value store
|
|
|
|
* @returns {number} Index of stored data
|
|
|
|
*/
|
2013-10-15 17:37:03 +00:00
|
|
|
ve.dm.GeneratedContentNode.static.storeGeneratedContents = function ( dataElement, generatedContents, store ) {
|
2013-10-15 19:59:14 +00:00
|
|
|
var hash = OO.getHash( [ this.getHashObject( dataElement ), undefined ] );
|
2013-10-15 17:37:03 +00:00
|
|
|
return store.index( generatedContents, hash );
|
2013-10-15 19:59:14 +00:00
|
|
|
};
|