You are not logged in.

#1 2004-12-03 18:02:35

DewiMorgan
TWG Member
From: London, UK
Registered: 2004-12-01
Posts: 65
Website

Tip: full XHTML validation.

The following will validate that the page complies fully with the XHTML specification.

It's long, it's ugly, but it should also be complete. Browser-specific extensions are not listed here. This is deliberate.

[edit: for <input type="xxx"> , xxx must be lowercase.]
[edit: out of consideration for people's sanity, I wrapped it to 80 cols. I *love* having a text editor that does regexp search/replace! smile]

Code:

verify_html : true,
valid_elements : ""
+"a[accesskey|charset|class|coords|dir<ltr?rtl|href|hreflang|id|lang|name"
  +"|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup"
  +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rel|rev"
  +"|shape<circle?default?poly?rect|style|tabindex|title|target|type],"
+"abbr[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
  +"|title],"
+"acronym[class|dir<ltr?rtl|id|id|lang|onclick|ondblclick|onkeydown|onkeypress"
  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
  +"|title],"
+"address[class|align|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
  +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
  +"|onmouseup|style|title],"
+"applet[align<bottom?left?middle?right?top|alt|archive|class|code|codebase"
  +"|height|hspace|id|name|object|style|title|vspace|width],"
+"area[accesskey|alt|class|coords|dir<ltr?rtl|href|id|lang|nohref<nohref"
  +"|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup"
  +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup"
  +"|shape<circle?default?poly?rect|style|tabindex|title|target],"
+"base[href|target],"
+"basefont[color|face|id|size],"
+"bdo[class|dir<ltr?rtl|id|lang|style|title],"
+"big[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
  +"|title],"
+"blockquote[dir|style|cite|class|dir<ltr?rtl|id|lang|onclick|ondblclick"
  +"|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout"
  +"|onmouseover|onmouseup|style|title],"
+"body[alink|background|bgcolor|class|dir<ltr?rtl|id|lang|link|onclick"
  +"|ondblclick|onkeydown|onkeypress|onkeyup|onload|onmousedown|onmousemove"
  +"|onmouseout|onmouseover|onmouseup|onunload|style|title|text|vlink],"
+"br[class|clear<all?left?none?right|id|style|title],"
+"button[accesskey|class|dir<ltr?rtl|disabled<disabled|id|lang|name|onblur"
  +"|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown"
  +"|onmousemove|onmouseout|onmouseover|onmouseup|style|tabindex|title|type"
  +"|value],"
+"caption[align<bottom?left?right?top|class|dir<ltr?rtl|id|lang|onclick"
  +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
  +"|onmouseout|onmouseover|onmouseup|style|title],"
+"center[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
  +"|title],"
+"cite[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
  +"|title],"
+"code[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
  +"|title],"
+"col[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id"
  +"|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown"
  +"|onmousemove|onmouseout|onmouseover|onmouseup|span|style|title"
  +"|valign<baseline?bottom?middle?top|width],"
+"colgroup[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl"
  +"|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown"
  +"|onmousemove|onmouseout|onmouseover|onmouseup|span|style|title"
  +"|valign<baseline?bottom?middle?top|width],"
+"dd[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup"
  +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],"
+"del[cite|class|datetime|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
  +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
  +"|onmouseup|style|title],"
+"dfn[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
  +"|title],"
+"dir[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
  +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
  +"|onmouseup|style|title],"
+"div[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
  +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
  +"|onmouseout|onmouseover|onmouseup|style|title],"
+"dl[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
  +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
  +"|onmouseup|style|title],"
+"dt[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup"
  +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],"
+"em/i[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
  +"|title],"
+"fieldset[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
  +"|title],"
+"font[class|color|dir<ltr?rtl|face|id|lang|size|style|title],"
+"form[accept|accept-charset|action|class|dir<ltr?rtl|enctype|id|lang"
  +"|method<get?post|name|onclick|ondblclick|onkeydown|onkeypress|onkeyup"
  +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onreset|onsubmit"
  +"|style|title|target],"
+"frame[class|frameborder|id|longdesc|marginheight|marginwidth|name"
  +"|noresize<noresize|scrolling<auto?no?yes|src|style|title],"
+"frameset[class|cols|id|onload|onunload|rows|style|title],"
+"h1[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
  +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
  +"|onmouseout|onmouseover|onmouseup|style|title],"
+"h2[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
  +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
  +"|onmouseout|onmouseover|onmouseup|style|title],"
+"h3[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
  +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
  +"|onmouseout|onmouseover|onmouseup|style|title],"
+"h4[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
  +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
  +"|onmouseout|onmouseover|onmouseup|style|title],"
+"h5[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
  +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
  +"|onmouseout|onmouseover|onmouseup|style|title],"
+"h6[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
  +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
  +"|onmouseout|onmouseover|onmouseup|style|title],"
+"head[dir<ltr?rtl|lang|profile],"
+"hr[align<center?left?right|class|dir<ltr?rtl|id|lang|noshade<noshade|onclick"
  +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
  +"|onmouseout|onmouseover|onmouseup|size|style|title|width],"
+"html[dir<ltr?rtl|lang|version],"
+"iframe[align<bottom?left?middle?right?top|class|frameborder|height|id"
  +"|longdesc|marginheight|marginwidth|name|scrolling<auto?no?yes|src|style"
  +"|title|width],"
+"img[align<bottom?left?middle?right?top|alt|border|class|dir<ltr?rtl|height"
  +"|hspace|id|ismap<ismap|lang|longdesc|name|onclick|ondblclick|onkeydown"
  +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
  +"|onmouseup|src|style|title|usemap|vspace|width],"
+"input[accept|accesskey|align<bottom?left?middle?right?top|alt"
  +"|checked<checked|class|dir<ltr?rtl|disabled<disabled|id|ismap<ismap|lang"
  +"|maxlength|name|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress"
  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onselect"
  +"|readonly<readonly|size|src|style|tabindex|title"
  +"|type<button?checkbox?file?hidden?image?password?radio?reset?submit?text"
  +"|usemap|value],"
+"ins[cite|class|datetime|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
  +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
  +"|onmouseup|style|title],"
+"isindex[class|dir<ltr?rtl|id|lang|prompt|style|title],"
+"kbd[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
  +"|title],"
+"label[accesskey|class|dir<ltr?rtl|for|id|lang|onblur|onclick|ondblclick"
  +"|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout"
  +"|onmouseover|onmouseup|style|title],"
+"legend[align<bottom?left?right?top|accesskey|class|dir<ltr?rtl|id|lang"
  +"|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
  +"|onmouseout|onmouseover|onmouseup|style|title],"
+"li[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup"
  +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|type"
  +"|value],"
+"link[charset|class|dir<ltr?rtl|href|hreflang|id|lang|media|onclick"
  +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
  +"|onmouseout|onmouseover|onmouseup|rel|rev|style|title|target|type],"
+"map[class|dir<ltr?rtl|id|lang|name|onclick|ondblclick|onkeydown|onkeypress"
  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
  +"|title],"
+"menu[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
  +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
  +"|onmouseup|style|title],"
+"meta[content|dir<ltr?rtl|http-equiv|lang|name|scheme],"
+"noframes[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
  +"|title],"
+"noscript[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
  +"|title],"
+"object[align<bottom?left?middle?right?top|archive|border|class|classid"
  +"|codebase|codetype|data|declare|dir<ltr?rtl|height|hspace|id|lang|name"
  +"|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
  +"|onmouseout|onmouseover|onmouseup|standby|style|tabindex|title|type|usemap"
  +"|vspace|width],"
+"ol[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
  +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
  +"|onmouseup|start|style|title|type],"
+"optgroup[class|dir<ltr?rtl|disabled<disabled|id|label|lang|onclick"
  +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
  +"|onmouseout|onmouseover|onmouseup|style|title],"
+"option[class|dir<ltr?rtl|disabled<disabled|id|label|lang|onclick|ondblclick"
  +"|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout"
  +"|onmouseover|onmouseup|selected<selected|style|title|value],"
+"p[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
  +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
  +"|onmouseout|onmouseover|onmouseup|style|title],"
+"param[id|name|type|value|valuetype<DATA?OBJECT?REF],"
+"pre/listing/plaintext/xmp[align|class|dir<ltr?rtl|id|lang|onclick|ondblclick"
  +"|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout"
  +"|onmouseover|onmouseup|style|title|width],"
+"q[cite|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
  +"|title],"
+"s[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup"
  +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],"
+"samp[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
  +"|title],"
+"script[charset|defer|language|src|type],"
+"select[class|dir<ltr?rtl|disabled<disabled|id|lang|multiple<multiple|name"
  +"|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup"
  +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|size|style"
  +"|tabindex|title],"
+"small[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
  +"|title],"
+"span[align|class|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
  +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
  +"|onmouseup|style|title],"
+"strike[class|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
  +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
  +"|onmouseup|style|title],"
