1

Topic: HTML5 - Deprecated Tags & Attributes

Hi

I'm using htmLawed 1.2.beta.8

Having problesm with HTML5 and the following:

<table width="100%" cellspacing="4" cellpadding="4">

Width, cellspacing, and cellpadding attributes for <table> are not supported in HTML5

No $options combo fixes this. Do you plan to amend `no_deprecated_attr` and `make_tag_strict` to deal with HTML5? Or am I missing something?

@see:
http://www.tutorialspoint.com/html5/html5_deprecated_tags.htm

2

Re: HTML5 - Deprecated Tags & Attributes

After squinting very hard while reading the following docs:

+ 2.3 - Extra HTML specifications using the $spec parameter
+ 3.4.6 -  Transformation of deprecated attributes
+ 3.3.2  - Tag-transformation for better compliance with standards
+ HTML5 - Deprecated Tags & Attributes

I've come up with the following $spec to compliment the $config. A sort of venn diagram join between XTHML + HTML5.

$config = array(
    'valid_xhtml' => 1,
    'no_deprecated_attr' => 2,
    'make_tag_strict' => 2,
);

$spec = '';
$spec .= 'a=,-charset,-coords,-rev,-shape;';
$spec .= 'area=-nohref;';
$spec .= 'col=-align,-char,-charoff,-valign,-width;';
$spec .= 'colgroup=-align,-char,-charoff,-valign,-width;';
$spec .= 'div=-align;';
$spec .= 'iframe=-align,-frameborder,-longdesc,-marginheight,-marginwidth,-scrolling;';
$spec .= 'img=-longdesc;';
$spec .= 'li=-type;';
$spec .= 'link=-charset,-rev,-target;';
$spec .= 'menu=-compact;';
$spec .= 'object=-archive,-classid,-codebase,-codetype,-declare,-standby;';
$spec .= 'ol=-type;';
$spec .= 'param=-type,-valuetype;';
$spec .= 't=-abbr,-axis;';
$spec .= 'table=-border,-cellspacing,-cellpadding,-frame,-rules,-width;';
$spec .= 'tbody=-align,-char,-charoff,-valign;';
$spec .= 'td=-axis,-abbr,-align,-char,-charoff,-scope,-valign;';
$spec .= 'tfoot=-align,-char,-charoff,-valign;';
$spec .= 'th=-align,-char,-charoff,-valign;';
$spec .= 'thead=-align,-char,-charoff,-valign;';
$spec .= 'tr=-align,-char,-charoff,-valign;';
$spec .= 'ul=-type;';

$html = htmLawed( $html, $config, $spec );

Hope this helps someone.

3

Re: HTML5 - Deprecated Tags & Attributes

Thank you for pointing out that those attributes for 'table' are deprecated in HTML5. I will release a new version sometime this month to address this by amending the implementations for the 'no_deprecated_attr' and 'make_tag_strict' options. The '$spec' approach you have suggested is good.

4

Re: HTML5 - Deprecated Tags & Attributes

Whoops. Remove `ol` and `li` from the $spec. According to the W3C:

+ The start attribute on the ol element was deprecated in a previous version of HTML, but is no longer deprecated, as it has meaning and is not simply presentational.

Source:
http://www.w3.org/TR/html-markup/ol.html

`ul` stays:

Source:
http://www.w3.org/TR/html-markup/ul.html

5

Re: HTML5 - Deprecated Tags & Attributes

A new version of htmLawed 1.2 beta (1.2.beta.9, 30 October 2015) that can transform the deprecated 'width' and 'cellspacing' attributes of 'table' has been released. See bioinformatics.org/phplabware/internal_utilities/htmLawed/beta/.

Transformation for the deprecated 'cellpadding' has not been implemented and may be 'impossible' because the CSS property resulting during the transformation has to be put in the table's 'td' elements and not in 'table' element itself.

Work on transformation for other attributes that are deprecated in HTML5 continues. The use of '$spec' as noted by conner_bw is a good measure that can be used right now