Google Suggest, advanced JS, DHTML

A

awebguynow

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
 
A

awebguynow

_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
 
A

awebguynow

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top