Skip to content

Conversation

@shayanhabibi
Copy link
Contributor

This pull adds:

  • Short member alias for checking if the CustomQueue is empty
  • Refactors out attribute renderer from start tag renderer
  • Adds empty element tag renderer

This matches the xml spec and removes some unexpected behaviours when unsafely injecting property spreads due to the children prop being nullified by the empty start/end tags.

- Add alias for checking empty state of CustomQueue
- Refactor out attribute renderer from html start tag renderer
- add html empty elem tag renderer
- adjust tests to fit expected behaviour
- green tests
- Add alias for checking empty state of CustomQueue
- Refactor out attribute renderer from html start tag renderer
- add html empty elem tag renderer
- adjust tests to fit expected behaviour
- green tests
@shayanhabibi
Copy link
Contributor Author

Fantomas fails on test file formatting; this PR doesn't change the test files other than adjusting the expected output to match the spec

@Lanayx
Copy link
Owner

Lanayx commented Feb 7, 2025

Thanks for the PR, you probably wanted to adjust Oxpecker.Solid rendering, but edited server rendering instead. Oxpercker.ViewEngine is following HTML spec, not XML or JSX spec, so self-closing tags are prohibited. Oxpecker.Solid rendering is done using the Oxpecker.Solid.FablePrlugin

@shayanhabibi
Copy link
Contributor Author

Thanks for the PR, you probably wanted to adjust Oxpecker.Solid rendering, but edited server rendering instead. Oxpercker.ViewEngine is following HTML spec, not XML or JSX spec, so self-closing tags are prohibited. Oxpecker.Solid rendering is done using the Oxpecker.Solid.FablePrlugin

It's just more compatible with different markup styles

@Lanayx
Copy link
Owner

Lanayx commented Feb 7, 2025

I think this link is more relevant https://stackoverflow.com/questions/3558119/are-non-void-self-closing-tags-valid-in-html5

In HTML5, the meaning of depends on the type of element:

  • On HTML elements that are designated as void elements (essentially "An element that existed before HTML5 and which was forbidden to have any content"), end tags are simply forbidden. The slash at the end of the start tag is allowed, but has no meaning. It is just syntactic sugar for people (and syntax highlighters) that are addicted to XML.
  • On other HTML elements, the slash is an error, but error recovery will cause browsers to ignore it and treat the tag as a regular start tag. This will usually end up with a missing end tag causing subsequent elements to be children instead of siblings.
  • Foreign elements (imported from XML applications such as SVG) treat it as self-closing syntax.

Anyway, changing regular HTML to non-regular is not something a general ViewEngine implementation should do (in my opinion).

@shayanhabibi
Copy link
Contributor Author

Oof that is a hectic one. I do concede to that! The rabbit hole goes deeper than it should hahaha

@shayanhabibi
Copy link
Contributor Author

Nothing the Plugin can do to fix this. I've made a pull to Fable which addresses the issue.

For now I'm just going to have to go between stable Fable and my own forked version of Fable until the pull is addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants