jeluard / hipo

A ClojureScript DOM templating library based on hiccup syntax
100 stars 9 forks source link

Improve namespace definition genericity #4

Closed jeluard closed 9 years ago

jeluard commented 9 years ago

Some elements are inferred to be SVG elements (based on their name) and instantiated using createElementNS and the proper SVG namespace.

A better approach could be to rely on the presence of a keyword namespace whose value would allow to access the proper namespace (via multimethod?). Hiccup will ignore the namespace when rendering so it's a safe option.

e.g.

(defmethod element-namespace :svg [] "http://www.w3.org/2000/svg")

(node [:svg/svg [:svg/path ""]])