実はjs-htmlと殆ど同じです。違いは次の二つです。
- keyは必ずStringリテラルで書く
- イベントハンドラを定義できない
QNameは、名前空間接頭辞:ローカル名 の形式を取ることがあり、JavaScriptのObjectリテラルの構文に引っかかります。また、JavaScriptのKeywordや、FutureReservedWordとのバッティングを避けるためにも、必ずkeyはStringリテラルで書きます。
var infoset = {"rdf:Description": null, $attrs: {"rdf:about": "http://"}}
参考のためKeywordとFutureReservedWord(予約語)を挙げておきます。ECMAScript Language Specification 3rd edition (PDF) より抜粋。
- Keyword
- break, else, new, var, case, finally, return, void, catch, for, switch, while, continue, function, this, with, default, if, throw, delete, in, try, do, instanceof, typeof
- FutureReservedWord
- abstruct, enum, int, short, boolean, export, interface, static, byte, extends, long, super, char, final, native, synchronized, class, float, package, throws, const, goto, private, transient, debugger, implements, protected, volatile, double, import, public