Repository navigation
Add RenderHTML and RenderHTMLPage - #24
Merged
Merged
Conversation
RenderHTML serializes the browser renderer's vnode description of a View to the HTML the WASM build puts in #wui-root: same tags, classes and inline styles, values reflected as attributes (input value, textarea text, checked, selected option), sorted attributes for stable output, raw text for the container-query <style>. It needs no browser, so it gives snapshot tests of the browser rendering in plain go test. RenderHTMLPage wraps it in a standalone document with the base stylesheet, for static exports. The README gains a Testing views section, and the Layout and Gallery examples are listed. Closes #22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements phase 1 of #22.
wui.RenderHTML(el)serializes the browser renderer's vnode description (describeTree, Patch the DOM instead of replacing it on every render #19) to the HTML the WASM build puts inside#wui-root:value, textarea text,checked, the selected<option>;Emptyplaceholders as<!---->, matching the live DOM;<style>emitted raw, not entity-escaped.wui.RenderHTMLPage(title, el)wraps it in a standalone document with the base stylesheet, for static exports such as an HTML report from a terminal tool.syscall/js.RenderTUISizedandRenderHTMLside by side), plus the missing Layout and Gallery entries under Examples.Hydrating a pre-rendered page (fast first paint) is left as the follow-up the issue describes.
Test plan
go test ./...,GOOS=js GOARCH=wasm go vet .Closes #22