On 8 Mar 2013, at 23:23, Bill McCoy <
whm...@gmail.com> wrote:
> Thanks Baldur,
>
> Between #2 and #3, how would the CSS selector have to differ between say Chrome and IE10 to style a link marked with epub:type="noteref"? It does seem inconvenient if they have to be different. Do they have to differ regardless of with what Content-Type the content is being served up?
It would depend on whether the document is XHTML or not. The problem does not really lie in implementation differences between any of the current browsers but in the differences between XHTML and HTML. IE10, thankfully, is the first IE to do things properly and so would behave exactly like Chrome. I should have included it in #2. Earlier IEs and Chrome however are different no matter the content type, as in attaching the style won't work in HTML (it might work in XHTML in IE9, which was the first IE to support XHTML).
To style a link marked with epub:type="noteref" you would use a[epub\:type="noteref"] as a selector when targeting HTML (escaping the colon) but in XHTML it would be:
@namespace epub "
http://www.idpf.org/2007/ops";
a[epub|type="noteref"] { font-weight: bold; }
So, to target both you would have to do:
@namespace "
http://www.w3.org/1999/xhtml"; /* This is the default namespace */
@namespace epub "
http://www.idpf.org/2007/ops";
a[epub\:type="noteref"] , a[epub|type="noteref"] { font-weight: bold; }
This is a lot messier and a lot more complicated than is usable. Most people and authoring tools would simply skip this and just use a class or a data-* attribute and select on that.
Styling using an attribute selector with a colon in it is simply not possible in IE9 or lower, as far as I know. Not reliably. Except maybe in XHTML in IE9.
The same kind of XHTML/HTML schism appears in the DOM where in the former you would have to use getAttributeNS while in the latter you could use the regular getAttribute method leading to code duplication for scripts and libraries trying to target both serialisation types.
The XHTML/HTML schism is more important than the buggy IEs since IE10 fixes almost all of the bugs and is generally a first rate browser. Time will now take care of the IE problem.
>
> I guess then the issues with epub:type are maybe a subset of the issues one faces in creating what is called "polyglot" markup (markup that is validly both HTML and XHTML), is that right?
In a way, yeah. epub:type or anything like it is exactly the sort of thing you can't do with polyglot markup at the moment. Polyglot markup does not allow for arbitrary namespaces and only includes markup recognised by both HTML5 and XML (xlink, svg, mathml, and aria). There are people who want to add extensibility to polyglot markup but it would involve finding new ways of embedding arbitrary markup (XML islands in script tags that then get parsed by javascript, for example) which doesn't help solve our problem.
The goal with polyglot is to create a document that is both valid HTML5 and well-formed XML and where the DOM and CSS work in the same way in both (again this is possible mostly due to the inclusion of svg, mathml, and xlink in HTML5).
The only way to accomplish that is by discarding the extensibility of XML completely. AFAICT, polyglot markup is mainly a way to be able to serve the same document up both as application/xhtml+xml and as text/html. It also lets a developer tap into the XML toolchain, but regular XHTML5 would allow for that as well (but may not reliably be served as text/html).
Personally, I don't see the point in it.
XML serialisation of HTML isn't higher quality markup in any way as it doesn't catch any of the issues likely to cause problems in the long run and the HTML tools ecosystem is rich enough on its own.
XML's strictness can't tell you which alt attributes are legitimately empty and which aren't. It doesn't tell you which ARIA roles are misapplied and which aren't. It doesn't tell you if your metadata is correct, or if the position of the script tag in the markup tree is going to cause it to block rendering. It won't tell you whether the outline of H1-5 tags will make sense in a screen reader or whether the structure of your forms will have issues—whether the data submitted will make sense to the server. It won't tell you whether you've overloaded your ids, causing problems when various people in your team separately work on the links, ARIA support, javascript, CSS, and microdata in your site (they are all bound tightly to ids, too tightly). It won't tell you whether you're using spans and divs as buttons instead of anchors and real buttons. These are all markup quality issues that cause problems either now or later. XML's strictness doesn't help us at all in any significant way.
Whether any given piece of markup is good and of high quality or bad and of low quality is completely orthogonal to whether it is HTML or XML.
XML's strictness in web development only helps you fix trivial issues like typos and unclosed tags. In HTML, those sort of errors are either non-issues (i.e. the markup is still works predictably and reliably across all major browsers) or they break the page in an obvious way and get fixed quickly (just like in XML). Moreover, XML's strictness is only really beneficial when you're hand-coding and if you're doing that you've already lost. You hand-code the templates and test the hell out of them but your actual pages should always be generated programatically. HTML and XML is just too complicated and messy to write by hand on a regular basis. Doing so is slow and invites serious breakage. And, of course, end users, writers, authors should never ever have to see or worry about HTML or XML in any way.
XML's strictness does not address any of the real issues web developers are facing (especially for those working in teams, a context that brings to light a host of problems with our current crop of web tech).
The only real advantage XML has over HTML is extensibility and polyglot markup jettisons that.
Of course, XML's extensibility brings with it a level of complexity that compounds that of HTML, which is already too complex. This complexity (namespaces and strictness) cause problems for web developers that more than outweigh the benefits.
But, I digress… None of this has anything to do with epub-type/epub:type and Epub Zero. :-D
- best
- baldur