Bootstrap: Tooltip throws "hasOwnProperty is undefined" error after upgrading jQuery to 3.5.0

Created on 23 Apr 2020  路  3Comments  路  Source: twbs/bootstrap

At snapappointments/bootstrap-select#2430 developers were fighting the same error.
The problem comes from JQuery 3.5.0 (jquery/jquery#3256).

Error:

jquery.self-99e868a06761df8565fc4890f21060bdf24ca79307ff02224f603448ab9044f7.js?body=1:4056 Uncaught TypeError: dataAttributes.hasOwnProperty is not a function
    at Tooltip.getOptions (bootstrap.self-268df15f6dcd79a7aab1677a4cf8f1bf54a59cb6d1e805efa0e1f8071110762e.js?body=1:1509)
    at Tooltip.init (bootstrap.self-268df15f6dcd79a7aab1677a4cf8f1bf54a59cb6d1e805efa0e1f8071110762e.js?body=1:1472)
    at new Tooltip (bootstrap.self-268df15f6dcd79a7aab1677a4cf8f1bf54a59cb6d1e805efa0e1f8071110762e.js?body=1:1442)
    at HTMLAnchorElement.<anonymous> (bootstrap.self-268df15f6dcd79a7aab1677a4cf8f1bf54a59cb6d1e805efa0e1f8071110762e.js?body=1:1944)
    at Function.each (jquery.self-99e868a06761df8565fc4890f21060bdf24ca79307ff02224f603448ab9044f7.js?body=1:382)
    at jQuery.fn.init.each (jquery.self-99e868a06761df8565fc4890f21060bdf24ca79307ff02224f603448ab9044f7.js?body=1:204)
    at jQuery.fn.init.Plugin [as tooltip] (bootstrap.self-268df15f6dcd79a7aab1677a4cf8f1bf54a59cb6d1e805efa0e1f8071110762e.js?body=1:1938)
    at HTMLDocument.<anonymous> (custom.self-cb0a74f9d336bee94b1510c8cf4ec0d5a4ff3a037787b0094eec42b3e5a0483d.js?body=1:26)
    at mightThrow (jquery.self-99e868a06761df8565fc4890f21060bdf24ca79307ff02224f603448ab9044f7.js?body=1:3763)
    at process (jquery.self-99e868a06761df8565fc4890f21060bdf24ca79307ff02224f603448ab9044f7.js?body=1:3831)

Error source: https://github.com/twbs/bootstrap/blob/v3.4.1/js/tooltip.js#L223
npm packages:

"bootstrap": "3.4.1",
"jquery": "^3.5.0",

Solution will be to use Object.hasOwnProperty.call(obj, property).

I'm not sure if this error is present also at Bootstrap v4 but v3 needs definitely fix. JQuery team is not going to change it.

Most helpful comment

@XhmikosR my issue is related to Bootstrap v3.4.1. The fix was released only for v4.x.x.

We need fix for 3.x.x

All 3 comments

Duplicate of #30553, please search for existent issues before creating a new one.

@XhmikosR my issue is related to Bootstrap v3.4.1. The fix was released only for v4.x.x.

We need fix for 3.x.x

v3 is EOL.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kamov picture kamov  路  3Comments

devfrey picture devfrey  路  3Comments

knownasilya picture knownasilya  路  3Comments

matsava picture matsava  路  3Comments

leomao10 picture leomao10  路  3Comments