Anne van Kesteren

Ruby in HTML

About eighteen months ago I looked into XHTML Ruby. (See also Ruby Annotation.) Apparently it is build upon the XHTML Modularization and uses the same namespace, However, it is never implemented as such. (In browsers that browse the web, at least.) Internet Explorer, as the single comment I got noted, has some support for it though. You know what that means: Ruby in HTML. Using the Live DOM Viewer I tried to figure out more or less how it works. Not everything is covered, but the basic parsing rules are here; simple research. The list of elements and how they work:

ruby element

This element is closed by both the </ruby> and <ruby> tags. This element is required as a container. Without it the other elements have no “rendering semantics.” Similar to how the table element works.

Internet Explorer creates a malformed DOM for things like: <ruby> <p> <ruby>. The second ruby element has a parent element p and a previousSibling ruby.

rt element
This element is closed by the </rt>, <rt>, </ruby> and <ruby> tags. Using </ruby> or <ruby> also closes the parent ruby element of rt, if it has one.
rp element
This element is closed by the </rp>, <rp>, </rt>, <rt>, </ruby> and </ruby> tags. Same as with rt.
rb element
rtc element
rbc element
These are unsupported and treated as unrecognized elements.

Hope this of use to someone.


  1. IE's support is really strange. It seems to recognise </rb> and </rbc> as empty elements with the tagnames literally "/rb" and "/rbc", respectively, rather than end tags. That's the same as IE's behaviour with other unrecognised end tags.

    Also, the rb and rbc elements seem to be placed in the DOM as previous siblings of the HTML element (immediately after the DOCTYPE).

    Posted by Lachlan Hunt at

  2. Lachlan, that is exactly why I think they are not supported at all :-) And why the post is now updated after some further pushing from Simon Pieters.

    Posted by Anne at

  3. Steve, I think the reference book for Rails at the moment is Agile Web Development with Rails. 4 out of the 6 writers involved wrote Rails components (including David Heinemeier Hansson, the creator of the framework itself) and the two who didn't are Dave Thomas (one of the Agile Manifesto authors) and Mike Clark.

    You can also find some more informations on the RoR Related Resources and the Rails Wiki (but you more than likely know the latter already)

    Posted by Masklinn at

  4. Basically, it's really bad that it has not been very well implemented because it's a very useful language, not only for asian languages with two scripts writing but also for translations or time or calendar, everything which can be expressed in different languages.

    This test for example works in IE even if everything is wrong in this page, namespace, etc.

    You can browse the other tests as well.

    I think I will write something about the possibilities of Ruby Annotations on the QA Weblog soon. It's not very well understood.

    Posted by karl at

  5. I have also posted an image of a simple ruby rendering in Amaya on W3C Web site. People will be able to "visualize" what it means.

    Posted by karl at

  6. Anne, and all, you may find the following information from the W3C Internationalization Activity pages of interest:

    FAQ: What is ruby?

    Tutorial: Ruby Markup and Styling

    I18n Activity Ruby tests

    Posted by Richard Ishida at

  7. Karl, that Ruby test of yours is hilarious. Internet Explorer gets just about everything wrong. First it ditches the MIME type (text/plain) and renders the whole thing as HTML. No HTML tags are present, but all content that starts with < must be HTML, right?

    Second, it doesn't remotely care about the namespace of the ruby element and renders it as if it was correct. Internet Explorer is surely an interesting piece of work.

    Posted by Asbjørn Ulsberg at