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.
Page 3 of 3 FirstFirst 123
Results 31 to 34 of 34
  1. #31
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,184
    Thanks
    10
    Thanked 569 Times in 550 Posts
    Quote Originally Posted by AndrewGSW View Post
    It doesn't really require an IE8 conditional though, does it? Because it starts with:
    no, i'm sure hes talking about the common <head> scripts you see on most professional sites and integrated into modern frameworks like bootstrap or boilerplate.

    it's an IE shim for new [] methods, Object.[keys,defineProperty, etc], Date.now, et al.

    only IE would load the shim as its a sync external script tag in the head behind a conditional comment.

    so, if you have a solid foundation, you can simply write the 21st-century version and not have to worry about old browsers; they will run the new code just like real browsers.

    or you can write expressly for obsolete browsers and make it harder on yourself to save a few KB that only ancient devices will ever fetch anyway...
    Last edited by rnd me; 04-14-2013 at 09:09 PM.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/1/19) IE7:0.2, IE8:6.7, IE11:7.4, IE9:3.8, IE10:4.4, FF:18.3, CH:43.6, SF:7.8, MOBILE:27.5

  2. #32
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,460
    Thanks
    0
    Thanked 632 Times in 622 Posts
    Quote Originally Posted by AndrewGSW View Post
    It doesn't really require an IE8 conditional though, does it? Because it starts with:

    Code:
    if (!Object.keys) {
    MDN reference
    BTW What are these fill-in-snippets called? "fill-ins"? "poly-fills"? I seem to recall there was a (semi-formal) term for them.
    No it doesn't need the IE8 conditional - the suggestion of using an IE8 conditional would allow you to remove that wrapper from around the code given that IE8 and earlier are the only browsers that don't recognise Object.keys.

    My suggesting an IE8 conditional was in response to Philip's suggestion that all this extra code would slow the script down. By including the poly-fill code in a conditional only IE8 would see it and all the modern browsers would not waste time downloading poly-fill code that they don't need.

    Ideally you'd place all the poly-fill code in one script that just gets loaded for IE8 and earlier -rnd_me has mentioned a couple of scripts that already contain the code to allow IE5 through IE8 to use all the same modern methods as modern browsers do (at least with respect to those where code to emulate the new method can be written using the old version of JavaScript - but then those that can't were not able to be written some other way in the past and so Philip would not be able to present an old style alternative to code that uses any of those methods).
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  3. #33
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    Thank you @rnd_me and felgall.
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS

  4. #34
    Regular Coder
    Join Date
    Jan 2013
    Location
    Germany
    Posts
    578
    Thanks
    4
    Thanked 77 Times in 77 Posts
    As Cliff Bleszinki just recently stated: "Technology doesn't advance by worrying about the edge case". Granted, he was talking about something completely else, but the principle is the same. If you can add a conditional polyfill for IE, great. But that's about the maximum amount of trouble it'd be worth to me.


 
Page 3 of 3 FirstFirst 123

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
  •