{"id":189,"date":"2003-07-04T12:18:18","date_gmt":"2003-07-04T16:18:18","guid":{"rendered":"https:\/\/www.goer.org\/wordpress\/xhtml2_explorations_part_ii"},"modified":"2003-07-04T12:18:18","modified_gmt":"2003-07-04T16:18:18","slug":"xhtml2_explorations_part_ii","status":"publish","type":"post","link":"https:\/\/www.goer.org\/Journal\/2003\/07\/xhtml2_explorations_part_ii.html","title":{"rendered":"XHTML2 Explorations, Part II"},"content":{"rendered":"<p>In the <a href=\"\/Journal\/2003\/Jul\/#01\">last installment of <acronym title=\"eXtensible HyperText Markup Language, Version 2\">XHTML2<\/acronym> Explorations<\/a>, we touched on how XHTML2&#8217;s <a href=\"http:\/\/www.w3.org\/TR\/xhtml2\/mod-attribute-collections.html#s_attribute-collectionsmodule\">attribute collections<\/a> provide a rich variety of behaviors for nearly all elements.  Today&#8217;s installment focuses on the individual elements themselves. As with Part I, this post does not discuss &#8220;well-known&#8221; XHTML2 concepts.<sup><a href=\"#4-1\">1<\/a><\/sup><\/p>\n<h4>New Paragraph Model<\/h4>\n<p>XHTML2 gives us a new twist on our old friend the <code>&lt;p&gt;<\/code> tag.  In previous versions of <acronym title=\"HyperText Markup Language\">HTML<\/acronym> and <acronym title=\"eXtensible HyperText Markup Language\">XHTML<\/acronym>, you could not nest other block elements inside a paragraph.  Now you can <a href=\"http:\/\/www.w3c.org\/TR\/2003\/WD-xhtml2-20030506\/mod-block-text.html#sec_8.7.\">nest any block element<\/a> except for another paragraph. In other words, you can now consider a list or table to be semantically part of a paragraph.<\/p>\n<p>This leads to an interesting result (first brought to my attention by <a href=\"http:\/\/golem.ph.utexas.edu\/~distler\/blog\/index.shtml\">Jacques Distler<\/a>).  Consider the following (invalid) markup<sup><a href=\"#4-2\">2<\/a><\/sup>:<\/p>\n<pre>\n  &lt;p style=\"color: red\"&gt;\n    Why is Gordon better for Dana than Casey?\n    &lt;ul&gt;\n      &lt;li&gt;Knows mayor Giuliani&lt;\/li&gt;\n      &lt;li&gt;Can dress self w\/o assistance from Wardrobe&lt;\/li&gt;\n      &lt;li&gt;Obvious physical prowess&lt;\/li&gt;\n      &lt;li&gt;Two!! post-graduate degrees&lt;\/li&gt;\n    &lt;\/ul&gt;\n  &lt;\/p&gt;\n<\/pre>\n<p>Since a paragraph can&#8217;t contain lists, a standards-compliant browser would end the paragraph just before the start of the unordered list.  Thus the words, &#8220;Why is Gordon&#8230;&#8221; would be colored red while the list items would remain unchanged.<\/p>\n<p>However, under XHTML2&#8217;s new paragraph model this code <em>is<\/em> valid, and everything inside <code>&lt;p&gt;<\/code> and <code>&lt;\/p&gt;<\/code> would be red.  I have to admit that from a coding standpoint, I like this.  If nothing else, it matches my naive expectations a little better.  (&#8220;Hey, why isn&#8217;t my list red?&#8221; the newbie web designer wonders&#8230;)<\/p>\n<p>From a semantic standpoint, I&#8217;m a little less sure about this.  I usually don&#8217;t think of my tables as being nested inside my paragraphs.  Neither does Framemaker, for that matter.  Is Framemaker broken?  Am <em>I<\/em> broken?  Well, maybe.  The good thing about this model is that it&#8217;s totally optional &#8212; you can nest stuff inside paragraphs, or not.  Works for me.<\/p>\n<h4>Scripting<\/h4>\n<p>You can now <a href=\"http:\/\/www.w3c.org\/TR\/2003\/WD-xhtml2-20030506\/mod-scripting.html#sec_16.2.1.\">nest <code>&lt;script&gt;<\/code> elements<\/a> and process them like the <code>&lt;object&gt;<\/code> element. If the browser understands the parent script, execute it; otherwise go on to the child script(s). It&#8217;s a nifty model<span style=\"text-decoration: line-through;\">, albeit one that is not backwards compatible<\/span>. Whoops &#8212; I forgot, it&#8217;s not fair for us to harp on that. Sorry.  Anyway, the model itself looks good, particularly if you want to script with multiple languages.  The spec does take great pains to mention that there <em>are<\/em> scripting languages besides Javascript, such as&#8230; <code>type=\"text\/x-perl\"<\/code>.  Hmmm.<\/p>\n<p>There is also a new <code>declare<\/code> attribute for both scripts and objects. This boolean attribute specifies whether the script or object is a &#8220;declaration only&#8221;, meaning that it is not to be processed until the user initiates some sort of action.  And speaking of actions, there&#8217;s a <a href=\"http:\/\/www.w3.org\/TR\/xml-events\/\">brand-new events model<\/a> defined by the XMLEVENTS standard (which is pleasantly short and easy to read). XMLEVENTS allows you to set any element as the observer or handler for standard  <a href=\"http:\/\/www.w3.org\/TR\/2000\/REC-DOM-Level-2-Events-20001113\/\"><acronym title=\"Document Object Model\">DOM<\/acronym> events<\/a>.  It also provides a generic <code>&lt;listener&gt;<\/code> element that can pass events off to handlers. The XMLEVENTS spec looks to be far more comprehensive and flexible than our current model, which involves slathering our code with <code>onmouseover<\/code> attributes and whatnot.  The only catch is that XMLEVENTS has totally replaced the existing model<span style=\"text-decoration: line-through;\">, which means our current scripts all just went POOF!<\/span>.  Argh, there I go again&#8230;<\/p>\n<p>The spec also declares the death of <code>document.write<\/code>:<\/p>\n<blockquote>\n<p>Note that because of the XML processing model, where a document is first parsed before being processed, the form of dynamic generation used in earlier versions of HTML, using <code>document.write<\/code> cannot be used in XHTML2. To dynamically generate content in XHTML you have to add elements to the DOM tree using DOM calls [DOM] rather than using <code>document.write<\/code> to generate text that then gets parsed.<\/p>\n<\/blockquote>\n<p>Well, that&#8217;s fair enough.  The W3C seems to be saying, &#8220;Look guys, this is <em>XML<\/em> here. Not <a href=\"http:\/\/www.w3.org\/TR\/html4\/\">HTML<\/a>, not some <a href=\"http:\/\/www.w3.org\/TR\/xhtml1\/\">halfway-step<\/a> that decays back into friendly tag-soup if you make a mistake &#8212; this is <em>the real stuff<\/em> here.&#8221; I suppose the real question is whether they&#8217;re going to forbid XHTML2 to be served up as <code>text\/html<\/code>. I can&#8217;t find any discussion of MIME-type issues in the current spec, so it&#8217;ll be interesting to hear the W3C&#8217;s final decision on this.<\/p>\n<h4>Miscellany<\/h4>\n<ul>\n<li>\n<p>There&#8217;s a <a href=\"http:\/\/www.w3.org\/TR\/2003\/WD-xhtml2-20030506\/mod-inline-text.html#sec_9.8.\">new <code>&lt;quote&gt;<\/code> element<\/a> for marking up inline quotes.  Unlike its ill-fated predecessor <code>&lt;q&gt;<\/code>, the <code>&lt;quote&gt;<\/code> element does <em>not<\/em> automagically insert localized quotation marks.  &#8220;We give up,&#8221; the W3C is saying. &#8220;Insert your own damn quotation marks.&#8221;<\/p>\n<\/li>\n<li>\n<p>Tables are relatively untouched. The one noticeable change is that the <code>summary<\/code> attribute is now an element, presumably to provide a facility for richer descriptions.  The spec makes no recommendations for how to display this content in visual browsers. I think we can assume that the default should be <code>display:&nbsp;none<\/code>, but you never know.<\/p>\n<p>I also noticed that the spec <em>requires<\/em> tables to have one or more <code>&lt;tbody&gt;<\/code> elements&#8230; but as it turns out, this requirement dates all the way back to HTML4!  I must say this comes as quite a shock, given that the <a href=\"http:\/\/validator.w3.org\/\">validator<\/a> happily accepts pages with <code>&lt;tbody&gt;<\/code>-free tables as <a href=\"http:\/\/validator.w3.org\/check\/referer\">HTML 4.01 Strict<\/a>. I&#8217;m looking at the spec again right now, and I&#8217;m still a bit freaked out over this.  Do I not know how to read the spec?  Am I hallucinating because I skipped lunch in preparation for the big Fourth of July <acronym title=\"Bar-Be-Que. Come on, people.\">BBQ<\/acronym>? <a href=\"http:\/\/www.w3.org\/TR\/html4\/struct\/tables.html#h-11.2.1\">We report, you decide<\/a>. (<strong>Edit:<\/strong> it turns out I can&#8217;t read the spec. Never post while under the influence of carbohydrate deprivation.)<\/p>\n<\/li>\n<li>\n<p>Finally, <a href=\"http:\/\/www.w3.org\/TR\/ruby\/\">Ruby text<\/a> is now a standard module.  This is good news for hundreds of millions of Asian-language speaking users&#8230; at least, I think. Actually, this begs the question: if Ruby text is a fundamental component of Asian typography, why are we forcing Asian users to go all the way to XHTML2 to use it?  It seems like it would be useful and straightforward to retrofit Ruby text onto HTML.  Then again, since HTML is officially a dead specification, the point is moot.<\/p>\n<\/li>\n<\/ul>\n<h4>Conclusions<\/h4>\n<p>Errr&#8230; who needs conclusions?  It&#8217;s barbeque time.  Happy Fourth!<\/p>\n<p><\/p>\n<p><a name=\"4-1\"><\/a><\/p>\n<p><small>1. My definition of &#8220;well-known&#8221; is &#8220;I remember hearing about it vaguely on someone&#8217;s blog somewhere.&#8221;<\/small><\/p>\n<p><a name=\"4-2\"><\/a><\/p>\n<p><small>2. As for whether the pro-Gordon argument is as invalid as the markup&#8230; well, I leave that as an exercise for the reader.<\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the last installment of <acronym title=\"eXtensible HyperText Markup Language, Version 2\">XHTML2<\/acronym> Explorations, we touched on how XHTML2&#8217;s attribute collections provide a rich variety of behaviors for nearly all elements.  Today&#8217;s installment focuses on the individual elements themselves.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-189","post","type-post","status-publish","format-standard","hentry","category-web"],"_links":{"self":[{"href":"https:\/\/www.goer.org\/Journal\/wp-json\/wp\/v2\/posts\/189","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.goer.org\/Journal\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.goer.org\/Journal\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.goer.org\/Journal\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.goer.org\/Journal\/wp-json\/wp\/v2\/comments?post=189"}],"version-history":[{"count":0,"href":"https:\/\/www.goer.org\/Journal\/wp-json\/wp\/v2\/posts\/189\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.goer.org\/Journal\/wp-json\/wp\/v2\/media?parent=189"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.goer.org\/Journal\/wp-json\/wp\/v2\/categories?post=189"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.goer.org\/Journal\/wp-json\/wp\/v2\/tags?post=189"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}