0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-02-17 14:54:30 +01:00

Remove the now unneeded polyfills.

This commit is contained in:
XhmikosR 2020-10-26 16:39:23 +02:00
parent e8f1709adf
commit 13572a6867
15 changed files with 3 additions and 96 deletions

View File

@ -26,7 +26,6 @@ const bsPlugins = {
Data: path.resolve(__dirname, '../js/src/dom/data.js'),
EventHandler: path.resolve(__dirname, '../js/src/dom/event-handler.js'),
Manipulator: path.resolve(__dirname, '../js/src/dom/manipulator.js'),
Polyfill: path.resolve(__dirname, '../js/src/dom/polyfill.js'),
SelectorEngine: path.resolve(__dirname, '../js/src/dom/selector-engine.js'),
Alert: path.resolve(__dirname, '../js/src/alert.js'),
Button: path.resolve(__dirname, '../js/src/button.js'),
@ -66,10 +65,7 @@ const getConfigByPluginKey = pluginKey => {
pluginKey === 'Sanitizer'
) {
return {
external: [bsPlugins.Polyfill],
globals: {
[bsPlugins.Polyfill]: 'Polyfill'
}
external: []
}
}
@ -138,7 +134,6 @@ const domObjects = [
'Data',
'EventHandler',
'Manipulator',
'Polyfill',
'SelectorEngine'
]

View File

@ -1,65 +0,0 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0-alpha2): dom/polyfill.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
import { getUID } from '../util/index'
let find = Element.prototype.querySelectorAll
let findOne = Element.prototype.querySelector
const scopeSelectorRegex = /:scope\b/
const supportsScopeQuery = (() => {
const element = document.createElement('div')
try {
element.querySelectorAll(':scope *')
} catch (_) {
return false
}
return true
})()
if (!supportsScopeQuery) {
find = function (selector) {
if (!scopeSelectorRegex.test(selector)) {
return this.querySelectorAll(selector)
}
const hasId = Boolean(this.id)
if (!hasId) {
this.id = getUID('scope')
}
let nodeList = null
try {
selector = selector.replace(scopeSelectorRegex, `#${this.id}`)
nodeList = this.querySelectorAll(selector)
} finally {
if (!hasId) {
this.removeAttribute('id')
}
}
return nodeList
}
findOne = function (selector) {
if (!scopeSelectorRegex.test(selector)) {
return this.querySelector(selector)
}
const matches = find.call(this, selector)
return matches[0] ? matches[0] : null
}
}
export {
find,
findOne
}

View File

@ -5,8 +5,6 @@
* --------------------------------------------------------------------------
*/
import { find as findFn, findOne } from './polyfill'
/**
* ------------------------------------------------------------------------
* Constants
@ -21,11 +19,11 @@ const SelectorEngine = {
},
find(selector, element = document.documentElement) {
return [].concat(...findFn.call(element, selector))
return [].concat(...Element.prototype.querySelectorAll.call(element, selector))
},
findOne(selector, element = document.documentElement) {
return findOne.call(element, selector)
return Element.prototype.querySelector.call(element, selector)
},
children(element, selector) {

View File

@ -137,16 +137,6 @@ if (browserStack) {
branches: 89,
functions: 90,
lines: 90
},
each: {
overrides: {
'js/src/dom/polyfill.js': {
statements: 30,
lines: 30,
branches: 8,
functions: 30
}
}
}
}
}

View File

@ -51,7 +51,6 @@
</div>
</div>
<script src="../../dist/dom/polyfill.js"></script>
<script src="../../dist/dom/event-handler.js"></script>
<script src="../../dist/dom/selector-engine.js"></script>
<script src="../../dist/dom/data.js"></script>

View File

@ -44,7 +44,6 @@
</div>
</div>
<script src="../../dist/dom/polyfill.js"></script>
<script src="../../dist/dom/event-handler.js"></script>
<script src="../../dist/dom/selector-engine.js"></script>
<script src="../../dist/dom/data.js"></script>

View File

@ -45,7 +45,6 @@
</div>
</div>
<script src="../../dist/dom/polyfill.js"></script>
<script src="../../dist/dom/event-handler.js"></script>
<script src="../../dist/dom/selector-engine.js"></script>
<script src="../../dist/dom/manipulator.js"></script>

View File

@ -71,7 +71,6 @@
</div>
</div>
<script src="../../dist/dom/polyfill.js"></script>
<script src="../../dist/dom/event-handler.js"></script>
<script src="../../dist/dom/selector-engine.js"></script>
<script src="../../dist/dom/manipulator.js"></script>

View File

@ -210,7 +210,6 @@
</div>
<script src="../../../node_modules/popper.js/dist/umd/popper.min.js"></script>
<script src="../../dist/dom/polyfill.js"></script>
<script src="../../dist/dom/event-handler.js"></script>
<script src="../../dist/dom/selector-engine.js"></script>
<script src="../../dist/dom/data.js"></script>

View File

@ -206,7 +206,6 @@
</div>
<script src="../../../node_modules/popper.js/dist/umd/popper.min.js"></script>
<script src="../../dist/dom/polyfill.js"></script>
<script src="../../dist/dom/event-handler.js"></script>
<script src="../../dist/dom/selector-engine.js"></script>
<script src="../../dist/dom/data.js"></script>

View File

@ -32,7 +32,6 @@
</div>
<script src="../../../node_modules/popper.js/dist/umd/popper.min.js"></script>
<script src="../../dist/dom/polyfill.js"></script>
<script src="../../dist/dom/event-handler.js"></script>
<script src="../../dist/dom/selector-engine.js"></script>
<script src="../../dist/dom/manipulator.js"></script>

View File

@ -86,7 +86,6 @@
<p>Ad leggings keytar, brunch id art party dolor labore.</p>
</div>
<script src="../../dist/dom/polyfill.js"></script>
<script src="../../dist/dom/data.js"></script>
<script src="../../dist/dom/event-handler.js"></script>
<script src="../../dist/dom/selector-engine.js"></script>

View File

@ -222,7 +222,6 @@
</div>
<script src="../../../node_modules/popper.js/dist/umd/popper.min.js"></script>
<script src="../../dist/dom/polyfill.js"></script>
<script src="../../dist/dom/event-handler.js"></script>
<script src="../../dist/dom/selector-engine.js"></script>
<script src="../../dist/dom/data.js"></script>

View File

@ -52,7 +52,6 @@
</div>
</div>
<script src="../../dist/dom/polyfill.js"></script>
<script src="../../dist/dom/event-handler.js"></script>
<script src="../../dist/dom/manipulator.js"></script>
<script src="../../dist/dom/data.js"></script>

View File

@ -70,7 +70,6 @@
</div>
<script src="../../../node_modules/popper.js/dist/umd/popper.min.js"></script>
<script src="../../dist/dom/polyfill.js"></script>
<script src="../../dist/dom/selector-engine.js"></script>
<script src="../../dist/dom/event-handler.js"></script>
<script src="../../dist/dom/manipulator.js"></script>