Not signed in (Sign In)

SkillShare - A place to discuss Web Standards and Web Design topics

Categories

Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorspoo
    • CommentTimeMar 30th 2006 edited
     permalink
    So I went to validate my site. What confused me the most is when the validator returned "This site is NOT valid" yadda yadda, using XHTML 1.0 Strict, but I couldn't help but notice that the only error not validating was a single line of javascript I included to display blog software hosted on a separate server.

    1. The javascript is fully functional, why does it matter if both my Markup and CSS are both semantic?

    2. If I set the validator for XHTML, why is it telling me my javascript is wrong? Last I checked Javascript and XHTML were different't Markup languages.
    • CommentAuthorKanashii
    • CommentTimeMar 30th 2006
     permalink
    Can you post the line it's complaining about?
    •  
      CommentAuthornifkin
    • CommentTimeMar 30th 2006 edited
     permalink
    Does the JS it's complaining about use <, > or &s?

    if so you can wrap it in a CDATA block to identify it as being code and not markup.

    <script type="text/javascript">
    /* <![CDATA[ */
    if((1<2) && (4>3)){
    alert('everything is fine');
    }else{
    alert('there is a serious problem with the world today');
    }
    /* ]]> */
    </script>
    • CommentAuthorspoo
    • CommentTimeMar 30th 2006 edited
     permalink
    The line in discrepancy is:

    <script language="javascript" type="text/javascript" src="http://www.sideblog.com/dev/display.php?user_id=4241&auth=chk/TM2kcTXhI"></script>

    If you know of sideblog.com, you'll recognize it. Sideblog.com is a blogging service that uses Javascript to display a very simple blog from the main database. The site lets you edit the blog with your own css, and that's just what I've done. My CSS and XHTML are all perfect, but that javascript is the only non-validating problem.
    • CommentAuthorKanashii
    • CommentTimeMar 30th 2006 edited
     permalink
    Change to:

    <script language="javascript" type="text/javascript" src="http://www.sideblog.com/dev/display.php?user_id=4241&amp;auth=chk/TM2kcTXhI"></script>


    Difference being that you need to encode the ampersand. i.e. & = &amp;
    • CommentAuthorspoo
    • CommentTimeMar 30th 2006
     permalink
    I appreciate the fix.

    Is there any real reason why things that apparently function, don't validate? Seems like a logical error most comparible to failing a math test because the work shown solved the problem, but isn't the method described by your instructor.
    •  
      CommentAuthornifkin
    • CommentTimeMar 30th 2006
     permalink
    Well, it's because an ampersand is the beginning character for special characters in HTML. So it's expected to actually be used as part of one. (Like using &raquo; instead of just pasting in a bare »)
    • CommentAuthorKanashii
    • CommentTimeMar 30th 2006
     permalink
    Certain character entities need to be encoded differently e.g. &copy; = ©, &rsquo; = ’ because these types of characters start with an ampersand the ampersand character also must be changed if your using it as just an ampersand. The reason why it didn't validate because the parser saw &auth and there is no entity called &auth;. I'm not good at explaining but hope that helps.

    WaSP explains it better : )
    • CommentAuthorCarina
    • CommentTimeMar 31st 2006
     permalink
    Change to:
    <script language="javascript" type="text/javascript" src="http://www.sideblog.com/dev/display.php?user_id=4241&auth=chk/TM2kcTXhI" />
    • CommentAuthorKanashii
    • CommentTimeMar 31st 2006
     permalink
    Actually:

    •  
      CommentAuthorJulian BH
    • CommentTimeApr 2nd 2006
     permalink
    Is there any reason why people use <script ...></script> instead of <script ... />?
    Or people are just used to the old ways...
    • CommentAuthorKanashii
    • CommentTimeApr 2nd 2006
     permalink
    Probably just used to old ways : ) Same can be said for adding language="javascript" :P
    •  
      CommentAuthornifkin
    • CommentTimeApr 2nd 2006
     permalink
    Probably just used to old ways

    Actually it's because <script /> doesn't work.
    • CommentAuthorKanashii
    • CommentTimeApr 2nd 2006 edited
     permalink
    It does in real browsers : ) But yeah seems you have to use the non-minimalised form for compatibility.
    •  
      CommentAuthornifkin
    • CommentTimeApr 2nd 2006
     permalink
    The fact it works in FF still doesn't do anything to increase it's market share to anywhere near IE. ;)
    • CommentAuthorKanashii
    • CommentTimeApr 2nd 2006
     permalink
    Yeah : (

    The noobs will always be the majority of users that never upgrade to better browsers. Fun thing is it's also the majority that don't care the slighest how the underlying code of sites are done either.

    One funny point I saw randomly somewhere the other day was how the other browser manufacturers were thanking MS for installing IE with their OS for the reason: How would anyone download Firefox/Opera/etc if it wasn't for IE. : )
Add your comments
    Username Password
  • Format comments as (Help)