diff --git a/src/html.js b/src/html.js
index 533db1a..1842aa3 100644
--- a/src/html.js
+++ b/src/html.js
@@ -48,7 +48,7 @@ const EVENT_PART = 5
const ELEMENT_PART = 6
const COMMENT_PART = 7
-const templateCache = new WeakMap()
+const TEMPLATE_CACHE = new Map()
const walker = document.createTreeWalker(document, 129, null, false)
function noop() {}
@@ -436,10 +436,11 @@ class ChildPart {
}
}
#getTemplate(result) {
- let template = templateCache.get(result.strings)
+ let template = TEMPLATE_CACHE.get(result.strings.join())
+
if (template === void 0) {
template = new Template(result, this.options)
- templateCache.set(result.strings, template)
+ TEMPLATE_CACHE.set(result.strings.join(), template)
}
return template
}
@@ -701,12 +702,13 @@ export function render(value, container, options = {}) {
let part = container[WC_PART]
if (part === void 0) {
- container[WC_PART] = part = new ChildPart(
+ part = new ChildPart(
container.insertBefore(createMarker(), null),
null,
void 0,
options
)
+ container[WC_PART] = part
}
part._$setValue(value)
@@ -720,10 +722,11 @@ export function html(strings, ...values) {
values
}
}
-export function raw(str, ...args) {
- let strings = args.length ? str.split('%s') : [str]
- strings.raw = strings
- return html(strings, ...args)
+
+export function raw(str, values = []) {
+ let strings = values.length ? str.split('%s') : [str]
+ strings.raw = true
+ return html(strings, ...values)
}
export function svg(strings, ...values) {
return {