diff --git a/build.js b/build.js index 458a82fd9..b66559f63 100755 --- a/build.js +++ b/build.js @@ -1176,7 +1176,7 @@ // remove `support.nodeClass` from `shimIsPlainObject` source = source.replace(matchFunction(source, 'shimIsPlainObject'), function(match) { - return match.replace(/ *&& *\(support\.nodeClass[\s\S]+?\)\)/, ''); + return match.replace(/\(support\.nodeClass[\s\S]+?\)\)/, 'true'); }); // remove `support.nodeClass` from `_.clone` diff --git a/dist/lodash.js b/dist/lodash.js index 707ace4ac..c23f95e48 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -545,7 +545,7 @@ // check that the constructor is `Object` (i.e. `Object instanceof Object`) var ctor = value.constructor; - if (isFunction(ctor) ? ctor instanceof ctor : (support.nodeClass || !isNode(value))) { + if (isFunction(ctor) ? ctor instanceof ctor : true) { // In most environments an object's own properties are iterated before // its inherited properties. If the last iterated property is an object's // own property then there are no inherited enumerable properties. diff --git a/dist/lodash.min.js b/dist/lodash.min.js index c931c15bc..727945e9a 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -7,38 +7,38 @@ ;(function(n){function t(o){function f(n){if(!n||re.call(n)!=S)return a;var t=n.valueOf,e=typeof t=="function"&&(e=Yt(t))&&Yt(e);return e?n==e||Yt(n)==e:X(n)}function q(n,t,e){if(!n||!F[typeof n])return n;t=t&&typeof e=="undefined"?t:M.createCallback(t,e);for(var r=-1,u=F[typeof n]?me(n):[],o=u.length;++r=s;if(e)for(var r={},u=-1;++ut||typeof n=="undefined")return 1;if(ne?0:e);++re?ce(0,u+e):e)||0,typeof u=="number"?o=-1<(it(n)?n.indexOf(t,e):jt(n,t,e)):q(n,function(n){return++ru&&(u=o)}}else t=!t&&it(n)?V:M.createCallback(t,e),gt(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function mt(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Ft(r);++earguments.length;t=M.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++oarguments.length;if(typeof u!="number")var i=me(n),u=i.length;return t=M.createCallback(t,r,4),gt(n,function(r,f,c){f=i?i[--u]:--u,e=o?(o=a,n[f]):t(e,n[f],f,c)}),e}function _t(n,t,e){var r;t=M.createCallback(t,e),e=-1;var u=n?n.length:0; -if(typeof u=="number")for(;++ee?ce(0,u+e):e||0)-1;else if(e)return r=Ot(n,t),n[r]===t?r:-1;for(;++r>>1,e(n[r])=s;if(l)var v={};for(e!=u&&(c=[],e=M.createCallback(e,r));++ojt(c,g))&&((e||l)&&c.push(g),f.push(r))}return f}function Et(n,t){for(var e=-1,r=n?n.length:0,u={};++e/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:d,variable:"",imports:{_:M}},Q.prototype=M.prototype;var he=ae,me=fe?function(n){return at(n)?fe(n):[]}:K,be={"&":"&","<":"<",">":">",'"':""","'":"'"},de=et(be);return Dt&&i&&typeof te=="function"&&(St=It(te,o)),Rt=8==pe("08")?pe:function(n,t){return pe(it(n)?n.replace(_,""):n,t||0)},M.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0 -}},M.assign=P,M.at=function(n){for(var t=-1,e=Wt.apply(Vt,ve.call(arguments,1)),r=e.length,u=Ft(r);++tt||typeof n=="undefined")return 1;if(ne?0:e);++re?ce(0,u+e):e)||0,typeof u=="number"?o=-1<(it(n)?n.indexOf(t,e):Ct(n,t,e)):q(n,function(n){return++ru&&(u=o) +}}else t=!t&&it(n)?V:M.createCallback(t,e),gt(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function mt(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Ft(r);++earguments.length;t=M.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++oarguments.length; +if(typeof u!="number")var i=me(n),u=i.length;return t=M.createCallback(t,r,4),gt(n,function(r,f,c){f=i?i[--u]:--u,e=o?(o=a,n[f]):t(e,n[f],f,c)}),e}function _t(n,t,e){var r;t=M.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++ee?ce(0,u+e):e||0)-1;else if(e)return r=Ot(n,t),n[r]===t?r:-1;for(;++r>>1,e(n[r])=s;if(l)var v={};for(e!=u&&(c=[],e=M.createCallback(e,r));++oCt(c,g))&&((e||l)&&c.push(g),f.push(r))}return f}function It(n,t){for(var e=-1,r=n?n.length:0,u={};++e/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:d,variable:"",imports:{_:M}},Q.prototype=M.prototype;var he=ae,me=fe?function(n){return at(n)?fe(n):[]}:K,be={"&":"&","<":"<",">":">",'"':""","'":"'"},de=et(be);return Dt&&i&&typeof te=="function"&&(St=Nt(te,o)),Rt=8==pe("08")?pe:function(n,t){return pe(it(n)?n.replace(_,""):n,t||0)},M.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0 +}},M.assign=P,M.at=function(n){for(var t=-1,e=Wt.apply(Vt,ve.call(arguments,1)),r=e.length,u=Ft(r);++t=s,i=[],f=i;n:for(;++ujt(f,c)){o&&f.push(c); +}:function(e,r,u){return n.call(t,e,r,u)}:n},M.debounce=function(n,t,e){function o(){f=p=u,s&&(c=n.apply(l,i))}var i,f,c,l,p,s=r;if(e===r)var v=r,s=a;else e&&F[typeof e]&&(v=e.leading,s="trailing"in e?e.trailing:s);return function(){return i=arguments,l=this,Qt(p),!f&&v?(f=r,c=n.apply(l,i)):p=ee(o,t),c}},M.defaults=z,M.defer=St,M.delay=function(n,t){var r=ve.call(arguments,2);return ee(function(){n.apply(e,r)},t)},M.difference=kt,M.filter=st,M.flatten=jt,M.forEach=gt,M.forIn=D,M.forOwn=q,M.functions=tt,M.groupBy=function(n,t,e){var r={}; +return t=M.createCallback(t,e),gt(n,function(n,e,u){e=Mt(t(n,e,u)),(Zt.call(r,e)?r[e]:r[e]=[]).push(n)}),r},M.initial=function(n,t,e){if(!n)return[];var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=M.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=t==u||e?1:t||r;return Y(n,0,le(ce(0,a-r),a))},M.intersection=function(n){var t=arguments,e=t.length,r={0:{}},u=-1,a=n?n.length:0,o=a>=s,i=[],f=i;n:for(;++uCt(f,c)){o&&f.push(c); for(var v=e;--v;)if(!(r[v]||(r[v]=U(t[v])))(c))continue n;i.push(c)}}return i},M.invert=et,M.invoke=function(n,t){var e=ve.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Ft(typeof a=="number"?a:0);return gt(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},M.keys=me,M.map=yt,M.max=ht,M.memoize=function(n,t){var e={};return function(){var r=p+(t?t.apply(this,arguments):arguments[0]);return Zt.call(e,r)?e[r]:e[r]=n.apply(this,arguments)}},M.merge=ft,M.min=function(n,t,e){var r=1/0,u=r; -if(!t&&he(n)){e=-1;for(var a=n.length;++ejt(a,e))&&(u[e]=n)}),u},M.once=function(n){var t,e;return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e)}},M.pairs=function(n){for(var t=-1,e=me(n),r=e.length,u=Ft(r);++tCt(a,e))&&(u[e]=n)}),u},M.once=function(n){var t,e;return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e)}},M.pairs=function(n){for(var t=-1,e=me(n),r=e.length,u=Ft(r);++te?ce(0,r+e):le(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},M.mixin=$t,M.noConflict=function(){return o._=Ht,this},M.parseInt=Rt,M.random=function(n,t){return n==u&&t==u&&(t=1),n=+n||0,t==u&&(t=n,n=0),n+Xt(se()*((+t||0)-n+1))},M.reduce=bt,M.reduceRight=dt,M.result=function(n,t){var r=n?n[t]:e;return ut(r)?n[t]():r},M.runInContext=t,M.size=function(n){var t=n?n.length:0; -return typeof t=="number"?t:me(n).length},M.some=_t,M.sortedIndex=Ot,M.template=function(n,t,u){var a=M.templateSettings;n||(n=""),u=z({},u,a);var o,i=z({},u.imports,a.imports),a=me(i),i=ct(i),f=0,c=u.interpolate||k,l="__p+='",c=Kt((u.escape||k).source+"|"+c.source+"|"+(c===d?m:k).source+"|"+(u.evaluate||k).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(C,J),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t +return typeof t=="number"?t:me(n).length},M.some=_t,M.sortedIndex=Ot,M.template=function(n,t,u){var a=M.templateSettings;n||(n=""),u=z({},u,a);var o,i=z({},u.imports,a.imports),a=me(i),i=ct(i),f=0,c=u.interpolate||k,l="__p+='",c=Kt((u.escape||k).source+"|"+c.source+"|"+(c===d?m:k).source+"|"+(u.evaluate||k).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(j,J),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t }),l+="';\n",c=u=u.variable,c||(u="obj",l="with("+u+"){"+l+"}"),l=(o?l.replace(v,""):l).replace(g,"$1").replace(y,"$1;"),l="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var p=qt(a,"return "+l).apply(e,i)}catch(s){throw s.source=l,s}return t?p(t):(p.source=l,p)},M.unescape=function(n){return n==u?"":Mt(n).replace(h,Z)},M.uniqueId=function(n){var t=++c;return Mt(n==u?"":n)+t },M.all=pt,M.any=_t,M.detect=vt,M.foldl=bt,M.foldr=dt,M.include=lt,M.inject=bt,q(M,function(n,t){M.prototype[t]||(M.prototype[t]=function(){var t=[this.__wrapped__];return ne.apply(t,arguments),n.apply(M,t)})}),M.first=wt,M.last=function(n,t,e){if(n){var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=M.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,r==u||e)return n[a-1];return Y(n,ce(0,a-r))}},M.take=wt,M.head=wt,q(M,function(n,t){M.prototype[t]||(M.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e); return t==u||e&&typeof t!="function"?r:new Q(r)})}),M.VERSION="1.2.0",M.prototype.toString=function(){return Mt(this.__wrapped__)},M.prototype.value=Bt,M.prototype.valueOf=Bt,gt(["join","pop","shift"],function(n){var t=Vt[n];M.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),gt(["push","reverse","sort","unshift"],function(n){var t=Vt[n];M.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),gt(["concat","slice","splice"],function(n){var t=Vt[n];M.prototype[n]=function(){return new Q(t.apply(this.__wrapped__,arguments)) -}}),M}var e,r=!0,u=null,a=!1,o=typeof exports=="object"&&exports,i=typeof module=="object"&&module&&module.exports==o&&module,f=typeof global=="object"&&global;(f.global===f||f.window===f)&&(n=f);var c=0,l={},p=+new Date+"",s=200,v=/\b__p\+='';/g,g=/\b(__p\+=)''\+/g,y=/(__e\(.*?\)|\b__t\))\+'';/g,h=/&(?:amp|lt|gt|quot|#39);/g,m=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,b=/\w*$/,d=/<%=([\s\S]+?)%>/g,_=/^0+(?=.$)/,k=/($^)/,w=/[&<>"']/g,C=/['\n\r\t\u2028\u2029\\]/g,j="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),x="[object Arguments]",O="[object Array]",N="[object Boolean]",E="[object Date]",I="[object Number]",S="[object Object]",A="[object RegExp]",$="[object String]",B={"[object Function]":a}; -B[x]=B[O]=B[N]=B[E]=B[I]=B[S]=B[A]=B[$]=r;var F={"boolean":a,"function":r,object:r,number:a,string:a,undefined:a},R={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"},T=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=T,define(function(){return T})):o&&!o.nodeType?i?(i.exports=T)._=T:o._=T:n._=T})(this); \ No newline at end of file +}}),M}var e,r=!0,u=null,a=!1,o=typeof exports=="object"&&exports,i=typeof module=="object"&&module&&module.exports==o&&module,f=typeof global=="object"&&global;(f.global===f||f.window===f)&&(n=f);var c=0,l={},p=+new Date+"",s=200,v=/\b__p\+='';/g,g=/\b(__p\+=)''\+/g,y=/(__e\(.*?\)|\b__t\))\+'';/g,h=/&(?:amp|lt|gt|quot|#39);/g,m=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,b=/\w*$/,d=/<%=([\s\S]+?)%>/g,_=/^0+(?=.$)/,k=/($^)/,w=/[&<>"']/g,j=/['\n\r\t\u2028\u2029\\]/g,C="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),x="[object Arguments]",O="[object Array]",E="[object Boolean]",I="[object Date]",N="[object Number]",S="[object Object]",A="[object RegExp]",$="[object String]",B={"[object Function]":a}; +B[x]=B[O]=B[E]=B[I]=B[N]=B[S]=B[A]=B[$]=r;var F={"boolean":a,"function":r,object:r,number:a,string:a,undefined:a},R={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"},T=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=T,define(function(){return T})):o&&!o.nodeType?i?(i.exports=T)._=T:o._=T:n._=T})(this); \ No newline at end of file diff --git a/test/test.js b/test/test.js index 683923a98..9f1fe16d4 100644 --- a/test/test.js +++ b/test/test.js @@ -1,17 +1,28 @@ ;(function(window, undefined) { 'use strict'; + /** Method and object shortcuts */ + var document = window.document, + amd = window.define && define.amd, + body = document && document.body, + create = Object.create, + freeze = Object.freeze, + phantom = window.phantom, + process = window.process, + slice = Array.prototype.slice, + system = window.system; + /** Use a single "load" function */ var load = typeof require == 'function' ? require : window.load; /** The file path of the Lo-Dash file to test */ var filePath = (function() { var min = 0; - var result = window.phantom + var result = phantom ? phantom.args - : (window.system + : (system ? (min = 1, system.args) - : (window.process ? (min = 2, process.argv) : (window.arguments || [])) + : (process ? (min = 2, process.argv) : (window.arguments || [])) ); var last = result[result.length - 1]; @@ -60,9 +71,6 @@ undefined ]; - /** Shortcut used to make object properties immutable */ - var freeze = Object.freeze; - /** Used to set property descriptors */ var setDescriptor = (function() { try { @@ -73,9 +81,6 @@ return result; }()); - /** Shortcut used to convert array-like objects to arrays */ - var slice = Array.prototype.slice; - /** Used to check problem JScript properties (a.k.a. the [[DontEnum]] bug) */ var shadowedProps = [ 'constructor', @@ -109,14 +114,13 @@ // add object from iframe (function() { - if (!window.document || window.phantom) { + if (!document || phantom) { return; } - var body = document.body, - iframe = document.createElement('iframe'); - + var iframe = document.createElement('iframe'); iframe.frameBorder = iframe.height = iframe.width = 0; body.appendChild(iframe); + var idoc = (idoc = iframe.contentDocument || iframe.contentWindow).document || idoc; idoc.write("