2012-04-19 21:17:59 +00:00
|
|
|
/**
|
2012-04-30 23:58:41 +00:00
|
|
|
* DataModel namespace.
|
2012-05-14 22:05:09 +00:00
|
|
|
*
|
2012-04-19 21:17:59 +00:00
|
|
|
* All classes and functions will be attached to this object to keep the global namespace clean.
|
|
|
|
*/
|
2012-04-20 23:34:47 +00:00
|
|
|
ve.dm = {
|
2012-05-31 22:20:58 +00:00
|
|
|
//'nodeFactory': Initialized in ve.dm.NodeFactory.js
|
2012-05-31 23:50:16 +00:00
|
|
|
//'converter': Initialized in ve.dm.Converter.js
|
|
|
|
};
|
|
|
|
|
2012-06-07 00:47:27 +00:00
|
|
|
ve.dm.createDomElement = function( type, attributes, doc ) {
|
2012-05-31 23:50:16 +00:00
|
|
|
if ( doc === undefined ) {
|
|
|
|
doc = document;
|
|
|
|
}
|
|
|
|
var element = doc.createElement( type );
|
|
|
|
for ( var key in attributes ) {
|
|
|
|
element.setAttribute( key, attributes[key] );
|
|
|
|
}
|
|
|
|
return element;
|
2012-04-20 23:34:47 +00:00
|
|
|
};
|
2012-06-07 00:47:27 +00:00
|
|
|
|
|
|
|
ve.dm.getObjectFromDomElementAttributes = function( domAttributes ) {
|
|
|
|
var attributes = {};
|
|
|
|
for ( var i = 0; i < domAttributes.length; i++ ) {
|
|
|
|
attributes[domAttributes[i].name] = domAttributes[i].value;
|
|
|
|
}
|
|
|
|
return attributes;
|
|
|
|
};
|