var elements = require('../elements');
var Element = require('../element');

/* no args, return Elt */

/**
 * @param {String} methodName
 * @param {Function} fn
 */
elements.addElementMethodWithoutArgumentsReturnElement = function(methodName, fn) {
    Element.prototype[methodName] = fn ? function() {
        var result = fn(this[0]);
        return result && elements(result);
    } : function() {

        var result = elements[methodName](this[0]);
        return result && elements(result);
    };

    Element.prototype[methodName].displayName = methodName;
};
