Skip to content

Commit 79fdec9

Browse files
committed
docs: clarify TailHTML usage and fix documentation typos
1 parent 760bd8a commit 79fdec9

5 files changed

Lines changed: 15 additions & 10 deletions

File tree

.agents/skills/jaws/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ For clickable content rendering:
119119
## Rendering and update rules
120120

121121
- Keep HTML structure in templates; avoid manual HTML string assembly in Go.
122-
- `ui.Template.JawsUpdate` re-renders the template data into the generated wrapper; custom `Dot.JawsUpdate` methods are not called by Template.
122+
- `ui.Template.JawsUpdate` re-renders the template data into the generated wrapper.
123123
- HTML getter paths must not mutate domain state, but they may call element update methods (`SetClass`, `RemoveClass`, `SetAttr`, `RemoveAttr`, etc.) on the passed-in `*Element` to co-ordinate wrapper class/attribute changes with the inner-HTML refresh. No custom `JawsUpdate` is needed for that case — the queued wrapper updates flush alongside the `SetInner` from `HTMLInner.JawsUpdate`.
124124
- Use a custom `JawsUpdate` only when the widget's update logic diverges from "render the getter again" — e.g. to compare against a stored last-value and skip the update (as the input widgets do).
125125
- `Element.SetAttr/RemoveAttr/SetClass/RemoveClass/SetInner/SetValue/Append/Order/Remove/Replace` are update-time operations; call them only from render/update processing.

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ For widget authoring guidance see `lib/ui/README.md`.
4343

4444
### AI skill
4545

46-
This repository includes a AI skill under `.agents/skills/jaws/`.
46+
This repository includes an AI skill under `.agents/skills/jaws/`.
4747
To install it in your local AI skills tree, copy both `SKILL.md` and
4848
`agents/openai.yaml` into `~/.agents/skills/jaws/`.
4949

@@ -81,7 +81,7 @@ import (
8181
const indexhtml = `
8282
<html>
8383
<head>{{$.HeadHTML}}</head>
84-
<body>{{$.Range .Dot}}</body>
84+
<body>{{$.Range .Dot}}{{$.TailHTML}}</body>
8585
</html>
8686
`
8787

@@ -173,9 +173,9 @@ client/server protocol code:
173173
### HTTP request flow and associating the WebSocket
174174

175175
When a new HTTP request is received, create a JaWS Request using the
176-
JaWS object's `NewRequest()` method, and then use the Request's
177-
`HeadHTML()` method to get the HTML code needed in the `<head>` section
178-
of the HTML page.
176+
JaWS object's `NewRequest()` method, then use the Request's `HeadHTML()`
177+
method in the `<head>` section and `TailHTML()` before the closing
178+
`</body>` tag.
179179

180180
When the client has finished loading the document and parsed the
181181
scripts, the JaWS JavaScript will request a WebSocket connection on
@@ -372,8 +372,8 @@ create the Request object. This value is written to the HTML output so it
372372
can be read by the JavaScript, and used to construct the WebSocket callback
373373
URL.
374374

375-
Once the WebSocket call comes in, the value is consumed by that request,
376-
and is no longer valid until, theoretically, another Request gets the same
375+
Once the WebSocket call comes in, the value is consumed by that request.
376+
The same value can only be used again if a later Request receives the same
377377
random value. And that's fine, since JaWS guarantees that no two Requests
378378
waiting for WebSocket calls can have the same value at the same time.
379379

examples/example_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ const indexhtml = `
1616
<head>{{$.HeadHTML}}</head>
1717
<body>{{with .Dot}}
1818
{{$.Range .}}
19-
{{$.TailHTML}}
20-
{{end}}</body>
19+
{{end}}{{$.TailHTML}}</body>
2120
</html>
2221
`
2322

jawsboot/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,6 @@ assets
7070
├── otherpage.html
7171
└── index.html
7272
```
73+
74+
Page templates rendered through `ui.Handler` should include `{{$.HeadHTML}}`
75+
inside `<head>` and `{{$.TailHTML}}` before the closing `</body>` tag.

jawstree/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,6 @@ assets
8383
├── otherpage.html
8484
└── index.html
8585
```
86+
87+
Page templates rendered through `ui.Handler` should include `{{$.HeadHTML}}`
88+
inside `<head>` and `{{$.TailHTML}}` before the closing `</body>` tag.

0 commit comments

Comments
 (0)