May 31, 2013

WYSIWYG... NOT!

Once upon a time, in the early days of the Commercial Internet - in mid-1999, to be precise - I tried using a couple of WYSIWYG HTML editors and became totally disenchanted with them when each editor totally mucked up practically any coding done outside of the WYSIWYG interface.

Today, I tried using KompoZer to add styles to a short, hand-written XHTML 1.0 strict standard page. It promptly broke my page; wouldn't render at all in Firefox 21.0 on Linux. It took an hour or so of repeatedly overlooking the bug to discover that KompoZer had changed this...
<script src="js/sked.js" type="text/javascript"></script>
to this...
<script type="text/javascript" src="js/sked.js" />
in addition to hosing my human-readable indenting and such.

I had actually looked into the script tag a bit when writing the XHTML page, and the use of start and end tags seemed to actually be correct in this instance. The twelve-year-old “HTML & XHTML The Definitive Guide, 4th Edition” states on p. 434, “End tag: </script>; never omitted”. So I went with that and didn't think more about it.

After this problem cropped up, I found that page 514 of the same book indicates that any XHTML element with no content like <p></p> may be written like <p />, so KompoZer's change, while not necessary, should be ok. However, I also found "guidelines" from the W3C "for authors who wish their XHTML documents to render on existing HTML user agents" that indicates not to do that for “an empty instance of an element whose content model is not EMPTY”. <script>'s content model isn't EMPTY. So for compatibility, should you use a single <script ... /> tag? Fugetaboutit!

For other things, WYSIWYG editors are fine. But if a web content editor is going to make any unnecessary changes at all to anything I've written, then it's not for me.

Anybody out there in cyberspaceland know if Dreamweaver does this sort of nonsense?

No comments:

Post a Comment