aboutsummaryrefslogtreecommitdiff
path: root/js/src/util.js
diff options
context:
space:
mode:
authorJohann-S <[email protected]>2018-06-09 21:11:05 +0200
committerXhmikosR <[email protected]>2019-02-20 22:05:45 +0200
commit64591b3722128d89252b8f1c840cd846940b7f5c (patch)
tree971c65a6fd9f506da55e4be31d1fece7f9b20b89 /js/src/util.js
parent4d6e41dea6492f18029f0dd70b118217c02f27d8 (diff)
downloadbootstrap-64591b3722128d89252b8f1c840cd846940b7f5c.tar.xz
bootstrap-64591b3722128d89252b8f1c840cd846940b7f5c.zip
fix(manipulator): increase coverage for manipulator
Diffstat (limited to 'js/src/util.js')
-rw-r--r--js/src/util.js49
1 files changed, 0 insertions, 49 deletions
diff --git a/js/src/util.js b/js/src/util.js
index 78f5fe3fb..0b7f492fe 100644
--- a/js/src/util.js
+++ b/js/src/util.js
@@ -22,20 +22,6 @@ function toType(obj) {
return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase()
}
-function normalizeData(val) {
- if (val === 'true') {
- return true
- } else if (val === 'false') {
- return false
- } else if (val === 'null') {
- return null
- } else if (val === Number(val).toString()) {
- return Number(val)
- }
-
- return val
-}
-
const Util = {
TRANSITION_END: 'bsTransitionEnd',
@@ -164,41 +150,6 @@ const Util = {
return [nodeList]
},
- getDataAttributes(element) {
- if (typeof element === 'undefined' || element === null) {
- return {}
- }
-
- let attributes
- if (Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'dataset')) {
- attributes = this.extend({}, element.dataset)
- } else {
- attributes = {}
- for (let i = 0; i < element.attributes.length; i++) {
- const attribute = element.attributes[i]
- if (attribute.nodeName.indexOf('data-') !== -1) {
- // remove 'data-' part of the attribute name
- const attributeName = attribute.nodeName.substring('data-'.length).replace(/-./g, (str) => str.charAt(1).toUpperCase())
- attributes[attributeName] = attribute.nodeValue
- }
- }
- }
-
- for (const key in attributes) {
- if (!Object.prototype.hasOwnProperty.call(attributes, key)) {
- continue
- }
-
- attributes[key] = normalizeData(attributes[key])
- }
-
- return attributes
- },
-
- getDataAttribute(element, key) {
- return normalizeData(element.getAttribute(`data-${key.replace(/[A-Z]/g, (chr) => `-${chr.toLowerCase()}`)}`))
- },
-
isVisible(element) {
if (typeof element === 'undefined' || element === null) {
return false