vole
Clone
Read only, no credentials:
https://rodent.software/git/vole.git
Write over SSH with a registered key:
git clone ssh://git@0.0.0.0:2222/vole.git
A free and open-source forge that lives in your Git repo.
Fix HTMX inline styles and Prism worker message parsing
ac00929fcb2269e874a0b7c0e6868885f57723ce · Keenan Nemetz · 12d ago · parent a76b2f38
Fix HTMX inline styles and Prism worker message parsing HTMX injects a <style> element for its indicator classes, which style-src 'self' blocks. Turn that off through its config meta tag and keep the indicator rules in the stylesheet instead. Prism installs its own worker message handler that expects a JSON string, so it threw JSON.parse on every structured job before prism-worker.js could highlight it. Disable that handler; the worker already owns the message path.
server/ui_test.go +23
| @@ -86,6 +86,29 @@ func TestStaticAssetsAreServedFromTheBinary(t *testing.T) { | |||
| 86 | 86 | } | |
| 87 | 87 | } | |
| 88 | 88 | ||
| 89 | // HTMX adds its indicator styles with a <style> element unless told not to. | ||
| 90 | // style-src 'self' blocks that injection, so the shell must carry the config | ||
| 91 | // that turns it off and the stylesheet must carry the rules it would have added. | ||
| 92 | func TestHTMXDoesNotInjectInlineStyles(t *testing.T) { | ||
| 93 | t.Parallel() | ||
| 94 | f := newFixture(t) | ||
| 95 | code, shell := f.get("/") | ||
| 96 | if code != 200 { | ||
| 97 | t.Fatalf("landing page = %d", code) | ||
| 98 | } | ||
| 99 | if !strings.Contains(shell, `name="htmx-config"`) || | ||
| 100 | !strings.Contains(shell, `"includeIndicatorStyles":false`) { | ||
| 101 | t.Fatal("the shell does not turn off HTMX's inline indicator styles") | ||
| 102 | } | ||
| 103 | code, css := f.get("/static/vole.css") | ||
| 104 | if code != 200 { | ||
| 105 | t.Fatalf("stylesheet = %d", code) | ||
| 106 | } | ||
| 107 | if !strings.Contains(css, ".htmx-indicator") || !strings.Contains(css, ".htmx-request .htmx-indicator") { | ||
| 108 | t.Fatal("the stylesheet does not carry HTMX's indicator rules") | ||
| 109 | } | ||
| 110 | } | ||
| 111 | |||
| 89 | 112 | // TestTheEmblemShipsAndTheShellNamesIt: the mark and the favicon are one file, | |
| 90 | 113 | // so a page that points at a name nobody ships is a broken tab icon on every | |
| 91 | 114 | // page. This is the test that would have caught the rename. | |