Skip to content

aggiornamento Javascript#4

Open
capmar00 wants to merge 6 commits intoshetechitaly:mainfrom
capmar00:jsUpdateBranch
Open

aggiornamento Javascript#4
capmar00 wants to merge 6 commits intoshetechitaly:mainfrom
capmar00:jsUpdateBranch

Conversation

@capmar00
Copy link
Member

rinfrescato il javascript aggiungendo const e let, arrow functions, differenziando qualche selettore e sostituendo qualche innerHTML

Copy link

@MelaHub MelaHub left a comment

Choose a reason for hiding this comment

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

Due commenti giusto per aiutarmi a capire cos'è cambiato - per qualche motivo github ha beccato troppi changes che in realtà penso non ci siano stati

day-01/08.html Outdated
<hr>
<button onclick="clearCompleted()" class="btn btn-default btn-xs">Clear completed</button>
</div>
<form onsubmit="createNew(event)" class="panel-heading">
Copy link

Choose a reason for hiding this comment

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

@capmar00 cos'è cambiato qui? 👀

Copy link
Member Author

@capmar00 capmar00 Oct 6, 2021

Choose a reason for hiding this comment

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

può essere che segni più cambiamenti di quelli effettivi perché lo consideravo un mio file personale ed ero andata avanti a fare modifiche che poi non ho integrato nella pull request.

  • ho messo il tag template nel body e ho aggiornato la funzione renderItem di conseguenza
  • ho trasformato tutte le funzioni in arrow function e le ho definite come costanti

Copy link
Member Author

Choose a reason for hiding this comment

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

nel weekend posso rifarlo dal file di partenza, così almeno segna solo i cambiamenti effettivi

day-01/08.html Outdated

updateList(listItems, true);
}
const loadList = () => {
Copy link

Choose a reason for hiding this comment

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

Mi riesci a rimettere l'indentazione com'era prima? Così

  1. riesco a vedere meglio cos'è cambiato
  2. rimane indentato rispetto al tag

listElement.innerHTML += renderItem(item);
const updateList = (items, save) => {
const listElement = document.querySelector("#task-list");
while (listElement.firstChild) listElement.removeChild(listElement.firstChild);
Copy link

Choose a reason for hiding this comment

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

😍

const renderItem = (item) => {
const template = document.getElementById("item-template");
const instance = document.importNode(template.content, true);
instance.querySelector(".list-group-item > span").innerText = item.text;
Copy link

Choose a reason for hiding this comment

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

@capmar00 forse qui possiamo togliere allora i placeholder TEXT e COMPLETED nell'html?

items.forEach(function(item) {
listElement.innerHTML += renderItem(item);
const updateList = (items, save) => {
const listElement = document.querySelector("#task-list");
Copy link

@MelaHub MelaHub Oct 18, 2021

Choose a reason for hiding this comment

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

Come mai stai dichiarando i const dappertutto quando non sono const?
Mi spiego - listElement la stiamo modificando - non sarebbe più opportuno lasciarla var?

Correzione del martedì mattina - qua sarebbe opportuno usare let invece di const

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