Skip to content

done#155

Open
Dariadaria01 wants to merge 6 commits intodevmentor-pl:masterfrom
Dariadaria01:master
Open

done#155
Dariadaria01 wants to merge 6 commits intodevmentor-pl:masterfrom
Dariadaria01:master

Conversation

@Dariadaria01
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown
Owner

@devmentor-pl devmentor-pl left a comment

Choose a reason for hiding this comment

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

Dario,

Bardzo dobrze sobie poradziłaś z zadaniami! 👍
Zostawiłem parę drobnych uwag w komentarzach.

);
const dataInfo = classElement.querySelectorAll('[data-info]');
console.log(dataInfo.length);
}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

👍

02/app.js Outdated
const linksEl = document.querySelectorAll('[data-url]');
linksEl.forEach((link) => {
const url = link.dataset.url;
if (url && url !== 'null') {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

To sprawdzenie nie jest potrzebne - szykujesz elementy tylko z odpowiednim atrybutem tj data-url więc jak on nie będzie istniał to element nie zostanie wyszukany.

Zamiast linii od 6 do 9, wystarczy sama linia nr 7

const parentElement = document.querySelector('.parent-for-button');
if (parentElement) {
parentElement.appendChild(button);
}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

👍

const navElement = document.querySelector('nav');
const ulElement = document.createElement('ul');

menuItems.forEach((item) => {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Jak widać zdecydowanie wygodniej i lepiej używać pętli :)
Czasami trzeba rozpisać sobie krok po kroku, aby użyć pętli - to nie jest źle, ale ostateczna wersja powinna być z wykorzystaniem pętli.


const articlesContainer = document.querySelector('.articles');

articlesContainer.insertBefore(newArticle, articlesContainer.firstChild);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

👍

Copy link
Copy Markdown
Owner

@devmentor-pl devmentor-pl left a comment

Choose a reason for hiding this comment

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

👍

} else {
link.setAttribute('href', '#');
}
link.setAttribute('href', url);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants