Closed bedeoverend closed 7 years ago
I don't really see the benefit of this, considering the extra weight and inconvenience for element authors. I definitely don't think we should do this unless/until there is a strong need for it from users.
Hmm...I might close this until we know definitely how much of a pain it is. It's definitely dodgy just setting properties on unknown elements, but I'm happy to wait until someone actually runs into the problem, it's a relatively small change anyway, so even though it's breaking, it wouldn't be much work to update other elements.
Right now we're just setting the
path
property on any element that has ansid
/gid
property. This is a risk if the user wants to use these attributes on elements that already have apath
property that's used for something else. There's no standard HTMLpath
property, but users could have a custom-element that adds it.This could be resolved by using a Symbol, rather than a String as the property. This would protect for unknown elements.
From a simpla element's perspective, to keep the regular
path
property on them, as well as getting the value fromsimpla-paths
, it would have to import the Symbol used bysimpla-paths
(not much weight given tree-shaking), and pass the value set by paths to it's own path property. e.g.A Symbol polyfill would also have to be bundled somewhere, as Symbols aren't supported at all by IE, AFAIK the polyfill is relatively lightweight e.g. are used by SkateJS.