Live data from Hacker News

Show HN: Cami.js – A no build, web component based reactive framework

github.com

31–36 of 36 posts

Re: Show HN: Cami.js – A no build, web component based reactive framework

#33

Umm, how do the templates escape malicious input (XSS)?

It seems to be based on lit-html, so anything that's interpolated gets automatically sanitised unless you're using a directive[1] or interpolate other templates created using the "html" function.

[1]: https://lit.dev/docs/api/directives/#unsafeHTML

Re: Show HN: Cami.js – A no build, web component based reactive framework

#35

lit-html author here. I'm glad the template library is useful for you! Question regarding interop with other web components: I don't see how to create reactive properties on elements. Can they receive data from parents via property bindings? Ie, could a Lit element pass data to a Cami element?

Yes, the lib's great!

Unfortunately I haven't thought much yet about interoperability with other web components libraries like lit. I imagined folks would choose just one web component library over the other.

That said, you can initialize reactive properties(1), but property bindings won't work if there's a parent LitElement (as my reactive properties need to be called with either a .value method or an .update method for getting and setting respectively).

As of the moment, what's possible is interop with other cami elements using a store, and in a future version, i'm considering a richer event system for external javascript code to listen to.

---

(1) Initializing is possible with observerableAttr: https://github.com/kennyfrc/cami.js/blob/master/examples/008...

Re: Show HN: Cami.js – A no build, web component based reactive framework

#36

Umm, how do the templates escape malicious input (XSS)?

I've mainly designed this for backend devs (i.e. rails, django people who just render plain html/css on the front-end), and we generally do HTML sanitization on the server side.

Example: https://api.rubyonrails.org/classes/ActionView/Helpers/Sanit...

Post reply on HN