Skip to content

Commit bd2fb26

Browse files
authored
Merge pull request #10 from bit-docs/attrs
Make templates work when they have attributes
2 parents bc0816d + d8c6969 commit bd2fb26

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

codepen-data.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var scriptRegExp = /<script\s([^>]+)>([\s\S]*?)<\/script>/ig;
22
var styleRegExp = /<style>([\s\S]*?)<\/style>/i;
3-
var templateRegExp = /<template>([\s\S]*?)<\/template>/ig;
3+
var templateRegExp = /<template\s?([^>]+)?>([\s\S]*?)<\/template>/ig;
44
var moduleTest = /type=["']([\w\/]+)["']/;
55
var srcTest = /src=/;
66
var DEFAULT_EDITORS = "0011";

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bit-docs-html-codepen-link",
3-
"version": "1.3.7",
3+
"version": "1.3.9",
44
"description": "add a codepen link ",
55
"main": "index.js",
66
"scripts": {

test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,22 @@ describe("bit-docs-html-codepen-link", function() {
185185
</template>
186186
`.trim());
187187
});
188+
189+
it("Does not remove styles2", function() {
190+
var data = codepenData.html(`
191+
<template id="tmpl">
192+
<style>
193+
</style>
194+
<div class="gmap"></div>
195+
</template>
196+
<script type="module"></script>`);
197+
198+
var html = data.html.trim();
199+
assert.ok(/style/.test(html));
200+
assert.equal(html, `<template id="tmpl">
201+
<style>
202+
</style>
203+
<div class="gmap"></div>
204+
</template>`)
205+
});
188206
});

0 commit comments

Comments
 (0)