+"strong/b[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
  +"|title],"
+"style[dir<ltr?rtl|lang|media|title|type],"
+"sub[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
  +"|title],"
+"sup[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
  +"|title],"
+"table[align<center?left?right|bgcolor|border|cellpadding|cellspacing|class"
  +"|dir<ltr?rtl|frame|height|id|lang|onclick|ondblclick|onkeydown|onkeypress"
  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rules"
  +"|style|summary|title|width],"
+"tbody[align<center?char?justify?left?right|char|class|charoff|dir<ltr?rtl|id"
  +"|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown"
  +"|onmousemove|onmouseout|onmouseover|onmouseup|style|title"
  +"|valign<baseline?bottom?middle?top],"
+"td[abbr|align<center?char?justify?left?right|axis|bgcolor|char|charoff|class"
  +"|colspan|dir<ltr?rtl|headers|height|id|lang|nowrap<nowrap|onclick"
  +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
  +"|onmouseout|onmouseover|onmouseup|rowspan|scope<col?colgroup?row?rowgroup"
  +"|style|title|valign<baseline?bottom?middle?top|width],"
+"textarea[accesskey|class|cols|dir<ltr?rtl|disabled<disabled|id|lang|name"
  +"|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup"
  +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onselect"
  +"|readonly<readonly|rows|style|tabindex|title],"
+"tfoot[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id"
  +"|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown"
  +"|onmousemove|onmouseout|onmouseover|onmouseup|style|title"
  +"|valign<baseline?bottom?middle?top],"
+"th[abbr|align<center?char?justify?left?right|axis|bgcolor|char|charoff|class"
  +"|colspan|dir<ltr?rtl|headers|height|id|lang|nowrap<nowrap|onclick"
  +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
  +"|onmouseout|onmouseover|onmouseup|rowspan|scope<col?colgroup?row?rowgroup"
  +"|style|title|valign<baseline?bottom?middle?top|width],"
+"thead[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id"
  +"|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown"
  +"|onmousemove|onmouseout|onmouseover|onmouseup|style|title"
  +"|valign<baseline?bottom?middle?top],"
+"title[dir<ltr?rtl|lang],"
+"tr[abbr|align<center?char?justify?left?right|bgcolor|char|charoff|class"
  +"|rowspan|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
  +"|title|valign<baseline?bottom?middle?top],"
+"tt[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup"
  +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],"
+"u[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup"
  +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],"
+"ul[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
  +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
  +"|onmouseup|style|title|type],"
+"var[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
  +"|title]"

Yet another editor hacker
[Not affiliated with moxycode - I just love TinyMCE smile]

Offline

 

#2 2004-12-03 18:35:48

spocke
Administrator
From: Sweden, Skellefteċ
Registered: 2004-11-25
Posts: 11436
Website

Re: Tip: full XHTML validation.

Oh-my-god!

Nice work!

Regards,
Moxiecode Systems
TinyMCE Developers


Best regards,
Spocke - Main developer of TinyMCE

Offline

 

#3 2004-12-04 15:32:37

DewiMorgan
TWG Member
From: London, UK
Registered: 2004-12-01
Posts: 65
Website

Re: Tip: full XHTML validation.

Glad you like it smile I stuffed it in the feature-requests thing on

If people are interested, I could try to make a semi-comprehensive list of what nonstandard tags each browser does, and try to make variables so that you could just append those vars to eachother, in extended_valid_elements, to get compatibility with whatever non-generic browsers you desire smile

Though, that might be tricky if two browsers allow the same nonstandard tags, with different parameters: not sure how TinyMCE would deal with that. I might have to

...hrm. Could a plugin change the validation-string at runtime? I suspect it could, so long as the validation was set to happen when saving, not when loading. So I could make a "validate-for" plugin, and people could select whether they wanted IE compatibility, or XHTML, or...

That would be quite sexy smile But not worth doing unless people want it, I guess. Does anyone other than myself even use the validation?

[Edit, note to self: if doing this, remember following tags:

Browser-specific:
marquee -> ie only
iframe -> ie only
bgsound -> ie only
blink -> ns only
multicol -> ns only
spacer -> ns only
bordercolor, bordercolorlight, and bordercolordark in table tag -> ie?
layer -> ns?
ilayer -> ns?
[Opera and Firefox have fair compatibility with both, though]

Deprecated:
isindex -> deprecated to input
applet -> deprecated to object
center -> deprecated to element with align=center
dir -> deprecated to ul
menu -> deprecated to ul
font -> deprecated to css
basefont -> deprecated to css
strike -> deprecated to css
s -> deprecated to css
u -> deprecated to css
b -> deprecated to css
i -> deprecated to css
xmp -> obsoleted to pre or code
plaintext -> obsoleted to pre or code
listing -> obsoleted to pre or code

Required:
img alt attribute is required.

Deprecation to CSS can only really be done using regex search/replace on load, which I'm still tryingto find a way to do sad [qv my other post]

Good references:
http://www.wdvl.com/Quadzilla/Tag_Ref/ref_list.html
http://hshelp.com/html.html
http://support.microsoft.com/default.as … -us;158479

/edit]


Yet another editor hacker
[Not affiliated with moxycode - I just love TinyMCE smile]

Offline

 

#4 2004-12-11 16:35:29

bluechild
Member
Registered: 2004-11-26
Posts: 16

Re: Tip: full XHTML validation.

I am sorry to post this question but I don't understand how to use this.

I would like to have TinyMCE comply 100% with the W3C Strict standard but I don't understand how to use this.

Offline

 

#5 2004-12-11 20:16:59

bluechild
Member
Registered: 2004-11-26
Posts: 16

Re: Tip: full XHTML validation.

If I get this right then what you have posted has to be inserted into here instead of:

