mirror of
https://github.com/jlengrand/webcomponentsjs.git
synced 2026-03-10 08:51:22 +00:00
@@ -17,6 +17,12 @@ if (typeof HTMLTemplateElement === 'undefined') {
|
||||
var contentDoc = document.implementation.createHTMLDocument('template');
|
||||
var canDecorate = true;
|
||||
|
||||
var templateStyle = document.createElement('style');
|
||||
templateStyle.textContent = TEMPLATE_TAG + '{display:none;}';
|
||||
|
||||
var head = document.head;
|
||||
head.insertBefore(templateStyle, head.firstElementChild);
|
||||
|
||||
/**
|
||||
Provides a minimal shim for the <template> element.
|
||||
*/
|
||||
|
||||
@@ -15,9 +15,20 @@
|
||||
<script src="../../../web-component-tester/browser.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<template>
|
||||
<span id="content">Hello World!</span>
|
||||
</template>
|
||||
<style>
|
||||
.container {
|
||||
display: flex;
|
||||
}
|
||||
.container > *{
|
||||
flex: 1;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="container">
|
||||
<template>
|
||||
<span id="content">Hello World!</span>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
suite('Template', function() {
|
||||
@@ -63,6 +74,12 @@
|
||||
assert.equal(imp.innerHTML, escaped);
|
||||
assert.equal(imp.content.childNodes.length, div.childNodes.length);
|
||||
});
|
||||
|
||||
test('No rendering', function() {
|
||||
var bcr = template.getBoundingClientRect();
|
||||
assert.equal(bcr.height, 0);
|
||||
assert.equal(bcr.width, 0);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user