chinedufn / percy

Build frontend browser apps with Rust + WebAssembly. Supports server side rendering.
https://chinedufn.github.io/percy/
Apache License 2.0
2.26k stars 84 forks source link

Reuse the defined SELF_CLOSING_TAGS from virtual-node in html-macro parser #103

Closed ivanceras closed 5 years ago

ivanceras commented 5 years ago

This change is Reviewable

chinedufn commented 5 years ago

Thanks so much for opening this clean up PR!

I’m a bit hesitant on adding a dependency to html-macro for something like this.

On the bright side the code deduplication is lovely

But on the other side I think that it’s fine to duplicate the whitelist since it really shouldn’t change often since new self closing tags don’t get added to the html spec very often.

So my thinking here is that we should just keep the duplication and avoid the extra dependency.

Curious if you see this differently?

Thanks again !!

ivanceras commented 5 years ago

Hi, I am trying to add support for inline svg. Though the HTML spec specifies that document.createElement creates an html object, it doesn't work for svg and it's sub elements such as circle, rect etc. Most of the svg sub elements are self closing tags. There is no way for the html-macro parser to determine if svg element tags should have a namespace and be created with document.createElementNS. So an explicit list of which tags belongs to which namespace will be necessary and will be instantiated accordingly.

chinedufn commented 5 years ago

Gotcha!

This works for now then - but we might want to move it into a crates/html-validation crate and have both share that dependency (which we can add more validation to over time)