From: Walden H. Leverich
Wrap our head around lexical closures yet?

To be candid, I had to get out the JavaScript manual and read up on "lexical closures". I wasn't familiar with the term. And even after reading, I didn't fully understand it. But there appear to be some similarities between the examples in the book and my code.

In the case of the component I was writing to build DOM tables dynamically:

var tb = new Table('tb');

creates a new instance of a Table object. And Table is a actually a Function object which contains other functions (or methods, if you prefer). And I use code like the following to dynamically add rows to the table:

tb.insertRowBottom(r);

And the fact that the DOM GC and JavaScript GC are
different GCs a circular reference from dom to JS
to dom can't be cleaned up. :)

Yeah, sounds messy. I'd like to steer clear of circular references.

Nathan.



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.