JS: Failed to execute 'getComputedStyle' on 'Window': parameter is not of type 'Element'

前端 未结 6 1807
北海茫月
北海茫月 2020-12-09 14:56

In short: I am trying to understand the meaning of this TypeError: Failed to execute \'getComputedStyle\' on \'Window\': parameter 1 is not of type \'Element\' The error app

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-09 15:41

    I had the same error on my Angular6 project. none of those solutions seemed to work out for me. turned out that the problem was due to an element which was specified as dropdown but it didn't have dropdown options in it. take a look at code below:

    
                        
    

    removing the code data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" solved the problem.

    I myself think that by each click on the first span element, the scope expected to set style for dropdown children which did not existed in the parent span, so it threw error.

提交回复
热议问题