@domchristie/composite
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -10,3 +10,3 @@ /** | ||
template = template instanceof HTMLElement | ||
? template.innerHTML | ||
? unescape(template.innerHTML) | ||
: String(template) | ||
@@ -28,3 +28,3 @@ return (new Function('html', 'raw', ...Object.keys(props), | ||
return strings.reduce((result, string, i) => { | ||
const value = values[i] | ||
const value = values[i] != null | ||
? values[i].raw ? values[i] : escape(values[i]) | ||
@@ -58,2 +58,9 @@ : '' | ||
let textarea | ||
function unescape (string) { | ||
textarea = textarea || document.createElement('textarea') | ||
textarea.innerHTML = string | ||
return textarea.value | ||
} | ||
/** | ||
@@ -60,0 +67,0 @@ * Marks a string as raw HTML to prevent escaping of special characters. |
{ | ||
"name": "@domchristie/composite", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "A hybrid client-side/server-side approach to generating dynamic HTML.", | ||
@@ -5,0 +5,0 @@ "main": "composite.js", |
6760
107