-
Notifications
You must be signed in to change notification settings - Fork 172
All tasks js-dom-elements finished #152
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "liveServer.settings.port": 5502 | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,8 @@ | ||
| console.log('DOM'); | ||
| console.log('DOM'); | ||
|
|
||
| const commentsElements = document.querySelector('.comments__item.comments__item--newest'); | ||
| if(commentsElements) { | ||
| const dataInfoEl = commentsElements.querySelectorAll('[data-info]'); | ||
| console.log(dataInfoEl.length); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,7 @@ | ||
| console.log('DOM'); | ||
| console.log('DOM'); | ||
|
|
||
| const linksEl = document.querySelectorAll('a[data-url]'); | ||
| linksEl.forEach(function(link, index) { | ||
| const dataUrl = link.getAttribute('data-url'); | ||
| link.setAttribute('href', dataUrl) | ||
| }) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,4 +11,36 @@ const buttonSettings = { | |
| color: '#444' | ||
| }, | ||
| text: 'Click me!', | ||
| } | ||
| } | ||
|
|
||
|
|
||
| const buttonSection = document.querySelector('.parent-for-button') | ||
|
|
||
|
|
||
| // if(buttonSection) { | ||
| // const button = document.createElement('button'); | ||
|
|
||
| // button.classList.add(buttonSettings.attr.className); | ||
| // button.title = buttonSettings.attr.title; | ||
| // button.style.border = buttonSettings.css.border; | ||
| // button.style.padding = buttonSettings.css.padding; | ||
| // button.style.color = buttonSettings.css.color; | ||
| // button.textContent = buttonSettings.text; | ||
|
|
||
| // buttonSection.appendChild(button) | ||
| // } | ||
|
|
||
|
|
||
| const button = document.createElement('button'); | ||
|
|
||
| for(let key in buttonSettings.attr) { | ||
| button.setAttribute(key, buttonSettings.attr[key]) | ||
| } | ||
| for(let key in buttonSettings.css) { | ||
| button.setAttribute(key, buttonSettings.css[key]) | ||
| } | ||
|
|
||
| button.textContent = buttonSettings.text; | ||
|
|
||
| buttonSection.appendChild(button) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,4 +5,35 @@ const menuItems = [ | |
| {text: 'start', url: '/'}, | ||
| {text: 'galeria', url: '/gallery'}, | ||
| {text: 'kontakt', url: '/contact'}, | ||
| ]; | ||
| ]; | ||
|
|
||
|
|
||
| const navElement = document.querySelector('nav'); | ||
| if(navElement) { | ||
| const ulElement = document.createElement('ul'); | ||
| if(ulElement) { | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Uwaga na odpowiednie formatowanie - tutaj powinien byc odstęp od lewej krawędzi. |
||
| menuItems.forEach( function(item) { | ||
| const liElement = document.createElement('li') | ||
| const linkElement = document.createElement('a') | ||
| linkElement.setAttribute('href', item.url) | ||
| linkElement.innerText = item.text | ||
| liElement.appendChild(linkElement) | ||
| ulElement.appendChild(liElement) | ||
|
|
||
| } ) | ||
|
|
||
|
|
||
| // for(let key in menuItems) { | ||
| // const liElement = document.createElement('li') | ||
| // const linkElement = document.createElement('a') | ||
| // linkElement.setAttribute('href', menuItems[key].url) | ||
| // linkElement.innerText = menuItems[key].text | ||
| // liElement.appendChild(linkElement) | ||
| // ulElement.appendChild(liElement) | ||
|
|
||
| // } | ||
| } | ||
|
|
||
| navElement.appendChild(ulElement) | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,36 @@ | ||
| console.log('DOM'); | ||
|
|
||
| const curr = document.querySelector('.js-curr'); | ||
| if(curr) { | ||
| const buttonsParent = curr.parentElement | ||
| const nextButton = document.createElement('button'); | ||
|
|
||
| nextButton.innerText = 'Usuń z koszyka' | ||
|
|
||
| buttonsParent.appendChild(nextButton); | ||
|
|
||
| for(let i = 0; i < buttonsParent.children.length; i++) { | ||
| if(buttonsParent.children[i] !== curr) { | ||
| buttonsParent.children[i].classList.add('.siblings') | ||
| } | ||
| } | ||
|
|
||
| buttonsParent.nextElementSibling.setAttribute('title', 'nextElementSibling') | ||
|
|
||
| const buttonsParentParent = buttonsParent.parentElement | ||
| const lastArticle = buttonsParentParent.lastElementChild | ||
| const lastButton = lastArticle.querySelector('button') | ||
| const pEl = document.createElement('p') | ||
|
|
||
| pEl.innerText = 'Paragraf przed buttonem' | ||
| lastArticle.insertBefore(pEl, lastButton) | ||
|
|
||
|
|
||
| const article = buttonsParentParent.querySelector('article') | ||
| const newArticle = article.cloneNode(true) | ||
|
|
||
| buttonsParentParent.insertBefore(newArticle, buttonsParentParent.firstElementChild) | ||
|
|
||
|
|
||
|
|
||
| } | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