unimal-jp / spear

The spear OSS repository
https://late-cloud-6411.spearly.app
MIT License
10 stars 1 forks source link

Self closing components #112

Open yoannes opened 1 year ago

yoannes commented 1 year ago

Is your feature request related to a problem? Please describe. It would be nice if we could use self closing components:

Describe the solution you'd like

<iframe />

Additional context In the current version (1.1.11) nothing gets rendered after the component

mantaroh commented 1 year ago

Thanks!

I looked into this spec(i.e., Self-closing tag). It seems to me that the custom element should have a closing tag: https://usefulangle.com/post/363/custom-element-valid-name

But I could not find the official specifications. (W3C / WHAT-WG)

I guess major browsers will inject closing-tag automatically on their HTML parser. (I tried this phenomenon using by non-closing

tag. <div><p/></div> should be <div>< p></p></div> automatically)

In spear case, a parser is node-html-parser, So spear is dependent on this library.

If we support self-closing components, we should implement the pre-convert process, like auto closing-tag injection.

yoannes commented 1 year ago

our parser can't handle it, so I think its ok to leave as it is for now. Its no problem, just small details for the person who is used to frameworks

mantaroh commented 1 year ago

We can parse it if we have preprocess which injecting close tag.