this.settings['valid_elements'] = tinyMCE.getParam("valid_elements", "a[name|href|target|title],strong/b[class],em/i[class],strike[class],u[class]
,p[class|align],ol,ul,li,br,img[class|src|border=0|alt|title|hspace|vspace|width
|height|align],sub,sup,blockquote[dir|style],table[border=0|cellspacing|
cellpadding|width|height|class|align],tr[class|rowspan],td[class|colspan|
rowspan|width|height],div[class|align],span[class|align],pre[class|align],
address[class|align],h1[class|align],h2[class|align],h3[class|align],h4[class
|align],h5[class|align],h6[class|align],hr");

From the source code, right?

Offline

 

#6 2004-12-12 17:37:19

DewiMorgan
TWG Member
From: London, UK
Registered: 2004-12-01
Posts: 65
Website

Re: Tip: full XHTML validation.

That might work, but no, the way I've written it, it just goes into the init block.

From: http://tinymce.moxiecode.com/docs/using.htm :

Code:

<!-- tinyMCE -->
<script language="javascript" type="text/javascript" src="jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
   tinyMCE.init({
      mode : "textareas"
   });
</script>
<!-- /tinyMCE -->

Stick it in the init block there. The only thing to watch out for is the commas: each item other than the last in that block, needs a comma after it. Above, mode: "textareas" is the last item, so is not followed by a comma.

The way I have the validation block, with no comma after the valid_elements entry, is because I expect most people to put it as the last entry in their init block.

Note that either way you do it, whether editing the source or putting it in your init block, it's adding about 15k to your download size. That's only as much as a small graphic, though. It'll also be slightly slowing down save times due to the all verification it's doing, but I've not found this to be noticeable on any machien I've used.


Yet another editor hacker
[Not affiliated with moxycode - I just love TinyMCE smile]

Offline

 

#7 2004-12-13 01:21:59

bluechild
Member
Registered: 2004-11-26
Posts: 16

Re: Tip: full XHTML validation.

Ok, thanks!  big_smile

Offline

 

#8 2004-12-13 09:59:51

spocke
Administrator
From: Sweden, Skellefteċ
Registered: 2004-11-25
Posts: 11436
Website

Re: Tip: full XHTML validation.

As DewiMorgan says, this increases size and makes the cleanup (where check is made) slower. This is the reason its not included in the updated versions.


Best regards,
Spocke - Main developer of TinyMCE

Offline

 

#9 2004-12-13 15:42:45

bluechild
Member
Registered: 2004-11-26
Posts: 16

Re: Tip: full XHTML validation.

Hi Admin!

Why not make this a default in the Javascript then?

It would be cool if TinyMCE makes full XHTML validation default.

Offline

 

#10 2004-12-13 16:50:47

spocke
Administrator
From: Sweden, Skellefteċ
Registered: 2004-11-25
Posts: 11436
Website

Re: Tip: full XHTML validation.

Ill quote myself:

As DewiMorgan says, this increases size and makes the cleanup (where check is made) slower. This is the reason its not included in the updated versions.

And to add... in 90% of the cases, its total overkill.


Best regards,
Spocke - Main developer of TinyMCE

Offline

 

#11 2004-12-13 19:03:44

DewiMorgan
TWG Member
From: London, UK
Registered: 2004-12-01
Posts: 65
Website

Re: Tip: full XHTML validation.

Agreed: the operative word in TinyMCE is "Tiny" smile

I believe that TinyMCE should remain the svelte, beautiful thing it is today, and adding my HTML4 checker would add unnecessary bloat. Also, if they put it in for HTML4, then people would ask for versions for HTML1, 2, 3.2, browser-specific extensions, etc, etc. They're way better off just not going there! tongue

This is why there is plugin support. Now, if I could just figure out how to get plugins to do all the things I want (see my other posts), then I'd be happy!


Yet another editor hacker
[Not affiliated with moxycode - I just love TinyMCE smile]

Offline

 

#12 2004-12-13 19:14:27

bluechild
Member
Registered: 2004-11-26
Posts: 16

Re: Tip: full XHTML validation.

Well I to agree fully to that. And to add a pluging for that would be smart. What is important though is that tinyMCE produces pure and clean XHTML that follows the W3C standard. Nobody needs another browser based XHTML editor which doesn't follow the standards in its output!

big_smile

Offline

 

#13 2004-12-16 18:29:59

matthijs
Member
Registered: 2004-12-16
Posts: 1

Re: Tip: full XHTML validation.

Hi,

so if I understand it correctly, with these changes output is always xhtml valid? I think that would be great. I am looking around for editors all around, but all the ones I saw just output invalid and/or loads of tag-soup with all kinds of span-and fonttags.
Why output presentational tagsoup like:

Code:

<span style="italic">word</span>

That should be :

Code:

<em>word</em>

What I'm looking for is an editor to insert into a CMS system, with which clients for whom I make a website can edit content, without screwing up my nice CSS-layout.

Matthijs

Offline

 

#14 2004-12-17 04:42:00

DewiMorgan
TWG Member
From: London, UK
Registered: 2004-12-01
Posts: 65
Website

Re: Tip: full XHTML validation.

Agree completely. I am one of the directors of morganalley.com, and our web designs use no frames or iframes or tables: just pure CSS layout. A good site for that kindof ethos is csszengarden.com - some very sweet code there.

TinyMCE's support of this ethos, by allowing us to require perfect compliance, and of allowing us to use pure XHTML if we wish, and of preventing the user from using any styles other than those defined in the CSS, is ideal for our purposes.

Now I've got it working semi-perfectly under IE (visibility settings are not respected in IE, but doctypes, PHP tags and relative links are), I'm happy enough to start rolling it out to production.

You are correct that my above vile gobbet of code enforces correct XHTML: unrecognised tags will be stripped, and deprecated tags like <b> and <i> will be silently converted to the more modern <strong> and <em> when submitting the form, rather than being stripped out completely.

The conversions it makes are all the simple conversions specified by the W3C pages I got it from:
i -> em
b -> strong
listing -> pre
plaintext -> pre
xmp -> pre

There were some more complicated conversions that could have made, but I couldn't see any way to do that: for that, use the regex replacement functions that I stuck in another thread smile


Yet another editor hacker
[Not affiliated with moxycode - I just love TinyMCE smile]

Offline

 

#15 2005-02-08 06:40:03

sprocket
Member
Registered: 2005-02-08
Posts: 1

Re: Tip: full XHTML validation.

First of all, love tinymce and your XHTML init config.

However, I am interested in using the output of the editor in an XML document and find that it likes to insert some entities that are not strictly compliant. For instance, it puts in &nbsp; for non breaking spaces, but XML likes   .

I tried to use entities: "nbsp,#160" in the init, but find that doesn't work (I think it wants to go from numbers to HTML entities).

Any ideas about how to go about swapping these around?

Offline

 

#16 2005-04-04 19:20:59

rstjean
Member
Registered: 2005-04-04
Posts: 2

Re: Tip: full XHTML validation.

This code is awesome.  Thanks, I thinned it down a bit to make the loading at little quicker, removed many of the java events since I do not want users to put those in.

I am having problems allowing comments to not get stripped out of the code, since I would like it if users would be able to write comments in the code to me.

Offline

 

#17 2005-05-20 13:44:35

DewiMorgan
TWG Member
From: London, UK
Registered: 2004-12-01
Posts: 65
Website

Re: Tip: full XHTML validation.

People who are using this for XHTML compliance may also be interested in my regex solutions to some other XHTML compliance issues, on this thread:

http://tinymce.moxiecode.com/forum/viewtopic.php?p=2252


Yet another editor hacker
[Not affiliated with moxycode - I just love TinyMCE smile]

Offline

 

#18 2005-05-31 15:53:31

burzum
Member
Registered: 2005-05-31
Posts: 1

Re: Tip: full XHTML validation.

And how do you implement this (i mean the code from the 1. posting in this thread)? I have no clue where to start with this piece of code to force tinymce to produce valid xhtml-output.

Offline

 

#19 2005-09-15 14:50:10

Beakid
Member
Registered: 2005-09-15
Posts: 1

Re: Tip: full XHTML validation.

DewiMorgan: Thanks man. However, align is not an ok attribute and neither is target. The correct is style="text-align: *alignment*;" (or style="float: right;") and for the target, I think you have to use some kind of javascript these days sad. Read more about at it W3C. And yeah, post your fix here afterwards wink

burzum: in the tinyMCE.init. For example:
    <script type="text/javascript">
    tinyMCE.init({
       verify_html : true,
       valid_elements : *all the code*
       });
       </script>

Last edited by Beakid (2005-09-16 13:34:09)

Offline

 

#20 2005-09-23 15:49:51

reynierpm
Member
From: Cuba
Registered: 2005-09-23
Posts: 10
Website

Re: Tip: full XHTML validation.

And where is suposed I need to add those code ?? I'm a begginer in the use of TinyMCE Editor

Regards


ReynierPM

Offline

 

#21 2005-11-08 10:19:17

Noisequik
Member
Registered: 2005-10-11
Posts: 2

Re: Tip: full XHTML validation.

Could someone help me ?

it still writes <u>...</u> instead of <span style="text-decoration:underline">...</span>

Offline

 

#22 2005-11-15 11:51:55

Kristie Furgill
Member
Registered: 2005-11-15
Posts: 2

Re: Tip: full XHTML validation.

Beakid wrote:

DewiMorgan: Thanks man. However, align is not an ok attribute and neither is target....<snip>

I agree Beakid.  I am also looking to replace the use of the align attribute within the p element and use a class attribute instead.  I tried experimenting with the extended_valid_elements but as far as I can you can only convert at element level (i.e. strong/b) and not attribute level (p[class/align]), etc.

Does anyone have a work around for this, or a link to another forum topic.  I've searched the forums but found nothing as yet.

Cheers

Offline

 

#23 2005-12-20 20:39:44

notorious_kev
Member
Registered: 2005-12-14
Posts: 17

Re: Tip: full XHTML validation.

I'm just curious: why don't you use + or - modifiers before any of the element names in valid_elements?

I'll admit, I don't understand what + is supposed to do, but - seems really useful for clean up.

Thanks!
--
Kevin

Offline

 

#24 2005-12-21 15:32:54

Kristie Furgill
Member
Registered: 2005-11-15
Posts: 2

Re: Tip: full XHTML validation.

notorious_kev wrote:

I'm just curious: why don't you use + or - modifiers before any of the element names in valid_elements?

I've looked into using these and other modifiers within extended_valid_elements (as I really only wanted to modify the one element, and didn't want to have to specify all of the others as well) but couldn't find a way of making it work at attribute level, rather than element level.  I appreciate I'm pretty new to the tinymce code and may be missing something here, so if you have any examples that would be great.

I want to stop the use of the align attribute within the <p> element and use a class attribute instead, so rather than

<p align="center">

I'd get

<p class="center">

that way it is strict xhtml (as align has been depricated).

Offline

 

#25 2005-12-29 08:00:54

notorious_kev
Member
Registered: 2005-12-14
Posts: 17

Re: Tip: full XHTML validation.

Kristie Furgill wrote:

notorious_kev wrote:

I'm just curious: why don't you use + or - modifiers before any of the element names in valid_elements?

I've looked into using these and other modifiers within extended_valid_elements (as I really only wanted to modify the one element, and didn't want to have to specify all of the others as well) but couldn't find a way of making it work at attribute level, rather than element level.  I appreciate I'm pretty new to the tinymce code and may be missing something here, so if you have any examples that would be great.

I want to stop the use of the align attribute within the <p> element and use a class attribute instead, so rather than

<p align="center">

I'd get

<p class="center">

that way it is strict xhtml (as align has been depricated).

I haven't read any documentation that suggests that attributes can be rewritten, only how to provide default or hard-coded values.  I think a good topic for future development is how to generalize the clean up e.g. via regular expressions or even a transformation language like XSLT.

But I'm still hoping someone can explain what the + and - are for, and why the full XHTML valid_elements example doesn't use them.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2008 PunBB