-
Notifications
You must be signed in to change notification settings - Fork 1
/
demo.html
42 lines (36 loc) · 1000 Bytes
/
demo.html
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
<html>
<bit-toc></bit-toc>
<script>
console.log("executing");
console.log("executed");
function safeCustomElement(tag, constructor, prototype){
var Element = function(){
var result;
if(typeof Reflect !== "undefined") {
result = Reflect.construct(HTMLElement, [], new.target);
} else {
result = HTMLElement.apply(this, arguments);
}
return result;
}
if(typeof HTMLElement !== undefined) {
Element.prototype = Object.create(HTMLElement.prototype);
}
Object.getOwnPropertyNames(prototype).forEach(function(property){
Object.defineProperty(Element.prototype, property,
Object.getOwnPropertyDescriptor(prototype, property))
});
if(typeof customElements !== "undefined") {
customElements.define(tag, Element);
}
return Element;
}
var BitToc = safeCustomElement('bit-toc',function(){
console.log("constructor");
},{
connectedCallback: function(){
console.log("connected");
}
});
</script>
</html>