Re: how google suggest works -- which event is attached to INPUT element



On Sep 9, 4:51 pm, Randy Webb <HikksNotAtH...@xxxxxxx> wrote:
wolverine said the following on 9/9/2007 4:08 AM:

On Sep 7, 7:34 pm, Randy Webb <HikksNotAtH...@xxxxxxx> wrote:
wolverine said the following on 9/7/2007 1:38 AM:

On Sep 6, 8:25 pm, Randy Webb <HikksNotAtH...@xxxxxxx> wrote:
wolverine said the following on 9/6/2007 9:33 AM:
Hi,
Hope every body uses google suggesthttp://www.google.com/webhp?complete=1&hl=en.
I don't, I find it very annoying.
If every body was the same world would be very boring.
True, I just find that aspect of the web annoying is all.

What is poison to one may be food for other.

Very true and I am not condemning people that think it is food. I just
don't care for it and it is a personal preference.

For every key press in the input box google would offer suggestions. I
wanted to see which event is attached to the the INPUT element.
View the source.
I was unable to find it by viewing the source.
That doesn't mean it isn't there, it means you couldn't find it. If
there is code in the page to autosuggest then the code *has* to be in
the source. And the "source code" of a page is not just the code you see
by View>Source. It includes all external files.

True. Although i am a novice in javascript coding, i do know that.

OK.

You are a genius if you could do that by viewing source.
It doesn't take a genius, it only takes a basic knowledge of scripting
and source code along with an understanding that the "source code" is
more than what you see in the View>Source document.

Prove it if you could understand that by viewing the source
Nice try but it didn't work. I am not going to enable a feature that I
find annoying just to do what you can't do.

The aim was not to get my homework done. I just meant that
understanding
http://www.google.com/extern_js/f/CgJlbiswCjgBLA/vST7u151leI.js
is like throwing both ends of a rope to a drowning man unless you are
a excellent javascript guy. Just click the link, you will get what i meant.

Trying to read/understand just about any JS code produced by Google is
like throwing a 10 ton rock to a drowning man. If you look at that code,
and replace semicolons with semicolons followed by a new line, the first
few lines read like this:

function N(h,k,r){var u="on"+k;
if(h.addEventListener){
h.addEventListener(k,r,false)}
else if(h.attachEvent){h.attachEvent(u,r)}
else{var M=h[u];

And you got lucky that the part you were hunting was in the first 4
lines of the code. Somewhere in that conglomeration of code you will
find where h is a reference to the input that Google is Suggesting for.
If the browser supports addEventListener then it uses it. If it doesn't
then it moves on to attachEvent and if it is supported it uses it. If it
supports neither, it sets M equal to a property of some object. What
that object is or refers to I didn't care to dig out of that code.

In either event, the answer to your question is that it uses either
attachEvent (IE) or addEventListener (non-IE). Someone may come along
and say "addEventListener isn't non-IE" but I don't care :)


Thanks a lot for spending your time and effort in helping me out.


--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/


.