Google Suggest, advanced JS, DHTML

Discussion in 'Javascript' started by awebguynow, May 26, 2006.

  1. awebguynow

    awebguynow Guest

    It seems like I've been reading the code to Google Suggest (GS) for
    about a week, and I'm going to have to wrap it up shortly.

    I'm OK with many of the subjects, and I would say I have intermediate
    knowledge of JS.
    I've read from many sources/blogs/sites: C Justus (dissected),
    alacrity, AjaxAC, etc.

    After reading the code, here's a few parts, I didn't follow:
    s.<div> contains Iframe, but why does s.style.left="-10000" ? does it
    get moved afterwards?

    setTimeout() used in multiple places, and even recalculateTimeout() //
    not sure why

    lots of blur() focus() processing and fireEvent() event processing

    Although its brilliant, its as difficult to follow as spaghetti code,
    keeping track of which variables are global, local, etc.
    I understand the keystroke processing and createTextRange code.
    I'm sure you have to designate priority between mouse and keystroke
    selections, or else you can end up with 2 rows being highlighted, as I
    saw in an ASP related example.

    I'm intent on doing my own (simplified) version, but want to keep or
    learn how to do, any processing that is absolutely neccessary.
    Last call for code (on this topic) - I promise... Over n out
     
    awebguynow, May 26, 2006
    #1
    1. Advertising

  2. awebguynow

    awebguynow Guest

    _completeDiv=document.createElement("DIV");
    _completeDiv.id="completeDiv";
    // ...
    document.body.appendChild(_completeDiv);

    // ...
    var M=document.createElement("IFRAME");
    M.completeDiv=_completeDiv; // assigning an element to new id ??
    syntax ?
    // element previously appendChild to body
    M.name="completionFrame";
    M.id="completionFrame"; // used over n over
     
    awebguynow, May 26, 2006
    #2
    1. Advertising

  3. awebguynow

    awebguynow Guest

    Still studying this, and although I'm late to the AJAX ballgame, its a
    very impressive technology, and I'm looking for more references and
    articles to ready, to become proficient myself.

    I'm still baffled by this statement ? "completeDiv" is it a property
    ? out of the blue ?
    also does an element need to be appended to body, before it can be
    assigned like this?
    M.completeDiv=_completeDiv;

    I have the same ? about "prefixStrings" It never seems to be defined
    anywhere, it just appears as a property.

    I don't have my notes handy, but the Google Suggest model has many
    nested elements
    div { iFrame { div { sub-div(line) { sub-sub-div(line-fragment) } } } }


    What purpose does the iFrame (set offscreen) serve ?
    Could a simplified version remove the outer two layers ?

    As I design my own mini-Suggest I hope to keep it as simple as
    possible.
    One area of concern is the Event processing associated with keypress
    keydown
    Which to use ?

    I have taken note of T-PE-Lahn and his _addEventListener method, from
    Feb '06 post
    under Keywords "elements to addEventListener, moveDeleteControls"
    I want to use this xBrowser model; it seems comprehensive for
    compatibility.
    Is the event that should be passed Case Sensitive ?
    The ex: is all lower case, yet I got an IE error when trying this for
    "keydown"

    I do notice Google Suggest's model uses (slightly convoluted but
    efficient) structure:
    a.onkeyup=new Function("return okuh(event); ");else a.onkeyup=okuh;

    I don't know if Google way is best.
    I have done some testing and noticed differences between IE and MOZ
    Once accepts keydown events from the document.body, while the other is
    more restrictive, only capturing keydown events from textbox, and other
    controls, etc.

    TIA for any suggestions, feedback, and good implementation ideas.
     
    awebguynow, Jun 7, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. devpoint
    Replies:
    0
    Views:
    154
    devpoint
    Sep 8, 2003
  2. devpoint
    Replies:
    0
    Views:
    177
    devpoint
    Sep 2, 2003
  3. devpoint
    Replies:
    2
    Views:
    182
    devpoint
    Sep 18, 2003
  4. Steve
    Replies:
    1
    Views:
    299
    Richard Cornford
    Apr 9, 2005
  5. Replies:
    5
    Views:
    132
    Dr John Stockton
    Nov 23, 2005
Loading...

Share This Page