Issue Details (XML | Word | Printable)

Key: MDL-7861
Type: Sub-task Sub-task
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Martin Dougiamas
Reporter: Martin Dougiamas
Votes: 0
Watchers: 4
Operations

If you were logged in you would be able to see more operations.
Moodle
MDL-7860

Strict XHTML 1.0

Created: 11/Dec/06 03:04 PM   Updated: 20/Dec/08 01:03 AM
Component/s: Accessibility
Affects Version/s: 1.7
Fix Version/s: 1.8

Issue Links:
Dependency
 
Relates
 

Participants: David Horat, Eloy Lafuente (stronk7), Martin Dougiamas, Nick Freear and Petr Škoda
Security Level: None
QA Assignee: Eloy Lafuente (stronk7)


 Description  « Hide
Terms: Create pages and objects thereon using technology defined by formal grammars published in the most recent versions available, when they are supported by user programs. Use elements and attributes so that they conform to specifications, respecting the semantic aspect. In particular, for HTML (HyperText Markup Language) markup languages and XHTML (eXtensible HyperText Markup Language):
a) for all new sites, use at least version 4.01 of HTML, or preferably version 1.0 of XHTM, in any case, with Strict DTD (Document Type Definition);
b) for existing sites, instead of the first application, where it is not possible to comply with point a), it shall be permitted to use the version of the above-mentioned languages with Transitional DTD, but with the following cautions:
1. avoid using, within the markup language in which the page is coded, elements and attributes to define the page's presentation characteristics (for example, characteristics of the text characters, colours of the text and the background, etc.), and use CSS (Cascading Style Sheets) to achieve the same graphic effect instead;
2. avoid generating new windows. Where this is not possible, explicitly warn the user of the change of focus;
3. plan the transition of the entire site to the Strict DTD version of the language used, informing the Prime Minister's Office - Department for Innovation and Technology, and the National Centre for Computing in Public Administration.

WCAG 1.0 References: 3.1, 3.2, 3.5, 3.6, 3.7, 11.1, 11.2
Sec. 508 References: None

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Nick Freear added a comment - 11/Dec/06 06:55 PM
My patch for MDL-7883 would help us move towards XHTML Strict. It would be useful to document which system (and pedagocical) standards Moodle conforms with, http://docs.moodle.org/en/Standards.

Martin Dougiamas added a comment - 12/Dec/06 03:10 PM
My major worry about using Strict is dealing with user-entered data.

How accessible is a web site that barfs the browser on every little missing character? Not very.

I think we are aiming here for option b) which is compliance with strict in all except name. So Nick's patch is very good for testing in strict and removing non-strict code from Moodle itself, but pages served to Moodle users in general should continue being labelled XHTML 1.0 Transitional, for usability reasons.

Does that sound reasonable to everyone?

Nick Freear added a comment - 15/Dec/06 01:32 AM
Hi martin. Thanks for using the patch so quickly :-) Did you purposefully leave out this bit out of the new function 'debug_header'?

+ if (debugging()) {
+ // Substitute document-type, s (PCRE_DOTALL)
+ $output = preg_replace('/(<!DOCTYPE.+?>)/s', $strict, $output);
+ }

I'm not sure I was clear explaining the patch - there are 2 separate issues:

1. Serving as 'application/xhtml+xml' (or application/xml in Win IE 5+) forces the browser into XHTML mode, where it 'barfs' (displays a parser error in place of the page) at you for XML-well formedness errors - not closing elements <p> </p>, not closing empty elements <img />, stray reserved characters & or < and so on. As you say, until we can consistently process user-entered data this would not be good for production mode, only for debugging.

2. Substituting the Strict document-type (code above), serving with either 'application/xhtml+xml' or 'text/html' does NOT cause the browser to 'barf' if you use a deprecated or non-standard element or attribute - something not in the DTD. You WILL get errors in the W3C validator, or a tool like HTML Validator for Firefox, http://users.skynet.be/mgueury/mozilla/, so again useful for debugging if we are going the 'Strict' route, not disastrous but not ideal in production mode.

Cheers Nick

Petr Škoda added a comment - 02/Jan/07 05:59 PM
I have noticed that the last change in weblib.php http://moodle.cvs.sourceforge.net/moodle/moodle/lib/weblib.php?r1=1.722&r2=1.723 broke validation because name and id attributes are not the same, committing fix, please review ;-)

