In what situation are you using the extension to add the stylesheet? Perhaps you could switch to using yepnope.js instead?
I agree that it should of course just give an self-closing tag but I suspect it's something in the .NET framework that is outputting it this way. But does that WCAG validation matter that much? I mean...does it affect the potential disabled users visiting the site...if it does of course then it should be fixed somehow. But if it does not affect real people but is just a validation tool that can't tell what's important or not then I don't really see the issue.
The WCAG issue does matter for the project sake (it was agreed that the project would be clean against WCAG errors). Although I agree, that this particular issue doesn't affect disabled usres much.
The YepNope script would be hard to use in our scenario because it involevs to much effort (especially in testing) as it's called from many diffirent templates (both XSLT and Razor).
I'll try to figure out what would be the best way to solve the problem programmatically.
RegisterStyleSheetFile breaks WCAG AA.
Hi.
When you call the umbraco.library.RegisterStyleSheetFile('MyStyle', 'mystyle.css') method, it produces the following markup:
<link id="ContentPlaceHolderDefault_MyStyle" rel="stylesheet" type="text/css" href="mystyle.css"></link>
That breaks WCAG AA standard with this message: "E603 An end tag is not allowed for this element."
Any thought on how to avoid the closing tag?
Hi Ivan
In what situation are you using the extension to add the stylesheet? Perhaps you could switch to using yepnope.js instead?
I agree that it should of course just give an self-closing tag but I suspect it's something in the .NET framework that is outputting it this way. But does that WCAG validation matter that much? I mean...does it affect the potential disabled users visiting the site...if it does of course then it should be fixed somehow. But if it does not affect real people but is just a validation tool that can't tell what's important or not then I don't really see the issue.
Hope this helps.
/Jan
Thanks, Jan.
The WCAG issue does matter for the project sake (it was agreed that the project would be clean against WCAG errors). Although I agree, that this particular issue doesn't affect disabled usres much.
The YepNope script would be hard to use in our scenario because it involevs to much effort (especially in testing) as it's called from many diffirent templates (both XSLT and Razor).
I'll try to figure out what would be the best way to solve the problem programmatically.
Hi Ivan
Ok, perhaps you can create your own XSLT extension to include the CSS then and make sure that the tag is closed correctly?
/Jan
Hi Jan.
What I did was calling the following method on Page_PreRender in Master template:
private void UncloseLinkTags() { var sw = new System.IO.StringWriter(); var hw = new HtmlTextWriter(sw); Page.Header.RenderControl(hw); Page.Header.InnerHtml = sw.GetStringBuilder().ToString().Replace("></link>", ">").Replace("<head>", "").Replace("</head>", ""); }That would do the trick and, most importantly, I had to make changes in a single place only.
Thanks for you help here!
Hi Ivan
Very happy to see you found a workaround and thanks for sharing so others can benefit from it :)
/Jan
is working on a reply...