My favorites | Sign in
Project Logo
             
New issue | Search
for
| Advanced search | Search tips
Issue 25: produced html stirct is not valid
10 people starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----
Type-Defect
Priority-Medium


Sign in to add a comment
 
Reported by dr0iddr0id, Aug 15, 2007
What steps will reproduce the problem?
1. http://validator.w3.org/check
2. fails
3.

What is the expected output? What do you see instead?
validating html strict, a failing error

What version of the product are you using? On what operating system?
1.5.1

Please provide any additional information below.

To write validating html stirct a "name" attribute is not allowed in the
<pre> tag. Therefore this script should not use that attribute to identify
the code to modify. I have solved using just the class attribute, but
perhaps you find a better solution.
I would appreciate it if it could be used in a validating document.
Otherwise it is a good tool. Thank you!

~DR0ID
Comment 1 by viper007bond, Sep 06, 2007
Yeah, probably something along these lines would be best:

<pre class="shcode php">Code!</pre>
Comment 2 by mhavila, Oct 21, 2007
Instead of use the NAME attribute, invalid for HTML and XHTML strict, to identify
SyntaxHighlighter tags, plus a class attribute to define its options, I propose a
new, unified class attribute format to both identify and define syntax highlighting:

<pre class="... syntax-highlight:language:options ..."> ... </pre>

<textarea class="... syntax-highlight:language:options ..."> ... </textarea>

A working proposal was done (uncompressed JavaScript) at:
http://www.mhavila.com/syntax/js/shCode.js

And a simple test can be view and validate at:
http://www.mhavila.com/syntax_test.html

Attached is the modified version of shCore.js.
shCore.js
19.1 KB   Download
Comment 3 by ccodling, Feb 13, 2008
The name attribute is perfectly valid in a textarea element, just use that instead!

Comment 4 by sundrivedesign, Feb 24, 2008
I'd rather propose a convention like this:

<pre class="code">
	<code class="html">
		<!-- code sample goes here -->
	</code>
</pre>

This would create proper namespaces in the HTML/XHTML document straight from the beginning both for all 
possible cases of pre instances and code instances.

( Makes at also easier to handle Users, who have Javascript switched off)
	
Comment 5 by sundrivedesign, Feb 24, 2008
Regarding the name attribute:

What I now did, to have a valid XHTML document is just replace the name attribute with a title attribute
(Which is valid)
As a workaround, so to speak.
Comment 6 by jammycakes, May 22, 2008
I think that semantically, sundrivedesign's first proposal is probably the best,
especially for users without JavaScript and/or screen readers. IMO textarea is a
hack, and doesn't the title attribute get read out by screen readers, which may not
be what you want?
Comment 7 by dunglas, Jul 23, 2008
I think syntaxhighlighter must use the language-* value for the class attribute like
this :
<pre><code class="language-javascript"></code></pre>

The class="language-LANGNAME" attribute is a part of (the draft of) the HTML5
specification and is compatible with backward compatible with the currents versions
of HTML and XHTML.

Please make syntaxhighlighter as standard compliant as possible :)

See http://code.google.com/p/syntaxhighlighter/issues/detail?id=91 to know why use
<code> instead of <pre>.
Comment 8 by docwhat, Jul 24, 2008
dunglas: That's good to know.  Can you point at the HTML5 draft section about this?
Comment 9 by kalekold, Nov 23, 2008
Would be better to use the 'id' attribute and to change line 618 in shCore.js to 

if(tags[i].getAttribute('id') == name)
Sign in to add a comment

Hosted by Google Code