473,326 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

JavaScript Experts, How Do I Debug This Event Handlers Problem?

Ray
Hello JavaScript experts,

I've been racking my brains for 2 hours and I still haven't figured
out this problem.

Basically, I have this page (an IE-only page), with a lot of
javascript files behind it, most of it not written by me. The problem
with this page is: once I use IE6 to load it, moving the mouse pointer
over the page will cause IE CPU usage to shoot up to 100%. Typing into
edit boxes a lot of characters quickly will also choke the CPU (and
the characters won't show up immediately, it took a few seconds before
the chars I type appear within the text box).

So, obviously something is catching keyboard and mouse related events
somewhere and doing useless, but intensive, processing.

And my guess is that since moving the mouse _anywhere_ within the page
(as long as it is within the browser window) jacks the CPU usage up to
100%, it's probably handled at the document level.

My question is, how do I find out the culprit? I tried this:

* Find all files with the text "document.attachEvent", I found them,
commented them out, still have the same problem. (Also, actually the
lines I commented out trap onkeyup and onmousedown, so it doesn't
explain the "moving-mouse-uses-100%-CPU" problem).

* There doesn't seem to be any API for finding out all the event
handlers attached to an element?

Thanks in advance for any pointers,
Ray

Mar 7 '07 #1
5 2197
The event could be being trapped on either the document or the body
element. Have you checked for events attached to both? Have you
searched for event handlers created using the "element.onmousemove
= ..." syntax?

You say that the page is IE-only, does that mean that loading it in
either Opera or Firefox and using their debugging facilities is not an
option? Unfortunately, trying to debug javascript in IE6 is a
frustrating experience.

wp

Mar 7 '07 #2
Ray
On Mar 7, 11:57 pm, "wisestpotato" <wisestpot...@googlemail.com>
wrote:
The event could be being trapped on either the document or the body
element. Have you checked for events attached to both? Have you
searched for event handlers created using the "element.onmousemove
= ..." syntax?
Let me give that a try... the use of Behaviour.js complicates things
actually, although I guess I can search using onmousemove, let me
try.
You say that the page is IE-only, does that mean that loading it in
either Opera or Firefox and using their debugging facilities is not an
option? Unfortunately, trying to debug javascript in IE6 is a
frustrating experience.

wp
Yes, IE-only as in when I opened it in Firefox (I wanted to debug this
using Venkman, alas, I couldn't), the page becomes really screwed up,
things that usually work don't work anymore, etc.

Thanks!
Ray

Mar 7 '07 #3
Ray
On Mar 7, 11:57 pm, "wisestpotato" <wisestpot...@googlemail.com>
wrote:
The event could be being trapped on either the document or the body
element. Have you checked for events attached to both? Have you
searched for event handlers created using the "element.onmousemove
= ..." syntax?
Hmmm, that's really strange. I didn't find onmousemove that is
relevant. I tried moving my mouse pointer over the part that doesn't
have any element (so it's basically either the body or document)--CPU
immediately shoots up to 100%. Really strange.
>
You say that the page is IE-only, does that mean that loading it in
either Opera or Firefox and using their debugging facilities is not an
option? Unfortunately, trying to debug javascript in IE6 is a
frustrating experience.

wp

Mar 7 '07 #4
VK
On Mar 7, 8:23 pm, "Ray" <ray_use...@yahoo.comwrote:
I tried moving my mouse pointer over the part that doesn't
have any element (so it's basically either the body or document)--CPU
immediately shoots up to 100%. Really strange.
That can be some library implementing paranoidal DOM event model: so
onload it makes all elements as event consumers "just in case" with
custom event dispatcher atop. So on each mouse move the event gets
distributed to N consumers where maybe only one or two are actually
supposed to do anything on this event. That is a speculation from my
side based on what I've seen on practice.

Comment out all <scriptelements and then uncomment one by one
checking the performance after that. That should help to identify the
actual "abuser". Then give us a link to the abusing library.
Mar 7 '07 #5
On Mar 7, 10:31 am, "Ray" <ray_use...@yahoo.comwrote:
Hello JavaScript experts,

I've been racking my brains for 2 hours and I still haven't figured
out this problem.

Basically, I have this page (an IE-only page), with a lot of
javascript files behind it, most of it not written by me. The problem
with this page is: once I use IE6 to load it, moving the mouse pointer
over the page will cause IE CPU usage to shoot up to 100%. Typing into
edit boxes a lot of characters quickly will also choke the CPU (and
the characters won't show up immediately, it took a few seconds before
the chars I type appear within the text box).

So, obviously something is catching keyboard and mouse related events
somewhere and doing useless, but intensive, processing.

And my guess is that since moving the mouse _anywhere_ within the page
(as long as it is within the browser window) jacks the CPU usage up to
100%, it's probably handled at the document level.

My question is, how do I find out the culprit? I tried this:

* Find all files with the text "document.attachEvent", I found them,
commented them out, still have the same problem. (Also, actually the
lines I commented out trap onkeyup and onmousedown, so it doesn't
explain the "moving-mouse-uses-100%-CPU" problem).

* There doesn't seem to be any API for finding out all the event
handlers attached to an element?

Thanks in advance for any pointers,
Ray


http://blogs.msdn.com/ie/archive/2004/10/26/247912.aspx
http://www.jonathanboutelle.com/mt/a...debug_jav.html

Check the two links above. I think the debugger is pretty weak but it
may help you out some. Also could you be more specific about things
not working in ff. When you check the error console do you see signs
that certain functions are not recognized? If you do then check your
js source code b/c those may be the functions that are causing the
problem.

Mar 7 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Java script Dude | last post by:
I have still yet to see a JavaScript Editor that comes close to reading a good JS book, learing it and using it with a text editor. Anyway, here my recipe for build successfull DHTML...
14
by: horos | last post by:
hey all, I'm a heavy perl user, not so much a java script user, and was wondering... perl has an extremely nice utility called Data::Dumper, which allows you to dump out the contents of an...
3
by: yawnmoth | last post by:
I've seen a few webpages that use the javascript pseudo-protocol with event handlers. eg. <input onkeyup="javascript: ..." /> Correct me if I'm wrong, but isn't onkeyup always supposed to be...
9
by: Erwin Moller | last post by:
Hi, Can anybody comment on this? In comp.lang.php I advised somebody to skip using: <script language="javascript"> and use: <script type="text/javascript"> And mr. Dunlop gave this response:
5
by: Tomislav | last post by:
Hello, I tried to use "javascript:return confirm();" function in following manner ( triggered by form onSubmit event ): ** <form method="post" action="mail.php" onSubmit="javascript:return...
4
by: m0nkeymafia | last post by:
I read about this technique to basically allow you to have a file with behaviours and javascript events that attach to various dom objects and events but are not done inline. so its basically a...
19
by: maya | last post by:
hi, so what is "modern" javascript?? the same as "DOM-scripting"? i.e., editing content (or changing appearance of content) dynamically by massaging javascript objects, html elements, etc? ...
17
by: yawnmoth | last post by:
http://www.frostjedi.com/terra/scripts/demo/this-alert.html http://www.frostjedi.com/terra/scripts/demo/this-alert2.html Why, when you click in the black box, do the alert boxes say different...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.