Wed 2009-12-30 ( pr En )

A cool feature of JavaScript 1.6 is called E4X:

var xhtml = <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
                <title>Embedded SVG demo</title>
        </head>
        <body>
                <h1>Embedded SVG demo</h1>
                <svg xmlns="http://www.w3.org/2000/svg" 
                        viewBox="0 0 100 100">
                        <circle cx="50"
                                cy="50"
                                r="20"
                                stroke="orange"
                                stroke-width="2px"
                                fill="yellow" />
                </svg>
        </body>
</html>;

alert(xhtml.name().localName); // Alerts “html”
alert(xhtml.name().uri); // Alerts “http://www.w3.org/1999/xhtml”

I’m trying to highlight this syntax with CodeRay, but it’s a bit more complicated than I thought.

Say something! / Sag was!

No markup, just plain monospace text. / Kein Markup, nur Normschrift-Klartext.