Advanced Search

Results 1 to 8 of 8

Thread: Anylink Menu script and HTML5

  1. #1
    Join Date
    Sep 2004
    Location
    Tallahassee, FL USA
    Posts
    180
    Thanks
    39
    Thanked 1 Time in 1 Post

    Default Anylink Menu script and HTML5

    1) Script Title: Anylink Drop Down Menu V2.0

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...anylinkcss.htm

    3) Describe problem: This is a nitpicky thing, but I would like to know the correct way to solve it as I move forward in learning HTML5, especially since I love DynamicDrive and used lots of your scripts in my designs.

    I'm revamping a client site and, in the process, recoding it in HTML5. Everything validates except for the script documentation, which causes the following error:

    "Error: The text content of element script was not in the required format: Expected asterisk or slash but found w instead."

    Here is the page: http://www.alaprovence.com/test.html

    And here is the section causing the error:
    Code:
    <script type="text/javascript" src="/anylink/anylinkmenu.js">
    /***********************************************
    * AnyLink JS Drop Down Menu v2.0- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit Project Page at http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm for full source code
    ***********************************************/
    </script>
    I'd like to learn how to fix this if possible.

    Thanks,
    Deborah
    Deborah Whipp
    Web Designer
    Tallahassee, FL
    www.DWWebDesigns.com

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,681
    Thanks
    43
    Thanked 3,126 Times in 3,092 Posts
    Blog Entries
    12

    Default

    That's actually an error on the part of the validator - at least as far as I can tell. It's not recognizing that as a full comment. There might be some technical reason why it doesn't, and the standards writing folks at W3C might defend it on that basis.

    In any case, you can fix it like so:

    Code:
    <script type="text/javascript" src="/anylink/anylinkmenu.js">
    /***********************************************
    * AnyLink JS Drop Down Menu v2.0- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    //* Visit Project Page at http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm for full source code
    ***********************************************/
    </script>
    I often do:

    Code:
    <script type="text/javascript" src="/anylink/anylinkmenu.js">
    /***********************************************
    //* AnyLink JS Drop Down Menu v2.0- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
    //* This notice MUST stay intact for legal use
    //* Visit Project Page at http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm for full source code
    ***********************************************/
    </script>
    just to make it even, but it's just that one line, the one with the full URL in it, that causes the error. I think the validator thinks we are trying to close the multi-line comment or open a new one but doing it incorrectly. I'm not sure why turning it into a single line comment works to fix that, but it does. Maybe it closes the multi-line comment before the offending part that now is seen as a single line comment. But that doesn't seem right/logical given the resulting syntax. In fact, as I say, since the whole thing is a comment, nothing in there should matter in the way that this does to the validator. But it does 'fix' it.

    I've tried other approaches, this is the only one that works. That is unless you move the comment outside the script block and make it into an HTML comment. That also works. I think this solution looks better though.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    dmwhipp (05-07-2013)

  4. #3
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,622
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    This will do it. Currently, the spec has some very over-zealous rules about what javascript comments should look like, and doesn't want any extra * characters inside the comment block. Keep a few things in mind, however:

    1. the extra *s are a very common format, even necessary for some purposes (javadocs, for example). They will not hurt anything.
    2. the w3c validator is very helpful, but there comes a point when "fixing" its complaints doesn't really "fix" anything.
    3. the HTML5 conformance checker is experimental, and may change tomorrow for no reason.

    Code:
    <script type="text/javascript" src="/anylink/anylinkmenu.js">
    /*
    AnyLink JS Drop Down Menu v2.0- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
    This notice MUST stay intact for legal use
    Visit Project Page at http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm for full source code
    */
    </script>
    Edit: John, interesting... I didn't even think to try that.

    BTW, here is the spec regarding inline comments in <script>s. I think you're right about how it's being interpreted. If that's correct, it would seem we've found a bug (in the validator, not the spec)...
    Last edited by traq; 05-07-2013 at 04:40 PM.
    We Only Torture the Folks We Don't Like (You're Probably Gonna Be Okay)
    It's a Party in the CIA

  5. The Following User Says Thank You to traq For This Useful Post:

    jscheuer1 (05-08-2013)

  6. #4
    Join Date
    Sep 2004
    Location
    Tallahassee, FL USA
    Posts
    180
    Thanks
    39
    Thanked 1 Time in 1 Post

    Default

    Thank you John - validates error free now.
    Deborah
    Deborah Whipp
    Web Designer
    Tallahassee, FL
    www.DWWebDesigns.com

  7. #5
    Join Date
    Sep 2004
    Location
    Tallahassee, FL USA
    Posts
    180
    Thanks
    39
    Thanked 1 Time in 1 Post

    Default

    Hi Adrian,
    I know the validator isn't perfect and the original coding didn't effect the functionality or look of the page, but it was a nitpicky thing that I wanted to learn how to fix, and it's always nice to tell clients all the pages validate error free.
    Thanks,
    Deborah
    Deborah Whipp
    Web Designer
    Tallahassee, FL
    www.DWWebDesigns.com

  8. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,681
    Thanks
    43
    Thanked 3,126 Times in 3,092 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by traq View Post
    This will do it.
    Code:
    <script type="text/javascript" src="/anylink/anylinkmenu.js">
    /*
    AnyLink JS Drop Down Menu v2.0- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
    This notice MUST stay intact for legal use
    Visit Project Page at http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm for full source code
    */
    </script>
    Interesting Adrian, and likewise:

    Edit: . . I didn't even think to try that.

    BTW, here is the spec regarding inline comments in <script>s. I think you're right about how it's being interpreted. If that's correct, it would seem we've found a bug (in the validator, not the spec)...
    And yes, if you mean, since the validator says:

    Expected asterisk or slash but found w instead.
    that it indicates that the validator thinks we are trying to open a new comment and doing it incorrectly. But why would we be? Isn't the initial comment still in effect? And that would be the validator error. But I'm not sure if the W3C folks would see it that way or not.
    Last edited by jscheuer1; 05-08-2013 at 01:38 AM. Reason: English
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  9. #7
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,622
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Right. I think it's a bug in the validator (I don't think the spec actually "meant that to be," but maybe I'm not reading it right).
    But the w3c folks explicitly say that the validator is "experimental," and that's not going to change until the spec is frozen.
    We Only Torture the Folks We Don't Like (You're Probably Gonna Be Okay)
    It's a Party in the CIA

  10. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,681
    Thanks
    43
    Thanked 3,126 Times in 3,092 Posts
    Blog Entries
    12

    Default

    I was just wading through the specification on the W3C, which is identical to the one you linked to. But that is in addition to restrictions on script contents in general (also noted in the link you used and probably listed just above that as are the W3C's):

    http://dev.w3.org/html5/spec-preview...cript-elements

    I could perhaps be interpreted that either:

    Code:
    * Visit Project Page at http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm for full source code
    together somehow closes the open multi-line comment, or that the * alone does (if so it would have been closed on an earlier line), or that:

    Code:
    * Visit Project Page at http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm for full source code
    just by itself closes the <script> tag.

    In the first cases (involving closing the multi-line comment) that just seems wrong because it's not how any script parser works, but it seems to best fit the error message that the validator gives.

    The last case would be more in keeping with the actual specs as I understand them, but should lead to a different error, one more like:

    Closing </script> tag while no script element is open
    Again though, no script parser does that. And I thought part of HTML 5 was to conform to what browsers are actually doing in cases like this.

    In fact, any text inside an external script tag is ignored by the script parser. You could put an uncommented:

    Code:
    alert('Hello World!');
    in there and it would do nothing, not be parsed as javascript.

    I don't think that should be part of the specification though. But this should be:

    An * must be followed immediately by a / to close a multi-line comment, and a / must be preceded by a < and followed by a case insensitive script> to close a script tag.
    Last edited by jscheuer1; 05-08-2013 at 06:00 PM. Reason: detail
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. HTML5 Notepad script
    By ready4data in forum Dynamic Drive scripts help
    Replies: 3
    Last Post: 06-20-2012, 01:57 PM
  2. HTML5 Notepad Script
    By brujo in forum Dynamic Drive scripts help
    Replies: 5
    Last Post: 11-03-2011, 02:40 AM
  3. Dynamic DriveŠ Marquee script optimized for HTML5
    By shotdsherrif in forum Dynamic Drive scripts help
    Replies: 4
    Last Post: 04-11-2011, 10:29 PM
  4. HTML5 Notepad - How to modify this script?
    By CyBeRaY in forum Dynamic Drive scripts help
    Replies: 3
    Last Post: 03-24-2011, 06:45 PM

Bookmarks

Posting Permissions

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