@@ -11,7 +11,7 @@ const externalCssCache: { [index: string]: cssNodeObj } = {}
1111//to store timers of testing if a html element matches a rule selector.
1212const arrTimerOfTestingIfMatched : ReturnType < typeof setTimeout > [ ] = [ ]
1313let doc = document
14- function getC ( $0 : HTMLElement ) {
14+ async function getC ( $0 : HTMLElement ) {
1515 arrTimerOfTestingIfMatched . forEach ( function ( ele ) {
1616 clearTimeout ( ele )
1717 } )
@@ -24,28 +24,29 @@ function getC($0: HTMLElement) {
2424 typeof $0 . nodeName === 'undefined'
2525 ) {
2626 return
27- } else {
28- if ( $0 . nodeName . match ( / ^ < p s e u d o : / ) ) {
29- chrome . runtime . sendMessage ( {
30- action : 'inform' ,
31- info : "It's a pseudo element" ,
32- } )
33- return
34- } else if ( $0 . nodeName === 'html' || $0 . nodeName . match ( / ^ # / ) ) {
35- chrome . runtime . sendMessage ( {
36- action : 'inform' ,
37- info : 'Not for this element' ,
38- } )
39- return
40- }
27+ }
28+
29+ if ( $0 . nodeName . match ( / ^ < p s e u d o : / ) ) {
30+ chrome . runtime . sendMessage ( {
31+ action : 'inform' ,
32+ info : "It's a pseudo element" ,
33+ } )
34+ return
35+ }
36+
37+ if ( $0 . nodeName === 'html' || $0 . nodeName . match ( / ^ # / ) ) {
38+ chrome . runtime . sendMessage ( {
39+ action : 'inform' ,
40+ info : 'Not for this element' ,
41+ } )
42+ return
4143 }
4244
4345 let isInSameOrigin = true
4446 try {
4547 $0 . ownerDocument . defaultView . parent . document
4648 } catch ( e ) {
4749 isInSameOrigin = false
48- // console.log(e);
4950 }
5051
5152 if ( isInSameOrigin ) {
@@ -138,11 +139,13 @@ function getC($0: HTMLElement) {
138139 } )
139140}
140141
141- chrome . runtime . sendMessage ( {
142- action : 'evalGetCssUsed' ,
143- info : 'page loaded' ,
144- } ) . catch ( ( ) => {
145- // console.log('error',error);
146- } )
142+ chrome . runtime
143+ . sendMessage ( {
144+ action : 'evalGetCssUsed' ,
145+ info : 'page loaded' ,
146+ } )
147+ . catch ( ( ) => {
148+ // console.log('error',error);
149+ } )
147150
148151export default getC
0 commit comments