Results 1 to 2 of 2

Thread: can someone help me on these questions?

  1. #1
    Join Date
    Jun 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default can someone help me on these questions?

    How is garbage collection handled in Javascript?

    What are the ways you can deal with x-browser issues? What are the pros and cons of each?


    Thank you,
    Gary

  2. #2
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by garylee
    How is garbage collection handled in Javascript?
    It is automatic. When all references to an object are severed (by assigning null to referring variables, for example), the object is marked for collection. Reclaimation may not be prompt, though.

    There are known memory leaks. MSIE has a well-known, and well-documented, COM-related leak that occurs when a circular reference involves a COM object (ActiveX objects and DOM nodes). Other browsers will no doubt have their own leaks, but IE's is typically more serious as it's easy to induce.

    What are the ways you can deal with x-browser issues? What are the pros and cons of each?
    That's a vague and open-ended question. Most cross-browser issues revolve around the host's object model, especially the document object model (DOM). Sticking to the interfaces defined by the W3C can help mitigate against some problems, but it's almost always necessary to write code explicitly for IE. In such cases, though, use feature detection, not browser detection to determine the code path.

    Feature detection is a (roughly) one-to-one examination of the objects and methods provided by the host. Very few (if any) assumptions should be made from the implementation of one feature towards another. Certainly, any time you see something like

    Code:
    if (document.getElementById) {
    and then notice subsequent code using all manner of other W3C DOM-defined methods, you've found an example of how not to feature detect.

    Mike

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •