These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:03 pm Advanced search

noscript element should not be in the head element

Do you think the HTML spec should do something differently? You can discuss spec feedback here, but you should send it to the WHATWG mailing list or file a bug in the W3C bugzilla for it to be considered.

noscript element should not be in the head element

Postby JAB Creations » Mon Apr 05, 2010 3:19 pm

I used http://validator.nu/ to validate the latest iteration of my work which it decided to validate as XHTML5 when it's XHTML 1.1. I received a couple errors though the noscript error was actually quite shocking. There is absolutely no point in restricting the noscript element to being a child of the head element, to what? Load a different style sheet to say load a background image to an element to tell the person to enable scripting?

If anything the script element should be restricted to the head element. The noscript element can not display content alerting the user to enable JavaScript if it is limited to the head element. I see absolutely no logic in how HTML5 has this currently setup...

http://www.whatwg.org/specs/web-apps/cu ... pt-element
User avatar
JAB Creations
<aside>
 
Posts: 566
Joined: Tue Mar 13, 2007 4:48 am
Location: Sarasota Florida, USA

Re: noscript element should not be in the head element

Postby zcorpan » Mon Apr 05, 2010 8:19 pm

JAB Creations wrote:I used http://validator.nu/ to validate the latest iteration of my work which it decided to validate as XHTML5 when it's XHTML 1.1.
"In the generic facet, the parser will be chosen based on the HTTP Content-Type and a preset schema will be chosen based on the root namespace (for XML) or the doctype (for text/html)."
-- http://about.validator.nu/

You can select which schema to validate against yourself from the UI if you're not happy with the default behavior.

JAB Creations wrote:I received a couple errors though the noscript error was actually quite shocking. There is absolutely no point in restricting the noscript element to being a child of the head element, to what?
It's not restricted to the head element. It's allowed here:
"In a head element of an HTML document, if there are no ancestor noscript elements."
OR
"Where phrasing content is expected in HTML documents, if there are no ancestor noscript elements."

Note "HTML document", which means it's not allowed at all anywhere in XHTML. The validator should probably have a clearer message for this. File a bug? http://bugzilla.validator.nu/

JAB Creations wrote:If anything the script element should be restricted to the head element.
Why?
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby JAB Creations » Mon Apr 05, 2010 10:12 pm

What's the point of having the noscript element in HTML5 but not XHTML5? :roll:

Nothing has degraded JavaScript more then sticking script elements inside of the body element except maybe arguably the rise of JavaScript frameworks. If you don't agree then have a look at how they're generally implemented; old script code for old browsers no one uses, "run onload here" scripts instead of using the onload event..etc, "trash scripting" I suppose would be the best term. Then add to the fact that not all sites use templates and the code tends to be uselessly duplicated and bulks pages up unnecessarily.

So HTML documents can launch a noscript element layer to tell users to enable JavaScript though if you're using the better XML format you can't? I mean what in the world are you going to do with a noscript element inside of the head element? Who has been responsible for making these kind of decisions? :|
User avatar
JAB Creations
<aside>
 
Posts: 566
Joined: Tue Mar 13, 2007 4:48 am
Location: Sarasota Florida, USA

Postby zcorpan » Tue Apr 06, 2010 2:46 pm

JAB Creations wrote:What's the point of having the noscript element in HTML5 but not XHTML5? :roll:
The point is that it works in HTML but not in XHTML.

JAB Creations wrote:So HTML documents can launch a noscript element layer to tell users to enable JavaScript though if you're using the better XML format you can't?
Sure you can, you just can't use the noscript element to do it. The spec has an example with a better way to do it.

JAB Creations wrote:I mean what in the world are you going to do with a noscript element inside of the head element?
You can link in a style sheet or do a meta redirect.
JAB Creations wrote:Who has been responsible for making these kind of decisions? :|
What decision?
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby JAB Creations » Tue Apr 06, 2010 4:08 pm

I'm not opposed to having a noscript element inside of the head element though it would be quicker to do what I currently do: show a layer above everything telling the user they need to enabled scripting. Using a meta redirect is a waste of resources in my opinion.

Why the need to do two different things in the standard between the two parent technologies?
User avatar
JAB Creations
<aside>
 
Posts: 566
Joined: Tue Mar 13, 2007 4:48 am
Location: Sarasota Florida, USA

Postby zcorpan » Wed Apr 07, 2010 8:21 am

JAB Creations wrote:Why the need to do two different things in the standard between the two parent technologies?

http://forums.whatwg.org/viewtopic.php?t=38
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby JAB Creations » Wed Apr 07, 2010 9:54 am

Scripting enabled, don't show it.

Scripting disabled, show it.

What's so difficult about that?

So what...now we'll have to replace existing noscript elements with a div and then hide it with JavaScript so it'll still appear even if scripting is enabled flashing for a second before disappearing...does the XHTML5 author really think a browser does not understand when scripting is enabled or disabled? I still see absolutely no valid argument for moving the noscript element explicitly to the head element.
User avatar
JAB Creations
<aside>
 
Posts: 566
Joined: Tue Mar 13, 2007 4:48 am
Location: Sarasota Florida, USA

Postby zcorpan » Wed Apr 07, 2010 3:18 pm

JAB Creations wrote:Scripting enabled, don't show it.

Scripting disabled, show it.

What's so difficult about that?
Nothing is difficult with showing. The 'difficult' part is parsing. In HTML, noscript is parsed differently depending on whether scripting is enabled or not. In XML, you can't really change the parser and still claim to use XML.

JAB Creations wrote:I still see absolutely no valid argument for moving the noscript element explicitly to the head element.
I think the head element thing has got you confused. There's no moving it to the head element.

* In HTML, noscript is allowed both in head and in body.
* In XHTML, noscript is not allowed anywhere (since parsing is not affected by the scripting enabled flag, it doesn't have the desired effect)
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby JAB Creations » Wed Apr 07, 2010 3:49 pm

The noscript element has worked perfectly fine on my site for years. I don't see the issue with parsing...if scripting is disabled then it's essentially a div element by a different name and it's displayed. How in any way is that difficult?
User avatar
JAB Creations
<aside>
 
Posts: 566
Joined: Tue Mar 13, 2007 4:48 am
Location: Sarasota Florida, USA

Postby zcorpan » Thu Apr 08, 2010 7:41 am

JAB Creations wrote:The noscript element has worked perfectly fine on my site for years. I don't see the issue with parsing...

Consider:
Code: Select all
<noscript><style> html { background:red } </style></noscript>

In HTML, this works as expected (style is not applied when scripting is enabled) because the parser interprets the contents of noscript as plain text when scripting is enabled. In XHTML, it will be parsed the same way whether scripting is enabled or not, so the style is always applied.
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby JAB Creations » Thu Apr 08, 2010 4:05 pm

But the browser knows when scripting is enabled or disabled; how does that not play in to the situation?
User avatar
JAB Creations
<aside>
 
Posts: 566
Joined: Tue Mar 13, 2007 4:48 am
Location: Sarasota Florida, USA

Postby zcorpan » Thu Apr 08, 2010 5:09 pm

The XML spec only allows one way of parsing.
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby JAB Creations » Thu Apr 08, 2010 5:13 pm

Then just have the browser hide the noscript element from the XML parser when scripting is enabled. The browser creates a DOM image of the page any way.
User avatar
JAB Creations
<aside>
 
Posts: 566
Joined: Tue Mar 13, 2007 4:48 am
Location: Sarasota Florida, USA

Postby zcorpan » Fri Apr 09, 2010 8:26 am

JAB Creations wrote:Then just have the browser hide the noscript element from the XML parser when scripting is enabled.

That would not be compliant with XML.
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby JAB Creations » Fri Apr 09, 2010 1:10 pm

How? Why not?
User avatar
JAB Creations
<aside>
 
Posts: 566
Joined: Tue Mar 13, 2007 4:48 am
Location: Sarasota Florida, USA

Next

Return to Feedback on the Specs

Who is online

Users browsing this forum: No registered users and 1 guest