Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js/src
diff options
context:
space:
mode:
authorAlessandro Chitolina <alekitto@gmail.com>2018-09-25 21:06:09 +0300
committerXhmikosR <xhmikosr@gmail.com>2019-02-20 23:05:45 +0300
commit6cfc78f2d95eca0b6fc6d0a19a76a1102f8c2254 (patch)
treedd19d586681fe3da215a55e363ae3dadcf1e97c7 /js/src
parente866b1ae432f387180b18b21fed59cd21b62957e (diff)
Remove IE support and button bsChecked hack
Diffstat (limited to 'js/src')
-rw-r--r--js/src/button.js4
-rw-r--r--js/src/dom/manipulator.js14
-rw-r--r--js/src/dom/polyfill.js52
-rw-r--r--js/src/dom/selectorEngine.js2
4 files changed, 4 insertions, 68 deletions
diff --git a/js/src/button.js b/js/src/button.js
index 8bdf9d5bd7..2cb6acabae 100644
--- a/js/src/button.js
+++ b/js/src/button.js
@@ -7,7 +7,6 @@
import Data from './dom/data'
import EventHandler from './dom/eventHandler'
-import Manipulator from './dom/manipulator'
import SelectorEngine from './dom/selectorEngine'
import Util from './util'
@@ -96,7 +95,8 @@ class Button {
rootElement.classList.contains('disabled')) {
return
}
- Manipulator.setChecked(input, !this._element.classList.contains(ClassName.ACTIVE))
+
+ input.checked = !this._element.classList.contains(ClassName.ACTIVE)
EventHandler.trigger(input, 'change')
}
diff --git a/js/src/dom/manipulator.js b/js/src/dom/manipulator.js
index ad14e29148..b9135aa791 100644
--- a/js/src/dom/manipulator.js
+++ b/js/src/dom/manipulator.js
@@ -28,20 +28,6 @@ function normalizeDataKey(key) {
}
const Manipulator = {
- setChecked(input, val) {
- if (input instanceof HTMLInputElement) {
- input.checked = val
- input.bsChecked = val
- }
- },
-
- isChecked(input) {
- if (input instanceof HTMLInputElement) {
- return input.bsChecked || input.checked
- }
- throw new Error('INPUT parameter is not an HTMLInputElement')
- },
-
setDataAttribute(element, key, value) {
element.setAttribute(`data-${normalizeDataKey(key)}`, value)
},
diff --git a/js/src/dom/polyfill.js b/js/src/dom/polyfill.js
index ff7ba1d179..dd29b9dfb1 100644
--- a/js/src/dom/polyfill.js
+++ b/js/src/dom/polyfill.js
@@ -9,47 +9,6 @@ import Util from '../util'
/* istanbul ignore next */
const Polyfill = (() => {
- // defaultPrevented is broken in IE
- const workingDefaultPrevented = (() => {
- const e = document.createEvent('CustomEvent')
- e.initEvent('Bootstrap', true, true)
- e.preventDefault()
- return e.defaultPrevented
- })()
-
- if (!workingDefaultPrevented) {
- const origPreventDefault = Event.prototype.preventDefault
- Event.prototype.preventDefault = function () {
- if (!this.cancelable) {
- return
- }
-
- origPreventDefault.call(this)
- Object.defineProperty(this, 'defaultPrevented', {
- get() {
- return true
- },
- configurable: true
- })
- }
- }
-
- // CustomEvent polyfill for IE (see: https://mzl.la/2v76Zvn)
- if (typeof window.CustomEvent !== 'function') {
- window.CustomEvent = (event, params) => {
- params = params || {
- bubbles: false,
- cancelable: false,
- detail: null
- }
- const evt = document.createEvent('CustomEvent')
- evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail)
- return evt
- }
-
- window.CustomEvent.prototype = window.Event.prototype
- }
-
// MSEdge resets defaultPrevented flag upon dispatchEvent call if at least one listener is attached
const defaultPreventedPreservedOnDispatch = (() => {
const e = new CustomEvent('Bootstrap', {
@@ -76,14 +35,6 @@ const Polyfill = (() => {
window.Event.prototype = origEvent.prototype
}
- // matches polyfill (see: https://mzl.la/2ikXneG)
- let matches = Element.prototype.matches
- if (!matches) {
- matches =
- Element.prototype.msMatchesSelector ||
- Element.prototype.webkitMatchesSelector
- }
-
// closest polyfill (see: https://mzl.la/2vXggaI)
let closest
if (!Element.prototype.closest) {
@@ -91,7 +42,7 @@ const Polyfill = (() => {
closest = (element, selector) => {
let ancestor = element
do {
- if (matches.call(ancestor, selector)) {
+ if (ancestor.matches(selector)) {
return ancestor
}
@@ -188,7 +139,6 @@ const Polyfill = (() => {
defaultPreventedPreservedOnDispatch,
focusIn: typeof window.onfocusin === 'undefined',
closest,
- matches,
find,
findOne
}
diff --git a/js/src/dom/selectorEngine.js b/js/src/dom/selectorEngine.js
index ee2f004850..1da34331d7 100644
--- a/js/src/dom/selectorEngine.js
+++ b/js/src/dom/selectorEngine.js
@@ -15,7 +15,7 @@ import Util from '../util'
*/
const closest = Polyfill.closest
-const matchesFn = Polyfill.matches
+const matchesFn = Element.prototype.matches
const find = Polyfill.find
const findOne = Polyfill.findOne
const nodeText = 3