Martin Dougiamas added a comment - 03/Jan/07 09:49 AM
Nick, my mistake, I did misunderstand this. It's nice to know that the barfing is optional :-)

I've brought that functionality back in, so that Moodle is currently:

1) Browser barfing on XHTML Strict errors in DEBUG_DEVELOPER debugging mode
2) Serving XHTML Strict normally in all other debugging modes
3) Serving XHTML Transitional in DEBUG_NONE mode (and we can look at making this strict later too)

Martin Dougiamas added a comment - 03/Jan/07 10:03 AM
Further correction to (3), it now serves STRICT even in DEBUG_NONE, at least until release.

Martin Dougiamas added a comment - 03/Jan/07 05:24 PM
WARNING: the HTML W3C Tidy browser extension is much more forgiving than the online W3C checker!

I've added some subtasks we might have missed.

Martin Dougiamas added a comment - 05/Jan/07 12:09 AM
Note that we are now definitely aiming for XHTML Strict 1.0 compliance!!!!

Martin Dougiamas added a comment - 08/Jan/07 07:58 PM
A great deal of work has been done on this recently, and Moodle it validating pretty well.

There are still a few corners here and there where errors may happen, but these sorts of errors do not cause browser problems OR accessibility problems.

Nevertheless, we continue to work on them.

Eloy Lafuente (stronk7) added a comment - 14/Jan/07 04:23 AM
Hi. Recently I added some minor changes in some scripts to be correct XML.

Well I was doing that I detected that a lot of lang-based strings contain the "forbidden" chars (quotes,ampersands...).

How are we going to handle them?

1) Converting all the lang files.
2) Processing them in get_string()...

Or am I wrong? Ciao :-)

Martin Dougiamas added a comment - 15/Jan/07 01:38 PM
I'm closing this bug because Moodle is validating pretty well now generally. We can file new bugs for anything new that comes up (such as the strings issue which seems to only affect some languages).

David Horat added a comment - 19/Dec/08 09:07 PM
I have found several validation errors at least in Moodle version: 1.9.3+ (19/12/2008). I will post them as comments in this issue.

David Horat added a comment - 19/Dec/08 09:22 PM
Help files (at least en_utf8) that do not comply with XHTML 1.0 Strict and the first error found for each file:

127.0.0.1/moodle/help.php?file=reading.html:124:37:3086136980.65:E: document type does not allow element "p" here; missing one of "object", "ins", "del", "map", "button" start-tag
127.0.0.1/moodle/help.php?file=text.html:123:32:3085817492.108:E: there is no attribute "align"
127.0.0.1/moodle/help.php?module=wiki&file=howtowiki.html:118:66:3086960276.108:E: there is no attribute "target"
127.0.0.1/moodle/help.php?module=data&file=usepreset.html:112:95:3087222420.108:E: there is no attribute "align"
127.0.0.1/moodle/help.php?module=data&file=participants.html:112:95:3087009428.108:E: there is no attribute "align"
127.0.0.1/moodle/help.php?module=moodle&file=textformat.html:137:4:3087730324.79:E: end tag for element "ul" which is not open
127.0.0.1/moodle/help.php?module=wiki&file=htmlmode.html:115:3:3087165076.65:E: document type does not allow element "dl" here; missing one of "object", "ins", "del", "map", "button" start-tag
127.0.0.1/moodle/help.php?module=data&file=savepreset.html:112:95:3087554196.108:E: there is no attribute "align"
127.0.0.1/moodle/help.php?module=data&file=fields.html:112:95:3087738516.108:E: there is no attribute "align"
127.0.0.1/moodle/help.php?file=participantswithselectedusers.html:113:9:3086415508.108:E: there is no attribute "align"
127.0.0.1/moodle/help.php?module=resource&file=window.html:127:4:3086124692.65:E: document type does not allow element "b" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag

David Horat added a comment - 19/Dec/08 10:48 PM
Sorry for opening this issue. I reopened it as a new bug in: MDL-17697, MDL-17698, etc.

Eloy Lafuente (stronk7) added a comment - 20/Dec/08 01:03 AM
Closing this. Let's go to related bugs... thanks!