Forum OpenACS Development: HTML Strict as default DTD

Collapse
Posted by Emmanuelle Raffenne on
Hi all,

I've finished the work to switch to HTML Strict and committed to HEAD. I've done the validation check for users pages and unless I've missed any, they're all valid HTML 4.01 Strict (administration pages have not been done).

There's a summary of the differences between Strict and Transitional at http://24ways.org/2005/transitional-vs-strict-markup

Here is a list of the changes I had to do:

- INPUT, IMG, BR should NOT have a trailing "/".
- INPUTs have to be wrapped by a block tag (DIV, P, H)
- SCRIPT: the language attribute is not allowed anymore, use type attribute instead.
- Allways use quotes for the value of HREF and any literal value of attributes.
- IMG: border attribute is no longer allowed, put it in style or better in stylesheets.
- TD: same for width attribute, has to go in the style one or in stylesheets.
- FORM: enclose it with DIV tags (ad_form takes care of that)
- OL: start attibute no longer allowed. This one is a bit tricky if you want to control the start value of the ordered list and that value is a variable. Here's an example:

# in the HTML
<ol style="counter-reset:item @offset@">

# in the CSS LI { display:block; }

LI:before { content: counter(item) ". "; counter-increment: item; }

- FONT, CENTER: no longer allowed, have to go in style attribute of the block or in stylesheets.
- align attribute: has to go in the style attribute of the outer block or in stylesheets.

We'll work on the rest of packages for dotLRN in the next weeks.

Collapse
Posted by Tom Jackson on
Looking at the strict DTD, FORM elements can only contain block elements or script elements, so it isn't just that INPUTs must be wrapped in a block element, you can't have any text or other inline content as direct children to FORM.

This is also true of BODY! And OL/UL can only have whitespace and LI content.

I'm not sure why you have to enclose a form in a DIV, how did that happen?

It also looks like A tags require a closing tag.

Something else which shows up on pages with user provided content, like in this forum is BLOCKQUOTE. This tag can't have inline content, you have to use another block level tag.

I've done some tests for simple forms, what works and doesn't:

http://junom.com/document/html/strict/

The failed HTML is under failed/.

Collapse
Posted by Emmanuelle Raffenne on
Hi Tom,

Thanks for completing the list and your tests.

Regarding forms, form builder takes care of everything so it is strongly recommended to use it. Actually it was already html strict compliant except for hidden fields that I had to wrap into DIV.

Collapse
Posted by Tom Jackson on
It looks like HTML 4.01 Strict is very useful. I noted the above points because I usually violate them, while at the same time, adding things which are not required. The DTD is relatively easy to read, and W3 has a link on their home page to validate any page you would like to test. But my old habits will be hard to overcome.

For instance, closing tags for LI and P are optional.

I'm still interested in the details of the choices for FORM.

Why did it need to be wrapped in a DIV? This doesn't appear to have anything to do with the requirements for Strict.

Another question is using a DIV to wrap the hidden inputs.

Are you providing a class for this DIV so that users can ensure that it doesn't contribute to any additional whitespace, indents or whatever? It seems like it would be helpful to have a generic class for this type of application.

I'll try to provide some additional examples.

Collapse
Posted by Emmanuelle Raffenne on
Hi Tom,

I'm not sure the need to wrap form in a DIV (or other block tag) has anything to do with Strict.

About the DIV for hidden inputs, there's no class for them so far (and no additional whitespace nor indents either in my testing).

What do you mean by "I'm still interested in the details of the choices for FORM"?