Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-25-2009, 10:26 PM   PM User | #1
tomws
Senior Coder

 
tomws's Avatar
 
Join Date: Nov 2007
Location: Arkansas
Posts: 2,644
Thanks: 29
Thanked 330 Times in 326 Posts
tomws will become famous soon enoughtomws will become famous soon enough
IE6/7/8 slow traversing?

I'm confused with where this problem is coming from. Most likely I'm just ignorant of this "feature". This code is executed when clicking on an image area to generate a shape on a canvas:
Code:
            mouseclick = function(e,clicked_area)
            {
                var area_obj = clicked_area ? clicked_area : this;

                //alert('here');
                if (! $('#canvas_'+$(area_obj).attr('id')).attr('id'))
                {
                    draw(area_obj);
                }
                else
                {
                    alert('del');
                    $('#canvas_' + $(area_obj).attr('id')).remove();
                    clear_canvas(canvas);
                }
            };
IE 6/7/8 all seem to traverse too slowly or execute too quickly... not sure what to call it. When the #canvas_foo tag is not present (and it's not until after draw()), processing still enters the else statement. However, if I slow it down with the alert('here'), the if/else operates as expected.

I can also break the expected flow by timing a spacebar hit just right so that it kills off the first alert as soon as it triggers. Something else that makes it seem like some odd speed issue.

Furthermore, I can confirm that it's not double-processing the click because an alert() placed within draw() is not triggered unless the "slow down" alert is uncommented.


What am I missing?
__________________
Are you a Help Vampire?
tomws is offline   Reply With Quote
Old 11-30-2009, 03:04 PM   PM User | #2
tomws
Senior Coder

 
tomws's Avatar
 
Join Date: Nov 2007
Location: Arkansas
Posts: 2,644
Thanks: 29
Thanked 330 Times in 326 Posts
tomws will become famous soon enoughtomws will become famous soon enough
Bump

I've stripped down the page and have set up a pair of test pages so that maybe I can get some opinions on this problem.
EDIT: Resolved. Removed links.

The only difference between the two is in the maphilight javascript. The alert-delayed version has the alert before the condition, and (appropriately) the non-delayed version does not. Remember to test this in IE as FF seems to work correctly. And, for reference, here is the latest code portion with those alerts in place:

Code:
            mouseclick = function(e,clicked_area)
            {
                var area_obj = clicked_area ? clicked_area : this;

                //alert('alerting for delay'); /* Here's the line that's different between the two. */
                //if (! $('#canvas_'+$(area_obj).attr('id')).attr('id'))
                if (! $('#canvas_'+$(area_obj).attr('id')).length)
                {
                    alert('about to draw on the canvas');
                    draw(area_obj);
                }
                else
                {
                    alert('deleting from the canvas');
                    $('#canvas_' + $(area_obj).attr('id')).remove();
                    clear_canvas(canvas);
                }
            };
__________________
Are you a Help Vampire?

Last edited by tomws; 11-30-2009 at 03:33 PM..
tomws is offline   Reply With Quote
Old 11-30-2009, 03:29 PM   PM User | #3
tomws
Senior Coder

 
tomws's Avatar
 
Join Date: Nov 2007
Location: Arkansas
Posts: 2,644
Thanks: 29
Thanked 330 Times in 326 Posts
tomws will become famous soon enoughtomws will become famous soon enough
Ugh... resolved. I guess all it takes is posting the question and then I can figure out the problem.

In this case, as expected, it didn't have anything to do with some weird IE behavior, but rather my own mistake in another part of the code. The if statement above checks for an id on an area of the canvas. My tweaked IE version of the mouseover event actually applied an id to the area. The mouseclick event found that id and went into the else condition instead of where I wanted it to go.

Apologies for wasting your time.
__________________
Are you a Help Vampire?
tomws is offline   Reply With Quote
Old 11-30-2009, 04:05 PM   PM User | #4
Fumigator
UE Antagonizer


 
Fumigator's Avatar
 
Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,687
Thanks: 42
Thanked 637 Times in 625 Posts
Fumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of light
Glad you found the problem because I sure couldn't!

Nice looking app btw.
__________________
Fumigator is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:26 AM.


Advertisement
Log in to turn off these ads.