-
Notifications
You must be signed in to change notification settings - Fork 152
Improve compatibility with more browser-like environments #405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Yeah this seems reasonable to me. To be fair having larger output(more strict) specifically for SVG also doesn't feel breaking to me. It is just a question of whether identifying the case is easy enough. Ultimately if SVG doesn't support the features I'd like to not have them default on for it specifically. But having the option to turn it off in general is probably good anyway in case some other weird scenario we aren't aware of. |
Strictly speaking SVG is XML and not HTML, so omitting closing tags and argument double quotes isn't spec compliant. Many evergreen browsers do relax their interpretation of the spec to avoid having issues where people get confused about why some stuff breaks only for their SVG but not the surrounding HTML, I assume. I can also modify the PR to avoid omissions by default for SVG as default behavior. This could be more correct and widely supported behavior. Let me know if you prefer me to add that. (For simplicitys sake we can split this into a separate PR too, and merge this one if you're satisfied with it) |
|
Yeah I'd love a follow up PR. We should be able to merge this as is. I'd love @titoBouzout opinion as well since he's been really working at standardizing stuff here, and recently added support for MathML (another XML variant). So I want to make sure we are doing sensible things. |
|
Very likely that whatever stricter (less omissive) output we do for SVG, should also be done for MathML (and any XML based content, really). It will make most browser-like environments work out of the box with default config. (since a lot of those browser-like environments would be using dedicated strict XML parsers the moment they encounter an Evergreen major browser vendors are a bit different, they still parse those tags via the HTML parser, albeit in a specialized mode, hence the lesser strictness. But I think the svgwg and htmlwg specs leave enough things vague for vendors to correctly assume that running inline Waiting on @titoBouzout to opine. If he's OK with this PR and a plan for a follow-up that slightly tightens up the strictness on MathML&SVG (Anything in |
|
Thanks for the invite, I think this is nice to have. About making the output of MathML/SVG XML compatible, sounds good to me as a preference. Because we target mainly evergreen-browsers and browser-like environments are the exception. I suspect the current behaviour is the preferred format, as it works and makes the output smaller (load faster from the network etc). For implementing something like this, a context (of compile time for this case) will be needed, because currently we do not have a context for entered xml territory exited xml territory. The MathML implementation for dynamic things(on where most of the trouble is) is more of a hack than anything else. |
|
@titoBouzout @ryansolid alright so if I'm understanding correctly, we can merge this as nice to have configuration but keep defaults as they are form now since evergreen browsers are OK with them. EDIT: Meanwhile I tested this change in our UI repo with a pnpm override, and it makes Solid.js fully functional in Coherent (the browser-link environment we tested). |
|
Yeah in any case we can merge this PR I think. |
|
Perfect, thanks! I'll follow up with downstream PRs into the Vite plugin for solid because I think that replicates the typescript types for the config, and similar details. |
|
@ryansolid created the following downstream PR: |
We're building a UI in a browser-like environment for game engines named Gameface by Coherent Labs which powers many popular titles with millions of players worldwide. Coherent Labs is trying to make Solid the recommended choice for in-game UI developed using Gameface via their open source UI component library.
Unfortunately,
dom-expressionscurrently makes some omissions when generating templates from JSX that aren't digestible by that browser. Namely, omitting closing tags and quotes, which while OK according to the HTML spec, isn't acceptable under the XML spec which governs SVG in that browser's implementation.This created unforeseen issues when migrating our own UI from React to Solid, causing all sorts of issues with our SVG usage in JSX.
There are two potential solutions to this problem:
dom-expressionsto allow for such environmentsThis PR opts for the former, less disruptive solution (also fixing an incorrect documentation of the default value for
omitNestedClosingTags), while recommending for a future version ofdom-expressionsto implement the latter solution (2) and make sure that SVG code, being XML and often parsed with a stricter parser, have different behavior when it comes to the omissions.It adds the following configuration parameters (with corresponding tests) while keeping the default values true to pre-existing behavior: