Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Aug 2010
    Location
    Southern Oregon
    Posts
    280
    Thanks
    61
    Thanked 1 Time in 1 Post

    window.event in latest versions of IE and Edge?

    Is it still necessary to reference window.event in event listener/handlers rather
    than the event object in DOM compatible browsers?

    Last time I worked with cross browser support, IE was understanding element.addEventListener
    but I don't remember if I had to still reference window.event for IE.

    Thanks for time and attention
    JK

  2. #2
    Senior Coder deathshadow's Avatar
    Join Date
    Feb 2016
    Location
    Keene, NH
    Posts
    1,965
    Thanks
    2
    Thanked 288 Times in 278 Posts
    If you don't care about IE8/earlier, NO, you no longer have to do it. BUT, if you don't care, be sure there's a scripting off fallback plan to handle the page... though in that way most such event driven stuff should either be goofy presentational crap you could do without, or enhancements to existing functionality, NOT the functionality of the page itself.

    At least on a normal website where you should be caring more about delivering content to users and accessibility than you should goofy scripted effects that add NOTHING of value to the page.

    That said, I still get significant traffic on the five sites I maintain from IE8 and even earlier. One of the sites I can dismiss as it has retrocomputing topics on it, so visits from even DOSLynx or arachne is hardly a shock; but one of the business sites of a clients that offers support for a certain contact application still sees frequent IE6 through 8 traffic because a LOT of big businesses cannot migrate past that point because their in-house crapplets rely on the older versions of Trident to even function.

    In that same way, you have places like family clinics where in-house they still have machines running 98 -- and no upgrading is not an answer financially. They get a little pissy when the site you make for them isn't at least USABLE on their own systems. You lose a few bells and whistles like drop shadows, rounded corners, flex layout and so forth, who cares if the page is USABLE... you lose scripting ONLY functionality?

    Though Is it REALLY so hard to wrap as:

    e = e || window.event;
    if (!e.target) e.target = window.srcElement;

    It's not some massive code that's hard to remember.

    But again, you want to lose it, fine, so long as you don't break FUNCTIONALITY in the process, but again on CONTENT oriented sites scripting should ENHANCE functionality, not supplant or be the only means of providing it. If it's an ENHANCEMENT, and it doesn't work in older browsers, who gives a flying purple fish... if it's FUNCTIONALITY, that's a whole different story.

    That's kind of why you'll hear about concepts like progressive enhancement and graceful degradation. Most sites can't be as massively popular as Facebook to the point they can tell users with accessibility needs or lesser hardware to go **** themselves thanks to an over-reliance on scripting... and in the case of SOME types of sites in some countries, failing to provide those fallbacks can land you in hot water with fines, lawsuits, etc.
    Last edited by deathshadow; 01-04-2017 at 07:41 PM.
    I would rather have questions that can't be answered, than answers that can't be questioned.
    http://www.cutcodedown.com

  3. #3
    Regular Coder
    Join Date
    Aug 2010
    Location
    Southern Oregon
    Posts
    280
    Thanks
    61
    Thanked 1 Time in 1 Post

    Thanks for the lecture

    I am writing code for tools and utilities and applications in javascript.
    I create user interfaces in html that use buttons and other elements to execute code with event listeners.
    It is all functionality. I am not engaging in effects and embellishments for their own sake.

    I am concerned about backward compatibility to some extent.

    As well, I have a belated apology to make to deathshadow regarding using htmlspecialchars in using php
    to textarea elements. I was under the impression that the entities would be rendered literally in the the
    textarea. Exploring this issue further I found that not to be the case. So your suggestion turned out to be
    more valuable than it first appeared.


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •