diff --git a/lib/static.js b/lib/static.js index 1e525a0712..858e39abc9 100644 --- a/lib/static.js +++ b/lib/static.js @@ -28,7 +28,7 @@ exports.load = function(content, options) { initialize.prototype = Cheerio.prototype; // Add in the static methods - initialize.__proto__ = exports; + _.merge(initialize, exports); // Add in the root initialize._root = root; diff --git a/test/cheerio.js b/test/cheerio.js index 46944ea68d..954d54a453 100644 --- a/test/cheerio.js +++ b/test/cheerio.js @@ -284,5 +284,11 @@ describe('cheerio', function() { expect(domEncoded('footer').html()).to.be(expectedXml); }); + it('should return a fully-qualified Function', function() { + var $c = $.load('