Skip to content

Removing outdated jQuery note #16080

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

Merged
merged 2 commits into from
Jan 16, 2022
Merged

Removing outdated jQuery note #16080

merged 2 commits into from
Jan 16, 2022

Conversation

ThomasLandauer
Copy link
Contributor

Looks like this was just forgotten at #15455

The other text I deleted merely repeated what has already been said above:

Now let the users add as many tag forms as they need directly in the browser.

@@ -305,17 +300,17 @@ you'll replace with a unique, incrementing number (e.g. ``task[tags][3][name]``)
const addFormToCollection = (e) => {
const collectionHolder = document.querySelector('.' + e.currentTarget.dataset.collectionHolderClass);

const item = document.createElement('li');
const element = document.createElement('li');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not call the variable listItem everywhere instead?

Suggested change
const element = document.createElement('li');
const listItem = document.createElement('li');

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Short answer: Cause it might also be a <div> (or whatever).

Long answer: I really like how @Oipnet in #15455 added the data-index attribute to Twig to get it out of JavaScript. So the only implementation-specific thing that's left in JavaScript is the HTML element to be added. I even thought about adding a data-element attribute for that... In the end, I just changed the variable name to something very generic :-)

@wouterj
Copy link
Member

wouterj commented Jan 16, 2022

Thank you @ThomasLandauer! Fyi, I've reverted some of the changes (e.g. I think "item" is generic enough already, while still giving some sort of idea if we're talking about the collection holder or a collection item).

@wouterj wouterj merged commit c24a03e into symfony:5.3 Jan 16, 2022
@ThomasLandauer ThomasLandauer deleted the patch-31 branch January 16, 2022 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants