File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 9
9
constructor ( ) {
10
10
super ( ) ;
11
11
this . attachShadow ( { mode : 'open' } ) ;
12
+ this . clicked = false ;
12
13
}
13
14
14
15
connectedCallback ( ) {
15
- this . shadowRoot . innerHTML = `<h1>${ this . getAttribute ( 'name' ) } </h1>` ;
16
+ const html = `<h1>Marcus</h1><button type="button">Ave Marcus!</button>` ;
17
+ this . shadowRoot . innerHTML = html ;
18
+ this . shadowRoot . querySelector ( 'button' ) . addEventListener ( 'click' , ( ) => {
19
+ if ( ! this . clicked ) {
20
+ this . clicked = true ;
21
+ const html = `<h1>Ave Marcus Aurelius!</h1>` ;
22
+ this . shadowRoot . innerHTML = html ;
23
+ }
24
+ } ) ;
16
25
}
17
26
}
18
27
21
30
</ script >
22
31
</ head >
23
32
< body >
24
- < page-caption name =" Marcus " > Marcus Aurelius </ page-caption >
33
+ < page-caption > </ page-caption >
25
34
</ body >
26
35
</ html >
You can’t perform that action at this time.
0 commit comments