Code coverage report for lib/elements.js

Statements: 100% (25 / 25)      Branches: 100% (6 / 6)      Functions: 100% (2 / 2)      Lines: 100% (25 / 25)      Ignored: none     

All files » lib/ » elements.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66          1     1     1   4     1                 1   1   1                 1     4 4 4 3     1   1   1 1 1     1 1     1 1 1 1 1  
/**
 * @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