Vbulletin Generated DOCTYPE problem in cojuction wiuth Javascript 2.1

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jbristor
    New Member
    • Dec 2004
    • 8

    Vbulletin Generated DOCTYPE problem in cojuction wiuth Javascript 2.1

    We've used Vbulletin for years and have a couple of licenses, but I have never run into this.

    Using a Javascript 2.1 menu system from Apycom, it barfs and gives javascript errors or doesn't work all due to the DOCTYPE line put out above the HTML tag at the top of pages.

    I tried to copy an example, but then this forum freaked out and blew away the message.

    It's the DOCTYPE line starting with a "<!". If I comment it out, everything works fine. I know I can force vbulletin to not export this line, but I'd like to know why? If I knew why, it would help, and maybe I can explain it to the other company.

    I know in general the purpose of the DOCTYPE tag, but never thought a variation of it would cause a Javascript program to have problems.

    Thanks for any info.
  • Zachery
    Former vBulletin Support
    • Jul 2002
    • 59097

    #2
    The doctype should always come before HTML ... so maybe its bad java?

    Comment

    • Wayne Luke
      vBulletin Technical Support Lead
      • Aug 2000
      • 73981

      #3
      HTML Code:
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      That line? This is a standard line from the W3C. It shouldn't cause any problems with Javascript unless it has been changed and the new namespace doesn't allow Javascript for some reason.

      On a second note, vBulletin makes extensive use of Javascript already so it could be that your new code is conflicting. Any specific javascript errors that you get?
      Translations provided by Google.

      Wayne Luke
      The Rabid Badger - a vBulletin Cloud demonstration site.
      vBulletin 5 API

      Comment

      • jbristor
        New Member
        • Dec 2004
        • 8

        #4
        Originally posted by Zachery
        The doctype should always come before HTML ... so maybe its bad java?
        Vbulletin always puts the line 1st..

        Comment

        • jbristor
          New Member
          • Dec 2004
          • 8

          #5
          Originally posted by Wayne Luke
          HTML Code:
          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
          That line? This is a standard line from the W3C. It shouldn't cause any problems with Javascript unless it has been changed and the new namespace doesn't allow Javascript for some reason.

          On a second note, vBulletin makes extensive use of Javascript already so it could be that your new code is conflicting. Any specific javascript errors that you get?
          Thanks.. I have had problems with some company's Javascript in the past, but get them to rectify it.. Sometimes it is the order of things..

          This is related to the specific DOCTYPE message. I'll try using the code format to show the code.

          Code:
          <!--
          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd[/URL]">
          -->
          <html dir="ltr" lang="en">
          <head>
          <!-- Apycom's DHTML Tree Menu -->
          <script type="text/javascript" language="JavaScript1.2" src="../../../html/dhtmltree/js/apytmenu.js"></script>
          <!-- End DHTML Tree Menu -->
          <!-- END TEMPLATE: headinclude -->
          </head>
          <body>
          <script type="text/javascript" language="JavaScript1.2" src="../../../html/dhtmltree/txpmenu3.js"></script>
          <script type="text/javascript" language="JavaScript1.2" src="../../../html/dhtmltree/js/apytmenu_add.js"></script>
          </body>
          </html>
          All of everything is stripped out but the DOCTYPE line produced by vBulletin. If I commented it out, then the javascript runs fine, if it is there, the Javascript bombs immediately.

          I have little doubt that the vBulletin line is fine, and it is causing something to flake out with the other company's product. The other company's product works fine with other programs. But they don't use that particular configuration of the DOCTYPE Tag.

          I just would like to understand the possibilities as though I can keep vBulletin from outputting the line, I'd rather not and I'd like to understand for my own personal edification and so I can explain what is going on to the other company.

          The 1st step is why would such a line have any effect on any javascript? I haven't tried to use like the simplier DOCTYPE line from CNN or places like that yet to see if something specific in the line is causing the problem.

          Thanks for any help or thoughts.

          Comment

          • jbristor
            New Member
            • Dec 2004
            • 8

            #6
            Now if I take CNN's version:

            Code:
            <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
            instead of vBulletin's:

            Code:
            [COLOR=#000080]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/COLOR]
            It Works!

            So now it is down to why the last section of the DOCTYPE would cause this Javascript 1.2 program to die...

            Comment

            • Wayne Luke
              vBulletin Technical Support Lead
              • Aug 2000
              • 73981

              #7
              CNN's version is not loading a namespace but assumes the browser already knows it and can put your browser into quirks mode which allows more HTML bugs to be in place without causing the browser problems. I would suspect that the menuing system you are adding outputs HTML code that is not compliant with XHTML 1.0 Transitional specifications.

              Unfortunately, the problem really does lie within the javascript you are adding. You can change the Doctype in vBulletin on your installation within your templates if that resolves the issue to your satisfaction. However, the site will no longer be XHTML 1.0 Transitional Compliant.
              Translations provided by Google.

              Wayne Luke
              The Rabid Badger - a vBulletin Cloud demonstration site.
              vBulletin 5 API

              Comment

              • jbristor
                New Member
                • Dec 2004
                • 8

                #8
                Originally posted by Wayne Luke
                CNN's version is not loading a namespace but assumes the browser already knows it and can put your browser into quirks mode which allows more HTML bugs to be in place without causing the browser problems. I would suspect that the menuing system you are adding outputs HTML code that is not compliant with XHTML 1.0 Transitional specifications.

                Unfortunately, the problem really does lie within the javascript you are adding. You can change the Doctype in vBulletin on your installation within your templates if that resolves the issue to your satisfaction. However, the site will no longer be XHTML 1.0 Transitional Compliant.
                Thanks.. that sounds about right.. but how does it work?

                Is it the browser's function that reads the DOCTYPE tag and then the identifies that the Javascript is not compliant? It works without the long tag, or leaving out the 'specific' portion. Things have gotten better over the years on Browser interopability, but this is just a wierd circumstance. I agree, that there is something in the other company's code that is 'setting' something off and non-compliant'. Such a small thing makes me wonder if I should go back to testing all versions of all browsers for the last 5 years.. Or be afraid that a new version of Vbulletin as accurate and proactive as they are, may cause something old, that I assumed to be fine, to quit working.

                Sorry, just rambling.. and thanks for your input.

                Comment

                • Zachery
                  Former vBulletin Support
                  • Jul 2002
                  • 59097

                  #9
                  CNN is using the html 4 doctype where vBulletin is using the XHTML 1.0 Trans doctype. Which wayne explain abit about above. It seems that your javascript is just not compatable with XHTML.

                  Comment

                  • jbristor
                    New Member
                    • Dec 2004
                    • 8

                    #10
                    Originally posted by Zachery
                    CNN is using the html 4 doctype where vBulletin is using the XHTML 1.0 Trans doctype. Which wayne explain abit about above. It seems that your javascript is just not compatable with XHTML.
                    Thanks.. I never knew until today that Javascript may not be compatible with Xhtml in a doctype line. Hey we all learn! I would like to understand how things work together, as a programmer.. I just never had ran into it. Personally I haven't paid much attention to the DOCTYPE line.

                    I guess I need to study up.

                    Thanks again for yours and everyone's contribution.

                    Comment

                    Related Topics

                    Collapse

                    Working...