Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] TypeError: Cannot convert object to primitive value #184

Closed
mshemuni opened this issue Feb 14, 2022 · 1 comment
Closed

[Bug] TypeError: Cannot convert object to primitive value #184

mshemuni opened this issue Feb 14, 2022 · 1 comment

Comments

@mshemuni
Copy link

Version

v2.1.0

Reproduction link

twbs/bootstrap#30553 (comment)

Operating System

Ubuntu

Device

PC and Mobile

Browser & Version

All Browsers

Steps to reproduce

  1. Create a site using material design
  2. Try to add JS9: https://js9.si.edu/
  3. add static files. refer to js9support.min.js as example shows.

What is expected?

When navbar-toggler width data-target of #navigation-example is clicked an animation to open a side bar is expected.

What is actually happening?

An error says TypeError: Cannot convert object to primitive value and no side bar is opened


Solution

twbs/bootstrap#30553 (comment)

chanhed this line:
if (!i && l.toggle && /show|hide/.test(t) && (l.toggle = !1), i || (i = new r(this, l), o.data(n, i)), 'string' == typeof t) {

to this:
if (!i && l.toggle && /show|hide/.test(l) && (l.toggle = !1), i || (i = new r(this, l), o.data(n, i)), 'string' == typeof t) {

Additional comments

Unfortunately my code is not in production. So I cannot create a codepen etc...

@groovemen
Copy link
Contributor

Hello @mshemuni,

Thank you for using our products, the TypeError: Cannot convert the object to primitive value error typically occurs when you try to use an object in a context where a primitive value is expected, such as when you try to concatenate an object with a string using the + operator.

To fix this error, you need to convert the object to a primitive value before using it in a context where a primitive value is expected. One way to do this is by using the valueOf method, which returns the primitive value of an object.

Hope this information helps you. Please let us know if we can help you with anything else.
All the best,
Stefan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants