Skip to content

Commit 04fd8c6

Browse files
authored
Merge pull request #123 from kernvalley/bug/templates
Fix bug in santizer use when creating templates
2 parents fd76339 + a5472a0 commit 04fd8c6

6 files changed

Lines changed: 16 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [v2.0.8] - 2025-11-19
11+
12+
### Fixed
13+
- Fix bug in santizer use when creating templates
14+
1015
## [v2.0.7] - 2025-11-19
1116

1217
### Changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@kernvalley/components",
3-
"version": "2.0.7",
3+
"version": "2.0.8",
44
"description": "A collection of web components / custom elements from KernValley.US",
55
"keywords": [
66
"kern valley",

test/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@
3333
"@shgysk8zer0/http-status": "https://unpkg.com/@shgysk8zer0/http-status@1.1.1/http-status.js",
3434
"@aegisjsproject/trusted-types": "https://unpkg.com/@aegisjsproject/trusted-types@1.0.1/bundle.min.js",
3535
"@aegisjsproject/trusted-types/": "https://unpkg.com/@aegisjsproject/trusted-types@1.0.1/",
36-
"@aegisjsproject/parsers": "https://unpkg.com/@aegisjsproject/parsers@0.0.8/bundle.min.js",
37-
"@aegisjsproject/parsers/": "https://unpkg.com/@aegisjsproject/parsers@0.0.8/",
38-
"@aegisjsproject/sanitizer": "https://unpkg.com/@aegisjsproject/sanitizer@0.1.0/sanitizer.js",
39-
"@aegisjsproject/sanitizer/": "https://unpkg.com/@aegisjsproject/sanitizer@0.1.0/",
36+
"@aegisjsproject/parsers": "https://unpkg.com/@aegisjsproject/parsers@0.1.2/bundle.min.js",
37+
"@aegisjsproject/parsers/": "https://unpkg.com/@aegisjsproject/parsers@0.1.2/",
38+
"@aegisjsproject/sanitizer": "https://unpkg.com/@aegisjsproject/sanitizer@0.2.1/sanitizer.js",
39+
"@aegisjsproject/sanitizer/": "https://unpkg.com/@aegisjsproject/sanitizer@0.2.1/",
4040
"@aegisjsproject/core": "https://unpkg.com/@aegisjsproject/core@0.2.13/core.js",
4141
"@aegisjsproject/core/": "https://unpkg.com/@aegisjsproject/core@0.2.13/",
4242
"@aegisjsproject/styles": "https://unpkg.com/@aegisjsproject/styles@0.1.1/styles.js",

wfd/events.html.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
export default `<div part="event" itemtype="https://schema.org/Event" itemscope="">
1+
import { html } from '@aegisjsproject/parsers/html.js';
2+
3+
export default html`<div part="event" itemtype="https://schema.org/Event" itemscope="">
24
<div>
35
<a href="" target="_blank" itemprop="url" part="link">
46
<!-- Add \`link-external\` icon -->

wfd/events.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { text, attr } from '@shgysk8zer0/kazoo/dom.js';
66
import { setUTMParams, callOnce } from '@shgysk8zer0/kazoo/utility.js';
77
import { getString, setString, getBool, setBool } from '@shgysk8zer0/kazoo/attrs.js';
88
import { light, dark } from '@shgysk8zer0/jss/palette/gnome.js';
9-
import { sanitizer } from '@aegisjsproject/sanitizer/config/base.js';
109
import template from './events.html.js';
1110

1211

@@ -152,9 +151,6 @@ registerCustomElement('wfd-events', class HTMLWFDEventsElement extends HTMLEleme
152151
new CSSStyleSheet({ media: '(prefers-color-scheme: dark)' }).replace(DARK_STYLES),
153152
]);
154153

155-
const tmp = document.createDocumentFragment();
156-
tmp.setHTML(template, { sanitizer });
157-
158154
shadow.append(
159155
createElement('a', {
160156
href: getWFDLink('', { source: this.source, medium, content }),
@@ -199,7 +195,7 @@ registerCustomElement('wfd-events', class HTMLWFDEventsElement extends HTMLEleme
199195
}) => {
200196
const start = new Date(startDate);
201197
const end = new Date(endDate);
202-
const base = tmp.cloneNode(true);
198+
const base = template.cloneNode(true);
203199

204200
attr('[part~="event"]', { itemtype: new URL(type, context) }, { base });
205201
attr('[part~="link"]', { href: getWFDLink(url, utm) }, { base });

0 commit comments

Comments
 (0)