<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Am 17.07.2013 um 01:51 schrieb Justin Lebar:</div><blockquote type="cite">Suppose function F contains two functions, f1, and f2, and suppose the<br>set of variables touched by f1 is C1, and the set of variables touched<br>by f2 is C2.  Then so long as either f1 or f2 is alive, all variables<br>in C1 union C2 are kept alive!<br><br></blockquote>[snip]<br><blockquote type="cite"><br>f1 and f2 each keep alive /both/ v1 and v2.  So even after the<br>setTimeout runs, f2 continues to hold alive v2 /and/ v1.<br></blockquote><div><br></div>What does that mean WRT IIFE as a way to encapsulate scripts / libraries? <div>If you use a library (let's say jQuery because it's huge and most sites only </div><div>use a fraction of the functions declared in it), and all functions inside (both </div><div>internal and exported functions) are declared by function expressions (so </div><div>being tied to a variable), and there's a listener for e. g. onDOMReady, the </div><div>whole library leaks? </div><div><br></div><div>Can this be mitigated by using function declarations? How does lazy </div><div>parsing help here? Or are functions not affected at all (instances are, </div><div>obviously, aren't they)? </div><div><br></div><div>Best regards, </div><div><br></div><div>Florian Bender</div><div><div apple-content-edited="true"><div><br></div><span style="font-size: 11px; ">quantumedia · Kalchthaler, Müller & Partner </span><span style="font-size: 11px; ">Media Services GbR</span><br style="font-size: 11px; "><span style="font-size: 11px; ">Münsterplatz 32 · 79098 Freiburg · Tel. 0761 </span><span style="font-size: 11px; ">458 99 28-0 · Fax 0761 458 99 28-9</span><br style="font-size: 11px; "><span style="font-size: 11px; ">USt-IdNr: DE280390014 · Geschäftsführer: </span><span style="font-size: 11px; ">Gregor Kalchthaler, Philipp Müller</span>
</div>
<br><div><div><br></div></div></div></body></html>