-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
27 lines (23 loc) · 674 Bytes
/
Copy pathindex.js
File metadata and controls
27 lines (23 loc) · 674 Bytes
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
/**
* <react-comment> Web Component
*
* @usage
* <react-comment>Comment-text, e.g. [if lte IE 9]><script ... /><![endif]</react-comment>
* @result
* <!--Comment-text, e.g. [if lte IE 9]><script ... /><![endif]-->
*/
class ReactComment extends window.HTMLElement {
get name () {
return 'React HTML Comment'
}
connectedCallback () {
/**
* Firefox fix, is="null" prevents attachedCallback
* @link https://github.com/WebReflection/document-register-element/issues/22
*/
this.is = ''
this.removeAttribute('is')
this.outerHTML = '<!--' + this.textContent + '-->'
}
}
window.customElements.define('react-comment', ReactComment)