Skip to content
This repository has been archived by the owner on Feb 4, 2022. It is now read-only.

Avoid using nested templates when setting innerHTML #411

Merged
merged 2 commits into from
Apr 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions fixtures/packages/iron-icon/expected/demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@
See: https://github.com/Polymer/polymer-modulizer/issues/154
-->
<script type="module">
const $_documentContainer = document.createElement('div');
const $_documentContainer = document.createElement('template');

$_documentContainer.innerHTML = `<custom-style>
<style is="custom-style" include="demo-pages-shared-styles"></style>
</custom-style>`;

document.body.appendChild($_documentContainer);
document.body.appendChild($_documentContainer.content);
</script>

<script type="module">
const $_documentContainer = document.createElement('div');
const $_documentContainer = document.createElement('template');

$_documentContainer.innerHTML = `<div class="vertical-section-container centered">
<h3>
Expand All @@ -64,7 +64,7 @@ <h3><code>iron-icon</code> using an image url as its icon source.</h3>
</demo-snippet>
</div>`;

document.body.appendChild($_documentContainer);
document.body.appendChild($_documentContainer.content);
</script>
</body>
</html>
8 changes: 4 additions & 4 deletions fixtures/packages/paper-button/expected/demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
See: https://github.com/Polymer/polymer-modulizer/issues/154
-->
<script type="module">
const $_documentContainer = document.createElement('div');
const $_documentContainer = document.createElement('template');

$_documentContainer.innerHTML = `<custom-style>
<style is="custom-style" include="demo-pages-shared-styles">
Expand All @@ -48,12 +48,12 @@
</style>
</custom-style>`;

document.body.appendChild($_documentContainer);
document.body.appendChild($_documentContainer.content);
</script>
</head>
<body unresolved>
<script type="module">
const $_documentContainer = document.createElement('div');
const $_documentContainer = document.createElement('template');

$_documentContainer.innerHTML = `<div class="vertical-section-container centered">
<h3>Buttons can be flat, raised, toggleable, or disabled</h3>
Expand Down Expand Up @@ -154,7 +154,7 @@ <h3>Buttons can be used as a link</h3>
</demo-snippet>
</div>`;

document.body.appendChild($_documentContainer);
document.body.appendChild($_documentContainer.content);
</script>
</body>
</html>
4 changes: 2 additions & 2 deletions fixtures/packages/paper-button/expected/paper-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ import '../../@polymer/iron-flex-layout/iron-flex-layout.js';
import { PaperButtonBehavior, PaperButtonBehaviorImpl } from '../../@polymer/paper-behaviors/paper-button-behavior.js';
import '../../@polymer/paper-styles/element-styles/paper-material-styles.js';
import { Polymer } from '../../@polymer/polymer/lib/legacy/polymer-fn.js';
const $_documentContainer = document.createElement('div');
const $_documentContainer = document.createElement('template');
$_documentContainer.setAttribute('style', 'display: none;');

$_documentContainer.innerHTML = `<dom-module id="paper-button">
Expand Down Expand Up @@ -176,7 +176,7 @@ $_documentContainer.innerHTML = `<dom-module id="paper-button">

</dom-module>`;

document.head.appendChild($_documentContainer);
document.head.appendChild($_documentContainer.content);
Polymer({
importPath: import.meta.url,
is: 'paper-button',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const $_documentContainer = document.createElement('div');
const $_documentContainer = document.createElement('template');
$_documentContainer.setAttribute('style', 'display: none;');

$_documentContainer.innerHTML = `<style is="custom-style">
Expand All @@ -12,4 +12,4 @@ $_documentContainer.innerHTML = `<style is="custom-style">
}
</style>`;

document.head.appendChild($_documentContainer);
document.head.appendChild($_documentContainer.content);
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Polymer } from '../../../../lib/legacy/polymer-fn.js';
import { html } from '../../../../lib/utils/html-tag.js';
const $_documentContainer = document.createElement('div');
const $_documentContainer = document.createElement('template');
$_documentContainer.setAttribute('style', 'display: none;');

$_documentContainer.innerHTML = `<dom-module id="simple-layout-styles">
Expand Down Expand Up @@ -30,7 +30,7 @@ $_documentContainer.innerHTML = `<dom-module id="simple-layout-styles">
</template>
</dom-module>`;

document.head.appendChild($_documentContainer);
document.head.appendChild($_documentContainer.content);
Polymer({
importPath: import.meta.url,

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import './sub/style-import.js';
const $_documentContainer = document.createElement('div');
const $_documentContainer = document.createElement('template');
$_documentContainer.setAttribute('style', 'display: none;');

$_documentContainer.innerHTML = `<dom-module id="shared-style">
Expand Down Expand Up @@ -32,7 +32,7 @@ $_documentContainer.innerHTML = `<dom-module id="shared-style">
</style>
</custom-style>`;

document.head.appendChild($_documentContainer);
document.head.appendChild($_documentContainer.content);

/**
@license
Expand Down
Loading