placement.split() is not a function

See original GitHub issue

I’m getting this error when Popper 2 getBasePlacement(placement) function is used in popper.js.

image

image

On that function, placement should be an string before split() is used. This get fixed just changing return placement.split('-')[0]; to return placement.toString().split('-')[0];

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
EmmanuelZamudioTRcommented, Jul 18, 2022

@atomiks Thank you!! Adding type="module" to the script tag has fixed it.

In case it is useful to anyone: I am using Bootstrap’s tooltips but using the source files and my own bundling. I didn’t add the above because the Bootstrap docs specifically tell you not to, but I think that must just be if you’re using the pre-compiled version. If you’re using the source files and doing your own compiling, it’s not relevant and you should use type="module".

Thanks both @atomiks @doubleedesign, I was also making my own bundle for Bootstrap5, but adding type="module" to script tag fixed the issue.

0reactions
doubleedesigncommented, Jul 18, 2022

@atomiks Thank you!! Adding type="module" to the script tag has fixed it.

In case it is useful to anyone: I am using Bootstrap’s tooltips but using the source files and my own bundling. I didn’t add the above because the Bootstrap docs specifically tell you not to, but I think that must just be if you’re using the pre-compiled version. If you’re using the source files and doing your own compiling, it’s not relevant and you should use type="module".

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is causing the error `string.split is not a function`?
This is because document.location is a Location object. The default .toString() returns the location in string form, so the concatenation will trigger that....
Read more >
[Solved] TypeError: split is not a function - ItsJavaScript
The TypeError: split is not a function occurs if we call a split() method on the value that is not of a type...
Read more >
TypeError: split is not a function in JavaScript | bobbyhadz
The "split is not a function" error occurs when we call the split() method on a value that is not of type string....
Read more >
How To Fix Split is Not a Function Error in JavaScript - Isotropic
First and foremost it is important to understand the usage of the split() method. It can only be used on strings so the...
Read more >
Error: split is not a function - JavaScript - SitePoint Forums
I'm trying to separate the 2 parts of the string into separate variables, but for whatever reason, the “split()” function won't work in...
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