/**
* @namespace
*/
'use strict';
var elements = {};
// trick jsdoc
var Element = require('./element');
// var ElementsArray = require('./elements_array');
elements = /** @function
* @param element */function (element) {
return element.$elt || new Element(element);
};
module.exports = elements;
/**
* Create an element wrapper (or return the existing one)
*
* @method
* @param {HTMLElement} element
* @return {Element}
*/
elements.wrap = elements;
elements.prototypes = {};
var _regexpSingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/;
/**
* Parse a html string
*
* @param {String} string
* @param {Document} context
* @return {HTMLElement} html fragment
*/
elements.parse = /** @function
* @param string
* @param context */function (string, context) {
context = context || document;
var parsed = _regexpSingleTag.exec(string);
if (parsed) {
return context.createElement(parsed[1]);
}
var node,
fragment = context.createDocumentFragment();
var tmp = fragment.appendChild(context.createElement('div'));
tmp.innerHTML = string;
while (node = tmp.firstChild) {
fragment.appendChild(node);
}
fragment.removeChild(tmp);
return fragment;
};
require('./elements/dom');
require('./elements/animations');
require('./elements/dom_traversing');
require('./elements/dom_manipulation');
require('./elements/visibility');
//# sourceMappingURL=elements.js.map |