Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rocketship_core
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
rocketship_core
Merge requests
!100
Issue
#3374575
: Replace jquery.once by core/once
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Issue
#3374575
: Replace jquery.once by core/once
issue/rocketship_core-3374575:3374575-replace-jquery-once
into
8.x-1.x
Overview
0
Commits
1
Pipelines
0
Changes
3
Merged
Frantisek Trusa
requested to merge
issue/rocketship_core-3374575:3374575-replace-jquery-once
into
8.x-1.x
1 year ago
Overview
0
Commits
1
Pipelines
0
Changes
3
Expand
0
0
Merge request reports
Compare
8.x-1.x
8.x-1.x (base)
and
latest version
latest version
db0ff0cd
1 commit,
1 year ago
3 files
+
26
−
19
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
js/expanded-asymmetric-paragraphs.js
+
11
−
10
Options
@@ -7,26 +7,27 @@
* Drupal behaviors:
*
* Means the JS is loaded when page is first loaded
* + during AJAX requests (for newly added content)
* use jQuery's "once" to avoid processing the same element multiple times
* http: *api.jquery.com/one/
* \+ during AJAX requests (for newly added content)
* use "once" to avoid processing the same element multiple times
* use the "context" param to limit scope, by default this will return document
* use the "settings" param to get stuff set via the theme hooks and such.
*
*
* Avoid multiple triggers by using
jQuery
Once
* Avoid multiple triggers by using Once
*
* EXAMPLE 1:
*
* $('.some-link', context).once('js-once-my-behavior').click(function () {
* // Code here will only be applied once
* once('js-once-my-behavior', '.some-link', context).forEach(function(element) {
* $(element).click(function () {
* // Code here will only be applied once
* });
* });
*
* EXAMPLE 2:
*
*
$('.some-element', context).once('js-once-my-behavior').e
ach(function () {
*
once('js-once-my-behavior', '.some-element', context).forE
ach(function (
element
) {
* // The following click-binding will only be applied once
*
*
});
* });
*/
(
function
(
$
,
Drupal
,
window
,
document
)
{
@@ -73,10 +74,10 @@
var
items
=
list
.
children
(
'
li
'
);
items
.
once
(
'
js-once-p-dialog-list
'
).
e
ach
(
function
()
{
once
(
'
js-once-p-dialog-list
'
).
forE
ach
(
function
(
itemElement
)
{
// hover or touch on the info-icon, toggles up the description and closes all others that are open
var
item
=
$
(
this
),
var
item
=
$
(
itemElement
),
trigger
=
item
.
find
(
'
.paragraphs-add-dialog-row__description__icon
'
),
tooltip
=
item
.
find
(
'
.paragraphs-add-dialog-row__description__content
'
);
Loading