[Bug] Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.

See original GitHub issue

Hello everyone! I am using the library and it is perfect. Everything was working fine until I started seeing these errors in console:

simplebar.min.js:formatted:1911 Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.
    at MutationObserver.e.recalculate (simplebar.min.js:formatted:1911)
    at d (simplebar.min.js:formatted:1512)
    at p (simplebar.min.js:formatted:1517)
    at MutationObserver.m (simplebar.min.js:formatted:1545)

When expanded it can be seen that it happens from calling the jquery .append() to scroll container. Basically what I have on the page is a container with a bunch of inputs. When the user types the input expands to fit the text until 140px by using hidden span element. I guess that means that every time the user enters a character the scrollbar is trying to recalculate and this problem occurs.

Hoping to solve the problem. Thank you.

Update

I looked through debugger and it seems that the problem occurs because the mutation observer’s property .el is undefined.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
d4n1elchencommented, Aug 24, 2020

Solved by specifying version in cdn url. (if you use cdn to load the module)

<script src="https://unpkg.com/simplebar@5.2.1/dist/simplebar.min.js"></script>

I think they accidentally point the lastest version to beta release.

1reaction
Grsmtocommented, Aug 30, 2020

Released a fix in the latest beta releases.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JS: Failed to execute 'getComputedStyle' on 'Window ...
The error message says that getComputedStyle requires the parameter to be Element type. You receive it because the parameter has an incorrect type....
Read more >
Failed to execute 'getComputedStyle' on 'Window' - OutSystems
On my mobile app i am getting an Error on every page which says "Failed to execute 'getComputedStyle' on 'Window': parameter 1 is...
Read more >
parameter 1 is not of type 'Element'. HELP : r/learnjavascript
Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'. HELP : r/learnjavascript.
Read more >
T280305 Failed to execute 'getComputedStyle' on 'Window'
Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'. Closed, InvalidPublicPRODUCTION ERROR.
Read more >
Uncaught TypeError: Failed to execute ... - GreenSock
Uncaught TypeError : Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'. By aj_m, January 28, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found