From 338e21992a34d91f45449b911feae656cc3fadf1 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Tue, 7 Jul 2020 11:03:31 -0400 Subject: [PATCH] Revert "Pass undefined instead of an empty string" This reverts commit b7a153f88c629e2df513755798dc8222450aebc8. --- src/compiler/preprocess/index.ts | 4 ++-- test/preprocess/samples/script-self-closing/_config.js | 2 +- test/preprocess/samples/style-self-closing/_config.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/preprocess/index.ts b/src/compiler/preprocess/index.ts index a9ba331e6d..d90d4814d7 100644 --- a/src/compiler/preprocess/index.ts +++ b/src/compiler/preprocess/index.ts @@ -95,7 +95,7 @@ export default async function preprocess( source = await replace_async( source, /|([^]*?)<\/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>|\/>)/gi, - async (match, attributes = '', content) => { + async (match, attributes = '', content = '') => { if (!attributes && !content) { return match; } diff --git a/test/preprocess/samples/script-self-closing/_config.js b/test/preprocess/samples/script-self-closing/_config.js index 15d43ac432..4baab9730e 100644 --- a/test/preprocess/samples/script-self-closing/_config.js +++ b/test/preprocess/samples/script-self-closing/_config.js @@ -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"]}");` }; diff --git a/test/preprocess/samples/style-self-closing/_config.js b/test/preprocess/samples/style-self-closing/_config.js index 3c3ffabc26..0a05cd3d64 100644 --- a/test/preprocess/samples/style-self-closing/_config.js +++ b/test/preprocess/samples/style-self-closing/_config.js @@ -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}; }` };