romancow / dimdom

A small, simple way to represent a DOM - a “diminished DOM”
MIT License
0 stars 0 forks source link

Attribute namespaces #8

Open romancow opened 8 years ago

romancow commented 8 years ago

Support some method for setting attribute's wit namespaces - for example thexlink:href for svg.

Not sure what the syntax for this should be. Maybe pass a two item array as the attribute value?

new DimDom.SVG('image', {href: ["xlink", "example.jpg"]})

I'd prefer the namespace to be more associated with the attribute name than the value, though.

romancow commented 8 years ago

Maybe use nested objects?

new DimDom.SVG('image', { xlink: { href: "example.jpg" } });

Or split name on :?

romancow commented 8 years ago
DimDom.NS({XLink: "http://www.w3.org/1999/xlink"}, function(ns) {
    new ns.SVG("image", {"xlink:href": "example.jpg"});
});