Revert "Pass undefined instead of an empty string"

This reverts commit b7a153f88c.
pull/5082/head
Conduitry 5 years ago
parent b7a153f88c
commit 338e21992a

@ -95,7 +95,7 @@ export default async function preprocess(
source = await replace_async(
source,
/<!--[^]*?-->|<script(\s[^]*?)?(?:>([^]*?)<\/script>|\/>)/gi,
async (match, attributes = '', content) => {
async (match, attributes = '', content = '') => {
if (!attributes && !content) {
return match;
}
@ -115,7 +115,7 @@ export default async function preprocess(
source = await replace_async(
source,
/<!--[^]*?-->|<style(\s[^]*?)?(?:>([^]*?)<\/style>|\/>)/gi,
async (match, attributes = '', content) => {
async (match, attributes = '', content = '') => {
if (!attributes && !content) {
return match;
}

@ -3,7 +3,7 @@ import * as assert from "assert";
export default {
preprocess: {
script: ({ content, attributes }) => {
assert.equal(content, undefined);
assert.equal(content, "");
return {
code: `console.log("${attributes["the-answer"]}");`
};

@ -3,7 +3,7 @@ import * as assert from "assert";
export default {
preprocess: {
style: ({ content, attributes: { color } }) => {
assert.equal(content, undefined);
assert.equal(content, "");
return {
code: `div { color: ${color}; }`
};

Loading…
Cancel
Save