Error: document type does not allow element "style" here
hass - May 27, 2007 - 22:31
| Project: | jRating |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | hickory |
| Status: | active |
Description
There should be no XHTML validation errors like Error: document type does not allow element "style" here.
<noscript><style type="text/css">form.rating{ display: block; }</style></noscript></body>
#1
additional this tag is added independently of a voting box is displayed or not, what makes no sense. only add this code if the voting box is added to the page.
#2
It's added by jrating_footer: is there a way to tell whether a rating widget has been added to the page in hook_footer? Could look in the array of files added by drupal_add_js, perhaps...
I can't think of a better way to display the block when javascript is disabled, so it'll have to be invalid XHTML for now.
#3
i'm sure it is possible - i will try to find a solution next week and provide a patch if found.
For me the current module cannot be used, while i advertise my 20 themes as 100% error and warning free XHTML complicant code and i cannot break with this... no way.
#4
take a look to fivestar rating, please. they solved this well in the following way:
if (strpos(drupal_get_js(), "jQuery('input.fivestar-submit').hide()") === FALSE) {drupal_add_js("jQuery(function(){jQuery('input.fivestar-submit').hide();});", 'inline');
}
So you should change jratings code to display the selectbox everytime and if JS is enabled it will hide... and XHTML code will be valid.
#5
I'll give that a try, but I'm not sure whether it'll work fast enough to hide the form before it's displayed...
#6
hello
is there something new?
thanks and greetings
momper
#7
#8
Automatically closed -- issue fixed for two weeks with no activity.
#9
I am running the Version of 2007-Dec-04 ant get se same validation error from http://validator.w3.org/check: document type does not allow element "style" here.
The code in HTML-Page is in the header:
$("head").append("form.rating{display:none}");
if ($.browser.safari){ $("head").find("style:last").append(" ") }
Please help!
#10
smitty: do you have a page I can look at with this problem?
#11
@hickory: I sent you an e-mail this morning.
#12
I replaced the the jrating.module with the one of the version 2007-Nov-23.
There I do not get a validation error.
So it must have something to do with:
function jrating_footer($main = FALSE){drupal_add_js(
'$("head").append("<style type=\'text/css\'>form.rating{display:none}</style>");
if ($.browser.safari){ $("head").find("style:last").append(" ") }',
'inline', 'header');
// have to append the contents otherwise safari doesn't recognise it
putting
<script type="text/javascript">$("head").append("<style type='text/css'>form.rating{display:none}</style>");if ($.browser.safari){ $("head").find("style:last").append(" ") }</script>
into the html-header. Please have a look at the validation output in the attachment.
#13
You can ignore that, it's a bug in the validator.
#14
Thanks’ for this information. Is this bug documented anywhere? Will this be fixed in the validator?
I tried some other validators. But every validator I found via Google showed the same validation message.
Do you know a validator which works properly?
#15
Just ignore it, it really doesn't matter.
#16
Sorry, I really don't want to bother you. I'm only looking for an explanation for my customers, who expect a 100% error-free site.
#17
You should file a bug report with the validator, in that case.
#18
I posted this problem on the w3-validator-mailing-list: http://lists.w3.org/Archives/Public/www-validator/2008Feb/0036.html
Here is a summary what I got back:
- The sript is ok.
- The validator is ok.
- The problem is the validation of the script inside an HTML file.
E.g. Rui del-Negro wrote:
So, why don't you create a function (e.g. in the "jrating.js") and execute that function to get the work done?
#19
I'm sure there was a reason why it was set up this way, but can't remember what it was any more, so maybe it should move into jrating.js.