Skip to content

Commit 749933d

Browse files
author
Chasen Le Hara
committed
Revert "Put the JS into the HTML as <script type="module">"
This reverts commit 511c955.
1 parent 8f97088 commit 749933d

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

index.js

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,6 @@ module.exports = function() {
110110
}
111111
if(data.html) {
112112
data.html = data.html.trim();
113-
if (data.js) {
114-
data.html += "\n\n<script type=\"module\">\n" + data.js + "\n</script>";
115-
data.js = "";
116-
}
117113
}
118114
if(data) {
119115
if(window.CREATE_CODE_PEN) {
@@ -127,14 +123,11 @@ module.exports = function() {
127123
}
128124
}
129125
if(el && matches.call(el, ".demo_wrapper")) {
130-
var jsCode = el.querySelector("[data-for=js] code");
131-
var jsText = jsCode ? jsCode.textContent.trim() : "";
132-
133126
var htmlCode = el.querySelector("[data-for=html] code");
134127
var htmlText = htmlCode ? htmlCode.textContent.trim() : "";
135-
if (jsText) {
136-
htmlText += "\n\n<script type=\"module\">\n" + jsText + "\n</script>";
137-
}
128+
129+
var jsCode = el.querySelector("[data-for=js] code");
130+
var jsText = jsCode ? jsCode.textContent.trim() : "";
138131

139132
var cssText = getStylesFromIframe( el.querySelector("iframe") );
140133

test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var open = function(url, callback, done) {
2222
};
2323

2424
describe("bit-docs-html-codepen-link", function() {
25-
it("basics works", function(done) {
25+
it.only("basics works", function(done) {
2626
this.timeout(60000);
2727

2828
var docMap = Promise.resolve({
@@ -60,8 +60,8 @@ describe("bit-docs-html-codepen-link", function() {
6060
codePen.click();
6161
});
6262
assert.deepEqual(createCallData,[
63-
{ html: '<my-app></my-app>\n\n<script type="module">\nimport { Component } from "//unpkg.com/can@^5.0.0-pre.1/core.mjs";\nComponent\n</script>',
64-
js: '',
63+
{ html: '<my-app></my-app>',
64+
js: 'import { Component } from "//unpkg.com/can@^5.0.0-pre.1/core.mjs";\nComponent',
6565
js_module: true,
6666
editors: '1011',
6767
css: 'my-app {color: "green";}'

0 commit comments

Comments
 (0)