Modifying the document by HachemiH · Pull Request #186 · javascript-tutorial/fr.javascript.info
16 changes: 8 additions & 8 deletions
2-ui/1-document/07-modifying-document/10-clock-setinterval/solution.md
6 changes: 3 additions & 3 deletions
2-ui/1-document/07-modifying-document/10-clock-setinterval/task.md
4 changes: 2 additions & 2 deletions
2-ui/1-document/07-modifying-document/11-append-to-list/solution.md
4 changes: 2 additions & 2 deletions
2-ui/1-document/07-modifying-document/11-append-to-list/task.md
14 changes: 7 additions & 7 deletions
2-ui/1-document/07-modifying-document/12-sort-table/solution.md
8 changes: 4 additions & 4 deletions
2-ui/1-document/07-modifying-document/12-sort-table/task.md
10 changes: 5 additions & 5 deletions
2-ui/1-document/07-modifying-document/4-clear-elem/solution.md
8 changes: 4 additions & 4 deletions
2-ui/1-document/07-modifying-document/4-clear-elem/task.md
10 changes: 5 additions & 5 deletions
2-ui/1-document/07-modifying-document/5-why-aaa/solution.md
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| The HTML in the task is incorrect. That's the reason of the odd thing. | ||
| Le code HTML de cette tâche est incorrect. Voilà la raison de la chose étrange. | ||
|
|
||
| The browser has to fix it automatically. But there may be no text inside the `<table>`: according to the spec only table-specific tags are allowed. So the browser adds `"aaa"` *before* the `<table>`. | ||
| Le navigateur doit le réparer automatiquement. Mais il peut ne pas y avoir de texte à l'intérieur de la `<table>` : selon la spécification, seules les balises spécifiques à la table sont autorisées. Le navigateur ajoute donc `"aaa"` *avant* la `<table>`. | ||
|
|
||
| Now it's obvious that when we remove the table, it remains. | ||
| Maintenant, il est évident que lorsque nous retirons la `table`, la chaîne de caractères reste. | ||
|
|
||
| The question can be easily answered by exploring the DOM using the browser tools. It shows `"aaa"` before the `<table>`. | ||
| La question peut être facilement répondue en explorant le DOM à l'aide des outils du navigateur. Il montre `"aaa"` avant la `<table>`. | ||
|
|
||
| The HTML standard specifies in detail how to process bad HTML, and such behavior of the browser is correct. | ||
| Le standard HTML spécifie en détail comment traiter un mauvais HTML, et un tel comportement du navigateur est correct. |
12 changes: 6 additions & 6 deletions
2-ui/1-document/07-modifying-document/5-why-aaa/task.md
2 changes: 1 addition & 1 deletion
2-ui/1-document/07-modifying-document/6-create-list/solution.md
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| Please note the usage of `textContent` to assign the `<li>` content. | ||
| Veuillez noter l'utilisation de `textContent` pour attribuer le contenu `<li>`. |
16 changes: 8 additions & 8 deletions
2-ui/1-document/07-modifying-document/6-create-list/task.md
6 changes: 3 additions & 3 deletions
2-ui/1-document/07-modifying-document/7-create-object-tree/solution.md
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| The easiest way to walk the object is to use recursion. | ||
| La façon la plus simple de parcourir l'objet est d'utiliser la récursivité. | ||
|
|
||
| 1. [The solution with innerHTML](sandbox:innerhtml). | ||
| 2. [The solution with DOM](sandbox:build-tree-dom). | ||
| 1. [La solution avec innerHTML](https://plnkr.co/edit/PzjPAk9yKHeKkT36?p=preview). | ||
| 2. [La solution avec DOM](https://plnkr.co/edit/e3TEVqQrm7ZqZkn6?p=preview). |
22 changes: 11 additions & 11 deletions
2-ui/1-document/07-modifying-document/7-create-object-tree/task.md
2 changes: 1 addition & 1 deletion
2-ui/1-document/07-modifying-document/8-tree-count/solution.md
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| To append text to each `<li>` we can alter the text node `data`. | ||
| Pour ajouter du texte à chaque `<li>`, nous pouvons modifier le nœud texte `data`. |
8 changes: 4 additions & 4 deletions
2-ui/1-document/07-modifying-document/8-tree-count/task.md
14 changes: 7 additions & 7 deletions
2-ui/1-document/07-modifying-document/9-calendar-table/solution.md
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| We'll create the table as a string: `"<table>...</table>"`, and then assign it to `innerHTML`. | ||
| Nous allons créer le tableau sous forme de chaîne de caractères : `"<table>...</table>"`, puis l'affecter à `innerHTML`. | ||
|
|
||
| The algorithm: | ||
| L'algorithme : | ||
|
|
||
| 1. Create the table header with `<th>` and weekday names. | ||
| 2. Create the date object `d = new Date(year, month-1)`. That's the first day of `month` (taking into account that months in JavaScript start from `0`, not `1`). | ||
| 3. First few cells till the first day of the month `d.getDay()` may be empty. Let's fill them in with `<td></td>`. | ||
| 4. Increase the day in `d`: `d.setDate(d.getDate()+1)`. If `d.getMonth()` is not yet the next month, then add the new cell `<td>` to the calendar. If that's a Sunday, then add a newline <code>"</tr><tr>"</code>. | ||
| 5. If the month has finished, but the table row is not yet full, add empty `<td>` into it, to make it square. | ||
| 1. Créer l'en-tête du tableau avec les noms `<th>` et les jours de la semaine. | ||
| 2. Créez l'objet de date `d = new Date(year, month-1)`. C'est le premier jour de `month` (en tenant compte du fait que les mois en JavaScript commencent à `0`, pas à `1`). | ||
| 3. Les premières cellules jusqu'au premier jour du mois `d.getDay()` peuvent être vides. Remplissons-les avec `<td></td>`. | ||
| 4. Augmentez le jour en `d`: `d.setDate(d.getDate()+1)`. Si `d.getMonth()` n'est pas encore le mois suivant, alors ajoutez la nouvelle cellule `<td>` au calendrier. Si c'est un dimanche, ajoutez une nouvelle ligne <code>"</tr><tr>"</code>. | ||
| 5. Si le mois est terminé, mais que la ligne du tableau n'est pas encore pleine, ajoutez-y un `<td>` vide pour le rendre carré. |
12 changes: 6 additions & 6 deletions
2-ui/1-document/07-modifying-document/9-calendar-table/task.md