Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v5 without jQuery #23586

Merged
merged 89 commits into from Feb 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
8b603e4
Remove jQuery from Util.js
Johann-S Aug 19, 2017
43acce7
Move transition end detection to dom/event.js instead of util.js
Johann-S Aug 21, 2017
7b68398
alert without jquery
Johann-S Aug 21, 2017
1cfa640
better polyfill for closest and matches functions
Johann-S Aug 21, 2017
d8719b1
Add CustomEvent polyfill and a working preventDefault for IE
Johann-S Aug 21, 2017
2a304e4
Add namespaced events
Johann-S Aug 22, 2017
912687f
Add event delegation + fix EventHandler.one
Johann-S Aug 23, 2017
519d834
Remove jQuery from alert.js and add .alert only if jQuery is available
Johann-S Aug 23, 2017
8be9632
Disable ESlint on no-return-assign and temporary for arrow-body-style
Johann-S Aug 23, 2017
8cfd02f
fix declaration of alert jquery plugin only if jquery is available
Johann-S Aug 24, 2017
d2d3a48
Extend `SelectorEngine.find()` to include an `element` first arg.
XhmikosR Aug 23, 2017
31d7bb1
Fix detection of nativeEvents + trigger events with arguments
Johann-S Aug 26, 2017
ad1eb36
Add findOne to our SelectorEngine
Johann-S Aug 26, 2017
ee9dc4b
Fix our data storage
Johann-S Aug 26, 2017
6a9ad04
Second element of find and findOne should be optional, not the first one
Johann-S Aug 26, 2017
0702bc5
Check jQuery version only if jQuery is available
Johann-S Sep 1, 2017
547a2ff
Fix delegation events
Johann-S Sep 1, 2017
8ca6138
button without jquery
XhmikosR Aug 21, 2017
345ff29
Add polyfill for focusin and focusout
Johann-S Sep 3, 2017
05d60f4
Rewrite carousel without jquery
Johann-S Aug 24, 2017
5e88fcd
Add Manipulator object to add shortcuts for dom manipulations
Johann-S Sep 5, 2017
5ab130f
Rewritten modal without jquery (#23955)
alekitto Sep 15, 2017
2398a99
Workaround for M$ Edge resetting defaultPrevented flag upon dispatchE…
Sep 19, 2017
e471226
Rewrite Collapse without jQuery
Johann-S Sep 15, 2017
7d64824
fix unit test modal
Johann-S Sep 20, 2017
842452f
Wrap our objects into IIFE
Johann-S Sep 20, 2017
4798e83
tooltip without jquery
alekitto Sep 21, 2017
1127f4c
fix weird case with jQuery
Johann-S Oct 2, 2017
4aa51a0
fix one forgets of using jQuery in Carousel and Tooltip
Johann-S Oct 20, 2017
251d0f8
Return a new function with Util.noop
Johann-S Nov 1, 2017
dc9ecac
allow register the same handler for different delegated selectors in …
alekitto Oct 20, 2017
6d0c08e
Fix new unit test in popover
Johann-S Nov 24, 2017
51baf5c
fix chores karma
Johann-S Nov 24, 2017
f7fa26e
Dropdown without jQuery
Johann-S Sep 26, 2017
29b665d
rewritten tab without jquery
alekitto Sep 26, 2017
1286d1f
upgrade to v4 stable
Johann-S Mar 5, 2018
d48c2f3
rewritten scrollspy without jquery
alekitto Sep 25, 2017
a0c50d6
remove old references to jquery and some fixes
Johann-S Mar 11, 2018
08de845
fix(data): do not use data object in our unit tests
Johann-S Jun 7, 2018
98b544d
fix(event-handler): remove the use of our event handler in unit test
Johann-S Jun 7, 2018
448dfb3
fix(data): increase coverage for data
Johann-S Jun 9, 2018
6866380
refactor(polyfill): a file for polyfills
Johann-S Jun 9, 2018
5d4993d
fix(manipulator): increase coverage for manipulator
Johann-S Jun 9, 2018
33567bd
fix(polyfill): disable coverage for our polyfills
Johann-S Jun 11, 2018
5d6fa23
fix(event-handler): remove polyfill and move it to index
Johann-S Jun 11, 2018
f823358
fix(util): remove extend
Johann-S Jun 11, 2018
df7d7a9
fix(selector-engine): increase coverage for selector engine
Johann-S Jun 16, 2018
085731a
fix(util): increase util coverage
Johann-S Jun 16, 2018
a78802a
fix(event-handler): use Object.key for passing values in an event
Johann-S Jun 17, 2018
6540ad3
fix(unit-test): dropdown, collapse and carousel
Johann-S Jun 17, 2018
07757c1
fix(build): remove jquery in our build
Johann-S Jun 17, 2018
3b597cb
fix(carousel): on load page create a carousel
Johann-S Jun 17, 2018
fc06d22
fix(visual-test): remove jquery in them
Johann-S Jun 17, 2018
83c1160
fix(plugins): save instance in constructor
Johann-S Jun 24, 2018
cac48c4
fix(docs): remove jQuery from our docs
Johann-S Jul 19, 2018
d4954bc
chore(update): bump to 4.1.3
Johann-S Jul 25, 2018
e076462
update alert documentation without jquery (#27062)
Johann-S Aug 24, 2018
8aa25a4
Refactor util plugin and some tests
Johann-S Sep 14, 2018
dc13643
v4 without jquery: updated button, carousel, collapse docs (#27173)
aTable Sep 15, 2018
48707aa
Remove IE support and button bsChecked hack
alekitto Sep 25, 2018
5b892b9
Improve manipulator coverage
Johann-S Nov 8, 2018
9372043
remove IE from our browserlist
Johann-S Nov 9, 2018
9ca0e2b
rewrite toast plugin without jquery
Johann-S Nov 14, 2018
ae266df
use Util.makeArray in our docs
Johann-S Nov 20, 2018
1386c8c
Fix anchors wrapper.
XhmikosR Nov 20, 2018
2599bfd
Convert offcanvas.js to vanilla JS.
XhmikosR Nov 28, 2018
13ce5f2
bump to 4.2.1
Johann-S Jan 4, 2019
799bc9b
Fixed Util.jQuery: window.$ is not reliable. Both Firefox and Chrome …
Jan 16, 2019
8bce032
Use consistent arrow class (#28105)
peterblazejewicz Feb 11, 2019
0229453
Change breadcrumb item padding variable name (#28125)
astrahov Feb 11, 2019
cfcbe8a
minor jQuery.hasclass removal (#28158)
jwilson8767 Feb 11, 2019
9b927f0
4.3.1.
XhmikosR Feb 12, 2019
134fef4
remove polyfills which override browsers default
Johann-S Feb 13, 2019
3a0f615
use only dataset to get data attributes
Johann-S Feb 13, 2019
7d3828f
Remove unneeded ESLint suppression.
XhmikosR Feb 13, 2019
a2d2938
Simplify checks.
XhmikosR Feb 13, 2019
1fb3fd5
improve event handler
Johann-S Feb 14, 2019
a9540a9
remove `--compress typeofs=false` from terser.
XhmikosR Feb 15, 2019
2f982a6
Bump bundlesize limits
XhmikosR Nov 16, 2017
0eabb64
Add information about IE 11 compatibility.
Johann-S Feb 19, 2019
1fc84d3
Remove jQuery from docs/repo.
XhmikosR Feb 19, 2019
c2f0c7e
Remove Internet Explorer leftovers.
XhmikosR Feb 19, 2019
e37ef53
Remove `focusable="false"` from SVGs.
XhmikosR Feb 19, 2019
91e78b4
Remove IE-specific breadcrumb CSS hack
mdo Sep 17, 2018
080290e
Use `Util.makeArray()`.
XhmikosR Feb 19, 2019
20c6fde
download.md: reword import bootstrap section.
Johann-S Feb 20, 2019
3b4c294
use our selector engine instead of native api
Johann-S Feb 20, 2019
c7de856
forms.md: remove jQuery from snippet.
XhmikosR Feb 20, 2019
542de5d
tests/visual/modal.html: fix close button placement.
XhmikosR Feb 20, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion .browserslistrc
Expand Up @@ -6,7 +6,6 @@ not dead
Chrome >= 45
Firefox >= 38
Edge >= 12
Explorer >= 10
Johann-S marked this conversation as resolved.
Show resolved Hide resolved
iOS >= 9
Safari >= 9
Android >= 4.4
Expand Down
1 change: 0 additions & 1 deletion .eslintrc.json
Expand Up @@ -69,7 +69,6 @@
"no-param-reassign": "off",
"no-proto": "error",
"no-restricted-properties": "error",
"no-return-assign": "error",
"no-return-await": "error",
"no-script-url": "error",
"no-self-compare": "error",
Expand Down
1 change: 0 additions & 1 deletion .github/CONTRIBUTING.md
Expand Up @@ -224,7 +224,6 @@ includes code changes) and under the terms of the
- 2 spaces (no tabs)
- strict mode
- "Attractive"
- Don't use [jQuery event alias convenience methods](https://github.com/jquery/jquery/blob/master/src/event/alias.js) (such as `$().focus()`). Instead, use [`$().trigger(eventType, ...)`](https://api.jquery.com/trigger/) or [`$().on(eventType, ...)`](https://api.jquery.com/on/), depending on whether you're firing an event or listening for an event. (For example, `$().trigger('focus')` or `$().on('focus', function (event) { /* handle focus event */ })`) We do this to be compatible with custom builds of jQuery where the event aliases module has been excluded.

### Checking coding style

Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -101,7 +101,7 @@ bootstrap/
└── bootstrap.min.js.map
```

We provide compiled CSS and JS (`bootstrap.*`), as well as compiled and minified CSS and JS (`bootstrap.min.*`). [source maps](https://developers.google.com/web/tools/chrome-devtools/javascript/source-maps) (`bootstrap.*.map`) are available for use with certain browsers' developer tools. Bundled JS files (`bootstrap.bundle.js` and minified `bootstrap.bundle.min.js`) include [Popper](https://popper.js.org/), but not [jQuery](https://jquery.com/).
We provide compiled CSS and JS (`bootstrap.*`), as well as compiled and minified CSS and JS (`bootstrap.min.*`). [source maps](https://developers.google.com/web/tools/chrome-devtools/javascript/source-maps) (`bootstrap.*.map`) are available for use with certain browsers' developer tools. Bundled JS files (`bootstrap.bundle.js` and minified `bootstrap.bundle.min.js`) include [Popper](https://popper.js.org/).


## Bugs and feature requests
Expand Down
2 changes: 0 additions & 2 deletions _config.yml
Expand Up @@ -55,8 +55,6 @@ cdn:
js_hash: "sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
js_bundle: "https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.bundle.min.js"
js_bundle_hash: "sha384-xrRywqdh3PHs8keKZN+8zzc5TX0GRTLCcmivcbNJWm2rs5C8PRhcEn3czEjhAO9o"
jquery: "https://code.jquery.com/jquery-3.3.1.slim.min.js"
jquery_hash: "sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
popper: "https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
popper_hash: "sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"

Expand Down
138 changes: 123 additions & 15 deletions build/build-plugins.js
Expand Up @@ -26,6 +26,11 @@ const plugins = [
})
]
const bsPlugins = {
Data: path.resolve(__dirname, '../js/src/dom/data.js'),
EventHandler: path.resolve(__dirname, '../js/src/dom/eventHandler.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/selectorEngine.js'),
Alert: path.resolve(__dirname, '../js/src/alert.js'),
Button: path.resolve(__dirname, '../js/src/button.js'),
Carousel: path.resolve(__dirname, '../js/src/carousel.js'),
Expand All @@ -41,27 +46,130 @@ const bsPlugins = {
}
const rootPath = TEST ? '../js/coverage/dist/' : '../js/dist/'

function build(plugin) {
console.log(`Building ${plugin} plugin...`)
const defaultPluginConfig = {
external: [
bsPlugins.Data,
bsPlugins.EventHandler,
bsPlugins.SelectorEngine,
bsPlugins.Util
],
globals: {
[bsPlugins.Data]: 'Data',
[bsPlugins.EventHandler]: 'EventHandler',
[bsPlugins.SelectorEngine]: 'SelectorEngine',
[bsPlugins.Util]: 'Util'
}
}

function getConfigByPluginKey(pluginKey) {
if (
pluginKey === 'Data' ||
pluginKey === 'Manipulator' ||
pluginKey === 'Util'
) {
return {
external: [],
globals: {}
}
}

if (pluginKey === 'EventHandler' || pluginKey === 'SelectorEngine') {
return {
external: [
bsPlugins.Polyfill,
bsPlugins.Util
],
globals: {
[bsPlugins.Polyfill]: 'Polyfill',
[bsPlugins.Util]: 'Util'
}
}
}

if (pluginKey === 'Polyfill') {
return {
external: [bsPlugins.Util],
globals: {
[bsPlugins.Util]: 'Util'
}
}
}

const external = ['jquery', 'popper.js']
const globals = {
jquery: 'jQuery', // Ensure we use jQuery which is always available even in noConflict mode
'popper.js': 'Popper'
if (pluginKey === 'Alert' || pluginKey === 'Tab') {
return defaultPluginConfig
}

// Do not bundle Util in plugins
if (plugin !== 'Util') {
external.push(bsPlugins.Util)
globals[bsPlugins.Util] = 'Util'
if (
pluginKey === 'Button' ||
pluginKey === 'Carousel' ||
pluginKey === 'Collapse' ||
pluginKey === 'Modal' ||
pluginKey === 'ScrollSpy'
) {
const config = Object.assign(defaultPluginConfig)
config.external.push(bsPlugins.Manipulator)
config.globals[bsPlugins.Manipulator] = 'Manipulator'
return config
}

// Do not bundle Tooltip in Popover
if (plugin === 'Popover') {
external.push(bsPlugins.Tooltip)
globals[bsPlugins.Tooltip] = 'Tooltip'
if (pluginKey === 'Dropdown' || pluginKey === 'Tooltip') {
const config = Object.assign(defaultPluginConfig)
config.external.push(bsPlugins.Manipulator, 'popper.js')
config.globals[bsPlugins.Manipulator] = 'Manipulator'
config.globals['popper.js'] = 'Popper'
return config
}

if (pluginKey === 'Popover') {
return {
external: [
bsPlugins.Data,
bsPlugins.SelectorEngine,
bsPlugins.Tooltip,
bsPlugins.Util
],
globals: {
[bsPlugins.Data]: 'Data',
[bsPlugins.SelectorEngine]: 'SelectorEngine',
[bsPlugins.Tooltip]: 'Tooltip',
[bsPlugins.Util]: 'Util'
}
}
}

if (pluginKey === 'Toast') {
return {
external: [
bsPlugins.Data,
bsPlugins.EventHandler,
bsPlugins.Manipulator,
bsPlugins.Util
],
globals: {
[bsPlugins.Data]: 'Data',
[bsPlugins.EventHandler]: 'EventHandler',
[bsPlugins.Manipulator]: 'Manipulator',
[bsPlugins.Util]: 'Util'
}
}
}
}

function build(plugin) {
console.log(`Building ${plugin} plugin...`)

const config = getConfigByPluginKey(plugin)
const external = config.external
const globals = config.globals

const pluginPath = [
'Data',
'EventHandler',
'Manipulator',
'Polyfill',
'SelectorEngine'
].includes(plugin) ? `${rootPath}/dom/` : rootPath

const pluginFilename = `${plugin.toLowerCase()}.js`

rollup.rollup({
Expand All @@ -75,7 +183,7 @@ function build(plugin) {
name: plugin,
sourcemap: true,
globals,
file: path.resolve(__dirname, `${rootPath}${pluginFilename}`)
file: path.resolve(__dirname, `${pluginPath}${pluginFilename}`)
})
.then(() => console.log(`Building ${plugin} plugin... Done!`))
.catch((err) => console.error(`${plugin}: ${err}`))
Expand Down
6 changes: 0 additions & 6 deletions build/generate-sri.js
Expand Up @@ -17,8 +17,6 @@ const fs = require('fs')
const path = require('path')
const sh = require('shelljs')

const pkg = require('../package.json')

sh.config.fatal = true

const configFile = path.join(__dirname, '../_config.yml')
Expand All @@ -39,10 +37,6 @@ const files = [
file: 'dist/js/bootstrap.bundle.min.js',
configPropertyName: 'js_bundle_hash'
},
{
file: `site/docs/${pkg.version_short}/assets/js/vendor/jquery-slim.min.js`,
configPropertyName: 'jquery_hash'
},
{
file: 'node_modules/popper.js/dist/umd/popper.min.js',
configPropertyName: 'popper_hash'
Expand Down
3 changes: 1 addition & 2 deletions build/rollup.config.js
Expand Up @@ -8,7 +8,7 @@ const banner = require('./banner.js')
const BUNDLE = process.env.BUNDLE === 'true'

let fileDest = 'bootstrap.js'
const external = ['jquery', 'popper.js']
const external = ['popper.js']
const plugins = [
babel({
exclude: 'node_modules/**', // Only transpile our source code
Expand All @@ -22,7 +22,6 @@ const plugins = [
})
]
const globals = {
jquery: 'jQuery', // Ensure we use jQuery which is always available even in noConflict mode
'popper.js': 'Popper'
}

Expand Down
4 changes: 0 additions & 4 deletions build/svgo.yml
Expand Up @@ -15,10 +15,6 @@ js2svg:
indent: 2

plugins:
# remove this with IE 11 is no longer supported
- addAttributesToSVGElement:
attributes:
- focusable: false
- cleanupAttrs: true
- cleanupEnableBackground: true
- cleanupIDs: true
Expand Down