Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion 01/app.js
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
console.log('DOM');
console.log('DOM');
const comments = document.querySelector('.comments__item.comments__item--newest');

if (comments) {
const elementsWithDataInfo = comments.querySelectorAll('[data-info]');
console.log('The number of elements that have the attribute data-info:', elementsWithDataInfo.length);
}
17 changes: 16 additions & 1 deletion 02/app.js
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
console.log('DOM');
document.addEventListener('DOMContentLoaded', function () {
const links = document.querySelectorAll('a[data-url]');

links.forEach(link => {
const url = link.getAttribute('data-url');

if (url !== 'null') {
link.setAttribute('href', url);
} else {
link.style.color = 'grey';
link.addEventListener('click', function (event) {
event.preventDefault();
});
}
});
});