Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Brendan Rice 538 posts 1102 karma points
    Jan 10, 2011 @ 16:15
    Brendan Rice
    0

    Possible bug in umbraco.library:RegisterStyleSheetFile (please confirm)

    I have the following declaration in an xslt file:

    <xsl:value-of select="umbraco.library:RegisterStyleSheetFile('ombCss', '/css/openMoreBusiness.css')"/>

    Which outputs the following:

    <link id="openMoreBusinessCss" rel="stylesheet" type="text/css" href="/css/openMoreBusiness.css"></link>


    This doesn't validate against the W3C HTML checker for the following doctype:

    <!DOCTYPE html>

    What it should probably look like is:

    <link id="openMoreBusinessCss" rel="stylesheet" type="text/css" href="/css/openMoreBusiness.css"/>

    Any ideas if this is a bug or not?

  • Rasmus Berntsen 215 posts 253 karma points c-trib
    Jan 11, 2011 @ 03:33
    Rasmus Berntsen
    0

    Looks like it's a bug but actually it validates for me...?

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >

    ...

    <head>

    <link id="ctl00_ctl00_style" rel="stylesheet" type="text/css" href="/scripts/colorbox/colorbox.css"></link>

    <head>

    =

    "This document was successfully checked as XHTML 1.0 Transitional!"

  • Sebastiaan Janssen 5061 posts 15544 karma points MVP admin hq
    Jan 11, 2011 @ 09:11
    Sebastiaan Janssen
    0

    Both the self-closing and the close version of the <link> tag are valid XHTML 1.0 strict. Brendan: Are you sure you are using the correct doctype?

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    

    In your masterpage, make sure to stick the doctype declaration next to the asp:content tag, a bit like so:

    <asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    That way, the doctype will be rendered on the very first line of your html, which is required.

  • Kim Andersen 1447 posts 2197 karma points MVP
    Jan 11, 2011 @ 13:03
    Kim Andersen
    2

    @Berntsen and Sebastian:

    You guys both validate against another doc type than Brendan. The doctype that Brendan is talking about is the HTML5 doc type:

    <!DOCTYPE html>

    I just tried this as well, and the code won't validate with the HTML5 doc type. But I'm not sure I would call it a bug, because I guess that when the extension was created, no one knew/thought of the "new" HTML5 doc type.

    /Kim A

  • Rasmus Berntsen 215 posts 253 karma points c-trib
    Jan 11, 2011 @ 13:09
    Rasmus Berntsen
    0

    Kim: Ahhh, I see... Furthermore I think a self-closing link-tag looks much nicer. Thanks for the heads up. :)

  • Brendan Rice 538 posts 1102 karma points
    Jan 11, 2011 @ 13:14
    Brendan Rice
    0

    I still think it should be changed to be a self closing tag if this is going to cause issues for HTML 5 would you agree?

    How would I go about raising this change?

  • Sebastiaan Janssen 5061 posts 15544 karma points MVP admin hq
    Jan 11, 2011 @ 14:20
    Sebastiaan Janssen
    0

    Create a codeplex issue, this is the line that needs to be changed (\umbraco\presentation\library.cs in the RegisterStyleSheetFile method):

    p.ClientScript.RegisterClientScriptBlock(p.GetType(), key, "<link rel='stylesheet' href='" + url + "' />");

    Should be changed to:

    p.ClientScript.RegisterClientScriptBlock(p.GetType(), key, "<link rel='stylesheet' href='" + url + "'></link>");

     

    For the time being, if you need this, you could just base your own RegisterStyleSheetFile XSLT extension on this one of course.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies