mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-06 04:08:22 +01:00
fix(util): remove extend
This commit is contained in:
parent
b4a3b00ac8
commit
4510e7e61d
@ -281,7 +281,7 @@ const EventHandler = (() => {
|
|||||||
|
|
||||||
// merge custom informations in our event
|
// merge custom informations in our event
|
||||||
if (typeof args !== 'undefined') {
|
if (typeof args !== 'undefined') {
|
||||||
evt = Util.extend(evt, args)
|
evt = Object.assign(evt, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defaultPrevented) {
|
if (defaultPrevented) {
|
||||||
|
@ -155,6 +155,33 @@ const Polyfill = (() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof Object.assign !== 'function') {
|
||||||
|
Object.defineProperty(Object, 'assign', {
|
||||||
|
value: (target, ...args) => {
|
||||||
|
if (target === null || typeof target === 'undefined') {
|
||||||
|
throw new TypeError('Cannot convert undefined or null to object')
|
||||||
|
}
|
||||||
|
|
||||||
|
const to = Object(target)
|
||||||
|
|
||||||
|
for (let index = 1; index < args.length; index++) {
|
||||||
|
const nextSource = args[index]
|
||||||
|
|
||||||
|
if (nextSource !== null || !nextSource) {
|
||||||
|
for (const nextKey in nextSource) {
|
||||||
|
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
||||||
|
to[nextKey] = nextSource[nextKey]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return to
|
||||||
|
},
|
||||||
|
writable: true,
|
||||||
|
configurable: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
defaultPreventedPreservedOnDispatch,
|
defaultPreventedPreservedOnDispatch,
|
||||||
focusIn: typeof window.onfocusin === 'undefined',
|
focusIn: typeof window.onfocusin === 'undefined',
|
||||||
|
@ -114,28 +114,6 @@ const Util = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
extend(obj1, ...others) {
|
|
||||||
const obj2 = others.shift()
|
|
||||||
for (const secondProp in obj2) {
|
|
||||||
if (Object.prototype.hasOwnProperty.call(obj2, secondProp)) {
|
|
||||||
const secondVal = obj2[secondProp]
|
|
||||||
// Is this value an object? If so, iterate over its properties, copying them over
|
|
||||||
if (secondVal && Object.prototype.toString.call(secondVal) === '[object Object]') {
|
|
||||||
obj1[secondProp] = obj1[secondProp] || {}
|
|
||||||
Util.extend(obj1[secondProp], secondVal)
|
|
||||||
} else {
|
|
||||||
obj1[secondProp] = secondVal
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (others.length) {
|
|
||||||
this.extend(obj1, ...others)
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj1
|
|
||||||
},
|
|
||||||
|
|
||||||
makeArray(nodeList) {
|
makeArray(nodeList) {
|
||||||
if (typeof nodeList === 'undefined' || nodeList === null) {
|
if (typeof nodeList === 'undefined' || nodeList === null) {
|
||||||
return []
|
return []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user