-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtangy-template.js
57 lines (52 loc) · 1.5 KB
/
tangy-template.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';
import './util/html-element-props.js'
import './style/tangy-common-styles.js'
import './style/tangy-element-styles.js'
/**
* `tangy-radio-button`
*
*
* @customElement
* @polymer
* @demo demo/index.html
*/
export class TangyTemplate extends PolymerElement {
static get template () {
return html`
<style include="tangy-common-styles"></style>
<style include="tangy-element-styles"></style>
<div id="container"></div>
`
}
static get is () {
return 'tangy-template'
}
static get properties () {
return {
name: {
type: String,
value: '',
reflectToAttribute: true
},
hidden: {
type: Boolean,
value: false,
observer: 'render',
reflectToAttribute: true
},
value: {
type: String,
value: '',
observer: 'render',
reflectToAttribute: true
}
}
}
connectedCallback() {
super.connectedCallback()
// <tangy-form-item> will evaluate this template in the scope it lives.
// Note we're not using innerHTML because that will result in expressions like greater than becoming HTML encoded. See note on MDN docs https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML
this.template = this.innerHTML.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')
}
}
window.customElements.define(TangyTemplate.is, TangyTemplate)