From 398ddedac77d38e6f8cb652fdbe6b853ef3cb109 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Mon, 23 Nov 2020 09:45:46 +0200 Subject: [PATCH] Manually backport #32226 docs: use `event` instead of `e` --- site/content/docs/4.5/components/list-group.md | 10 +++++----- site/content/docs/4.5/components/modal.md | 2 +- site/content/docs/4.5/components/navs.md | 10 +++++----- site/content/docs/4.5/getting-started/javascript.md | 8 ++++---- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/site/content/docs/4.5/components/list-group.md b/site/content/docs/4.5/components/list-group.md index 48a1fa0997..a064f0ee3f 100644 --- a/site/content/docs/4.5/components/list-group.md +++ b/site/content/docs/4.5/components/list-group.md @@ -281,8 +281,8 @@ You can activate a list group navigation without writing any JavaScript by simpl Enable tabbable list item via JavaScript (each list item needs to be activated individually): ```js -$('#myList a').on('click', function (e) { - e.preventDefault() +$('#myList a').on('click', function (event) { + event.preventDefault() $(this).tab('show') }) ``` @@ -384,8 +384,8 @@ If no tab was already active, the `hide.bs.tab` and `hidden.bs.tab` events will ```js -$('a[data-toggle="list"]').on('shown.bs.tab', function (e) { - e.target // newly activated tab - e.relatedTarget // previous active tab +$('a[data-toggle="list"]').on('shown.bs.tab', function (event) { + event.target // newly activated tab + event.relatedTarget // previous active tab }) ``` diff --git a/site/content/docs/4.5/components/modal.md b/site/content/docs/4.5/components/modal.md index ac564a9ed4..92a56ddd0a 100644 --- a/site/content/docs/4.5/components/modal.md +++ b/site/content/docs/4.5/components/modal.md @@ -820,7 +820,7 @@ Bootstrap's modal class exposes a few events for hooking into modal functionalit ```js -$('#myModal').on('hidden.bs.modal', function (e) { +$('#myModal').on('hidden.bs.modal', function (event) { // do something... }) ``` diff --git a/site/content/docs/4.5/components/navs.md b/site/content/docs/4.5/components/navs.md index 9faedb598d..322d1b780d 100644 --- a/site/content/docs/4.5/components/navs.md +++ b/site/content/docs/4.5/components/navs.md @@ -526,8 +526,8 @@ You can activate a tab or pill navigation without writing any JavaScript by simp Enable tabbable tabs via JavaScript (each tab needs to be activated individually): ```js -$('#myTab a').on('click', function (e) { - e.preventDefault() +$('#myTab a').on('click', function (event) { + event.preventDefault() $(this).tab('show') }) ``` @@ -645,8 +645,8 @@ If no tab was already active, then the `hide.bs.tab` and `hidden.bs.tab` events ```js -$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { - e.target // newly activated tab - e.relatedTarget // previous active tab +$('a[data-toggle="tab"]').on('shown.bs.tab', function (event) { + event.target // newly activated tab + event.relatedTarget // previous active tab }) ``` diff --git a/site/content/docs/4.5/getting-started/javascript.md b/site/content/docs/4.5/getting-started/javascript.md index 015ea5fdb2..faa01c48df 100644 --- a/site/content/docs/4.5/getting-started/javascript.md +++ b/site/content/docs/4.5/getting-started/javascript.md @@ -48,9 +48,9 @@ Bootstrap provides custom events for most plugins' unique actions. Generally, th All infinitive events provide [`preventDefault()`](https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault) functionality. This provides the ability to stop the execution of an action before it starts. Returning false from an event handler will also automatically call `preventDefault()`. ```js -$('#myModal').on('show.bs.modal', function (e) { +$('#myModal').on('show.bs.modal', function (event) { if (!data) { - return e.preventDefault() // stops modal from being shown + return event.preventDefault() // stops modal from being shown } }) ``` @@ -80,7 +80,7 @@ All programmatic API methods are **asynchronous** and return to the caller once In order to execute an action once the transition is complete, you can listen to the corresponding event. ```js -$('#myCollapse').on('shown.bs.collapse', function (e) { +$('#myCollapse').on('shown.bs.collapse', function (event) { // Action to execute once the collapsible area is expanded }) ``` @@ -88,7 +88,7 @@ $('#myCollapse').on('shown.bs.collapse', function (e) { In addition a method call on a **transitioning component will be ignored**. ```js -$('#myCarousel').on('slid.bs.carousel', function (e) { +$('#myCarousel').on('slid.bs.carousel', function (event) { $('#myCarousel').carousel('2') // Will slide to the slide 2 as soon as the transition to slide 1 is finished })