File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 51
51
< script defer src ="/static/sc-router.js "> </ script >
52
52
< script >
53
53
const router = document . querySelector ( 'sc-router' ) ;
54
+ const links = Array . from ( document . querySelectorAll ( 'a' ) ) ;
54
55
55
- function onClick ( evt ) {
56
+ function onClick ( evt ) {
56
57
evt . preventDefault ( ) ;
57
58
router . go ( evt . target . href ) ;
58
59
}
59
60
60
- let links = Array . from ( document . querySelectorAll ( 'a' ) ) ;
61
- links . forEach ( function ( link ) {
61
+ links . forEach ( link => {
62
62
link . addEventListener ( 'click' , onClick ) ;
63
63
} ) ;
64
- </ script >
64
+
65
+ </ script >
65
66
</ body >
66
67
</ html >
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ class SCRouter extends HTMLElement {
83
83
84
84
_addRoutes ( ) {
85
85
let views = Array . from ( document . querySelectorAll ( 'sc-view' ) ) ;
86
- views . forEach ( function ( view ) {
86
+ views . forEach ( view => {
87
87
if ( ! view . route )
88
88
return ;
89
89
You can’t perform that action at this time.
0 commit comments