The final 'document.getElementById' fix - test on old browser needed ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Aaron Gray

    The final 'document.getElementById' fix - test on old browser needed ?

    Hi,

    I know the 'document.getEl ementById()' issue is really over since every
    browser since 1998 supports the W3C DOM standard, but I could not resist
    this offering :-

    if (!document.getE lementById)
    document.getEle mentById = function(id) { return document.all[id]; }

    This should then provide a getElementById function if one does not already
    exist.

    Is anyone in a position to be able to test this code ?

    You could go thurther and define :-

    if (!document.getE lementById)
    if (document.all)
    document.getEle mentById = function(id) { return
    document.all[id]; }
    else
    document.getEle mentById = function(id) { return
    document.layers[id]; }

    Reference :-



    Thanks,

    Aaron


  • Bjoern Hoehrmann

    #2
    Re: The final 'document.getEl ementById' fix - test on old browser needed ?

    * Aaron Gray wrote in comp.lang.javas cript:
    >I know the 'document.getEl ementById()' issue is really over since every
    >browser since 1998 supports the W3C DOM standard, but I could not resist
    >this offering :-
    >
    if (!document.getE lementById)
    document.getEle mentById = function(id) { return document.all[id]; }
    >
    >This should then provide a getElementById function if one does not already
    >exist.
    >
    >Is anyone in a position to be able to test this code ?
    There's http://browsers.evolt.org and there are a number of free virtual
    machine http://en.wikipedia.org/wiki/Categor...ation_software
    products that you can use to set up old operating systems or just iso-
    lated enviroments to run them.
    --
    Björn Höhrmann · mailto:bjoern@h oehrmann.de · http://bjoern.hoehrmann.de
    Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
    68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/

    Comment

    • Svend Tofte

      #3
      Re: The final 'document.getEl ementById' fix - test on old browserneeded ?

      On Jul 11, 1:21 am, "Aaron Gray" <ang.use...@gma il.comwrote:
      document.getEle mentById = function(id) { return document.layers[id]; }
      NS4 Layers are more tricky then that. Layers that are nested will not
      be exposed through the top level layers array. Example

      document.layers['outerLayer'].document.layer s['innerLayer'] (yes, it's
      that messed up)

      Regards,
      Svend

      Comment

      • Aaron Gray

        #4
        Re: The final 'document.getEl ementById' fix - test on old browser needed ?

        "Bjoern Hoehrmann" <bjoern@hoehrma nn.dewrote in message
        news:1uhd74hs1p 27n8vee7v123g9i vauqun1g0@hive. bjoern.hoehrman n.de...
        >* Aaron Gray wrote in comp.lang.javas cript:
        >>Is anyone in a position to be able to test this code ?
        >
        There's http://browsers.evolt.org and there are a number of free virtual
        machine http://en.wikipedia.org/wiki/Categor...ation_software
        products that you can use to set up old operating systems or just iso-
        lated enviroments to run them.
        I may well try this if no one comes forward to do tests for me.

        Thanks,

        Aaron


        Comment

        • Aaron Gray

          #5
          Re: The final 'document.getEl ementById' fix - HTML test file

          "Aaron Gray" <ang.usenet@gma il.comwrote in message
          news:6dnjs1F3fk s3U1@mid.indivi dual.net...
          Hi,
          >
          I know the 'document.getEl ementById()' issue is really over since every
          browser since 1998 supports the W3C DOM standard, but I could not resist
          this offering :-
          >
          if (!document.getE lementById)
          document.getEle mentById = function(id) { return document.all[id]; }
          >
          This should then provide a getElementById function if one does not already
          exist.
          >
          Is anyone in a position to be able to test this code ?
          >
          There's a test for document.getEle mentById() emulation here :-



          Thanks,

          Aaron


          Comment

          • Dr J R Stockton

            #6
            Re: The final 'document.getEl ementById' fix - test on old browser needed ?

            In comp.lang.javas cript message <6dnjs1F3fks3U1 @mid.individual .net>,
            Fri, 11 Jul 2008 00:21:35, Aaron Gray <ang.usenet@gma il.composted:
            >
            >I know the 'document.getEl ementById()' issue is really over since every
            >browser since 1998 supports the W3C DOM standard, but I could not resist
            >this offering :-
            >
            if (!document.getE lementById)
            document.getEle mentById = function(id) { return document.all[id]; }
            >
            >This should then provide a getElementById function if one does not already
            >exist.
            >
            >Is anyone in a position to be able to test this code ?
            A version tested in MS IE 4 is at <URL:http://www.merlyn.demon.co.uk/js-
            versn.htm#SSF>; I cannot repeat the test.

            I don't recall anyone complaining that it did not work in the
            circumstances in which I used it. But it does not reproduce all
            features.

            To get it rested in Netscape 4, I suggest that you ask the custodian of
            the Davar site, who posts advertisements here from time to time.
            Evidently he is keen to support those hoping to upgrade to Netscape 4.8.

            It's a good idea to read the newsgroup c.l.j and its FAQ. See below.

            --
            (c) John Stockton, nr London UK. ?@merlyn.demon. co.uk IE7 FF2 Op9 Sf3
            news:comp.lang. javascript FAQ <URL:http://www.jibbering.c om/faq/index.html>.
            <URL:http://www.merlyn.demo n.co.uk/js-index.htmjscr maths, dates, sources.
            <URL:http://www.merlyn.demo n.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.

            Comment

            • SAM

              #7
              Re: The final 'document.getEl ementById' fix - HTML test file

              Aaron Gray a écrit :
              >
              There's a test for document.getEle mentById() emulation here :-
              >
              http://www.aarongray.org/Test/JavaSc...ById-test.html
              a pure soup of tags ... !

              --
              sm

              Comment

              Working...