IE, spawn of Satan

From: CHYRON (DSMITHHFX)26 Aug 2013 16:56
To: ALL1 of 58
trying to get a dead simple jquery click-show submenu thing happening. Worked great, except in IE where it works first time, then stops responding to clicks until a forced page reload, even when going to another page on the site (which to me is like an automagic page reload right there).

I had to resort to applying an inline onclick="" pointing to the function. Only for IE. This took me ~3-hours to figure out.

 (fail)  (fail)  (fail)
From: Peter (BOUGHTONP)26 Aug 2013 20:23
To: CHYRON (DSMITHHFX) 2 of 58
1. Tools>Internet Options>Settings>"Every time I visit the webpage"

2. F12>Console

From: CHYRON (DSMITHHFX)26 Aug 2013 20:45
To: Peter (BOUGHTONP) 3 of 58
1. irrelevant.

2. not user friendly.
From: Peter (BOUGHTONP)26 Aug 2013 20:50
To: CHYRON (DSMITHHFX) 4 of 58
1. you're sure about that?

2. irrelevant.

EDITED: 26 Aug 2013 20:50 by BOUGHTONP
From: CHYRON (DSMITHHFX)26 Aug 2013 21:11
To: Peter (BOUGHTONP) 5 of 58
1. the issue is that, in this case, IE 10 could not register more than one click on an entity via an external javascript*, even
Code:
$('#entity').click(function() { alert('clicked') };
It would respond to the one click only then stop responding, unlike all other browsers which displayed the alert every time it was clicked. I was only able to fix this for IE by applying an inline <div id="entity" onclick="myFunction();">.

2. I'm not making this web page for me, or other developers who want to have a looksee at code. No, it is for Joe Average web visitor who can't be expected to do such a thing, not even for this very, very special web site. So yeah, your developer tools suggestion is a non-starter.



* in fairness this is not quite as straightforward as it sounds: I was shoehorning a submenu into an existing css list/js  drop-down menu (someone else's baby, which doesn't natively support submenus) loaded via php include. Also in fairness, no other browser blinked at this trivial task.
EDITED: 26 Aug 2013 21:11 by DSMITHHFX
From: Peter (BOUGHTONP)26 Aug 2013 21:23
To: CHYRON (DSMITHHFX) 6 of 58
Looking at the console is a debugging step to stop it taking three hours, you twonk.

IE and jQuery are each the most frequently used of their kind; they work together. The issue was thus something else - perhaps a JS error (guess where they show up), or a conflict with some other JS (guess where you can see all other scripts on a page), maybe a quirks mode issue (guess where you can enforce standards compliance), though my current leaning is more towards PEBKAC.

From: CHYRON (DSMITHHFX)26 Aug 2013 21:33
To: Peter (BOUGHTONP) 7 of 58

they work together

Except when they don't.
 

Quote:
The issue was thus something else - perhaps a JS error (guess where they show up), or a conflict with some other JS (guess where you can see all other scripts on a page), maybe a quirks mode issue (guess where you can enforce standards compliance)

Or maybe it's just an IE problem, since it only affects IE.

From: Peter (BOUGHTONP)26 Aug 2013 21:40
To: CHYRON (DSMITHHFX) 8 of 58
It doesn't affect my IE.
From: CHYRON (DSMITHHFX)26 Aug 2013 21:46
To: Peter (BOUGHTONP) 9 of 58
This code issue affected two different instances of IE. I'm betting it would affect your IE. Point being, it doesn't affect anything else. Writing working code for everything else: 10-minutes. For IE: 3-hours. Most of the folks I know have long since dumped that buggy POS for Chrome.

Apparently not just them...
EDITED: 26 Aug 2013 21:47 by DSMITHHFX
Attachments:
From: Peter (BOUGHTONP)26 Aug 2013 21:54
To: CHYRON (DSMITHHFX) 10 of 58
Well sure, your dodgy code probably wouldn't work in my Firefox either.

If I had written it, it would've taken 3 minutes, worked with every browser, and smelt like a summer day in Tuscany.

EDITED: 26 Aug 2013 21:55 by BOUGHTONP
From: CHYRON (DSMITHHFX)26 Aug 2013 23:17
To: Peter (BOUGHTONP) 11 of 58
Ah but it did work in Firefox (which incidentally the web developer plugin gave my script a clean bill of health), and in Chrome, and in Safari.

Repeat after me: it.did.not.work.in.IE.and.it.only.did.not.work.in.IE.

See? That wasn't so hard!

From: Matt27 Aug 2013 13:19
To: CHYRON (DSMITHHFX) 12 of 58
If you were genuinely only doing that, and IE stopped responding to clicks, then sure IE is broken.

But I suspect you have other (broken) JavaScript on the page (console is your friend), or maybe have managed to position a transparent element over the click target (element selector is your friend) which is stopping the target element from receiving the click events.

The whole point of jQuery is that it makes things like this behave the same across all browsers, including IE.
From: CHYRON (DSMITHHFX)27 Aug 2013 15:30
To: Matt 13 of 58
From: af (CAER)27 Aug 2013 16:03
To: CHYRON (DSMITHHFX) 14 of 58
The point is, it's more likely the broken code you're using/writing being the issue, than it is jQuery's compatibility with IE10 being the issue.

Yes, old IEs can be a pain to work with, but the problem here could be several things specific to IE10, possibly it being more strict about certain things than Firefox or Chrome, or like Matt said, transparent elements over the target, or some slight difference in how IE interprets some CSS.

The point is you don't know, which is why everyone is telling you to open IE's console/dev tools and find out what the actual cause of the problem is, and fix that, rather than resorting to horrible inline-JS hackery.
EDITED: 27 Aug 2013 16:19 by CAER
From: af (CAER)27 Aug 2013 16:04
To: CHYRON (DSMITHHFX) 15 of 58
And if you have found an issue with jQuery and its different handling of browser features, you should let the jQuery devs know about it.
From: af (CAER)27 Aug 2013 16:19
To: CHYRON (DSMITHHFX) 16 of 58
Here's a minimal test case:
http://caer.me/clickhandler.html
From: CHYRON (DSMITHHFX)27 Aug 2013 16:21
To: af (CAER) 17 of 58
I suspect an IE-specific conflict between the ca. 2008 css list js and jquery that I injected my little submenu into.

I got it working. Am I going to now obsessive-compulsively troubleshoot an issue between a really old (and rather complex) javascript, jquery and IE10?

In a word, no.
EDITED: 27 Aug 2013 16:23 by DSMITHHFX
From: af (CAER)27 Aug 2013 17:18
To: CHYRON (DSMITHHFX) 18 of 58
Well sure, if it's an isolated case then no point losing sleep over it. Like you said earlier, the user isn't going to be looking at the source anyway, so if it works, no big deal.
From: CHYRON (DSMITHHFX)27 Aug 2013 18:26
To: af (CAER) 19 of 58
You are not PB.
From: Peter (BOUGHTONP)27 Aug 2013 19:03
To: CHYRON (DSMITHHFX) 20 of 58
It's quite simple:

    •  If all you want to do is whine about how useless you are at debugging trivial JS issues, use Ranter's Corner.

    •  If you want to receive advice on how you can stop being useless, post in Coding. It's not like these folder things are new technology or anything...