W3C home > Mailing lists > Public > www-validator@w3.org > February 2008

Re: document type does not allow element "style" here

From: David Dorward <david@dorward.me.uk>
Date: Thu, 14 Feb 2008 19:09:14 +0000
Message-Id: <AAC91CF8-026D-40FF-B647-BBD8EE634A20@dorward.me.uk>
Cc: <www-validator@w3.org>
To: Jürgen Schmid <JueSchmid@t-online.de>
On 14 Feb 2008, at 12:17, Jürgen Schmid wrote:
> This module puts the following lines into the html:
> <script type="text/javascript">$("head").append("<style
> type='text/css'>form.rating{display:none}</style>");
> 	if ($.browser.safari){ $("head").find("style:last").append(" ")
> }</script>
> The validator tells me:
> Line 51, Column 71: document type does not allow element "style" here.

Given that particular error (which, as far as I know, should not  
occur in HTML since script elements contain CDATA) and that you are  
using Drupal, I'm going to hazard a guess that when you say "HTML"  
you mean "XHTML".

In which case read: http://www.w3.org/TR/xhtml1/#h-4.8 and http:// 
www.w3.org/TR/xhtml1/#C_4 noting "Use external scripts if your script  
uses <" (which your script does).

I'd also suggest http://www.webdevout.net/articles/beware-of-xhtml  
combined with a switch to HTML (which works in most user agents  
without having to jump through hoops to pretend it is HTML instead of  

David Dorward
Received on Thursday, 14 February 2008 19:09:46 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:30:57 UTC