4 ms·
Please give me an 80 kloc project full of this kind of smartness, preferably minefied.
by dep_b 6y ago
Please give me an 80 kloc project full of this kind of smartness, preferably minefied.
- forgotmypw17 6y ago.
- thrownaway954 6y agolook at jQuery... if you have never read the source for it, as a developer, you are doing yourself an injustice. not only has john resig worked on it, but also yehuda katz, so there are some really smart people who coded it to learn from.
- MatmaRex 6y agoIn my opinion, having read parts of jQuery's source code on various occasions… You should only read it for entertainment value, it makes for fascinating brain teasers. Here's one snippet I had the opportunity to read recently: contains = hasCompare || rnative.test( docElem.contains ) ? function( a, b ) { var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode; return a === bup || !!( bup && bup.nodeType === 1 && ( adown.contains ? adown.contains( bup ) : a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 )); } : function( a, b ) { if ( b ) { while ( (b = b.parentNode) ) { if ( b === a ) { return true; } } } return false; };
- thrownaway954 6y agoi have no doubts. i haven't read through the source in years, but i'm sure there are tons of wtfs in there. those dudes had to do some pretty effed up stuff in order to make it work, and keep working, with the slew of browsers and incompatibilities back then.