113 lines
2.0 KiB
Markdown
113 lines
2.0 KiB
Markdown
|
---
|
||
|
id: 60b69a66b6ddb80858c51578
|
||
|
title: Step 1
|
||
|
challengeType: 0
|
||
|
dashedName: step-1
|
||
|
---
|
||
|
|
||
|
# --description--
|
||
|
|
||
|
Inizia impostando la struttura HTML di base. Aggiungi una dichiarazione `<!DOCTYPE>` e un elemento `html`. All'interno dell'elemento `html`, aggiungi un elemento `head` e un elemento `body`.
|
||
|
|
||
|
# --hints--
|
||
|
|
||
|
Il codice dovrebbe contenere il riferimento `DOCTYPE`.
|
||
|
|
||
|
```js
|
||
|
assert(code.match(/<!DOCTYPE/gi));
|
||
|
```
|
||
|
|
||
|
Dovresti includere uno spazio dopo il riferimento `DOCTYPE`.
|
||
|
|
||
|
```js
|
||
|
assert(code.match(/<!DOCTYPE\s+/gi));
|
||
|
```
|
||
|
|
||
|
Dovresti definire il tipo di documento come `html`.
|
||
|
|
||
|
```js
|
||
|
assert(code.match(/html/gi));
|
||
|
```
|
||
|
|
||
|
Dovresti chiudere la dichiarazione `DOCTYPE` con un carattere `>`.
|
||
|
|
||
|
```js
|
||
|
assert(code.match(/html\s*>/gi));
|
||
|
```
|
||
|
|
||
|
La dichiarazione `DOCTYPE` dovrebbe essere all'inizio dell'HTML.
|
||
|
|
||
|
```js
|
||
|
assert(__helpers.removeHtmlComments(code).match(/^\s*<!DOCTYPE\s+html\s*>/i));
|
||
|
```
|
||
|
|
||
|
L'elemento `html` dovrebbe avere un tag di apertura.
|
||
|
|
||
|
```js
|
||
|
assert(code.match(/<html\s*>/gi));
|
||
|
```
|
||
|
|
||
|
L'elemento `html` dovrebbe avere un tag di chiusura.
|
||
|
|
||
|
```js
|
||
|
assert(code.match(/<\/html\s*>/));
|
||
|
```
|
||
|
|
||
|
Dovresti avere un tag `head` di apertura.
|
||
|
|
||
|
```js
|
||
|
assert(code.match(/<head\s*>/i));
|
||
|
```
|
||
|
|
||
|
Dovresti avere un tag `head` di chiusura.
|
||
|
|
||
|
```js
|
||
|
assert(code.match(/<\/head\s*>/i));
|
||
|
```
|
||
|
|
||
|
Dovresti avere un tag `body` di apertura.
|
||
|
|
||
|
```js
|
||
|
assert(code.match(/<body\s*>/i));
|
||
|
```
|
||
|
|
||
|
Dovresti avere un tag `body` di chiusura.
|
||
|
|
||
|
```js
|
||
|
assert(code.match(/<\/body\s*>/i));
|
||
|
```
|
||
|
|
||
|
Gli elementi `head` e `body` dovrebbero essere fratelli.
|
||
|
|
||
|
```js
|
||
|
assert(document.querySelector('head')?.nextElementSibling?.localName === 'body');
|
||
|
```
|
||
|
|
||
|
L'elemento `head` dovrebbe essere all'interno dell'elemento `html`.
|
||
|
|
||
|
```js
|
||
|
assert([...document.querySelector('html')?.children].some(x => x?.localName === 'head'));
|
||
|
```
|
||
|
|
||
|
L'elemento `body` dovrebbe essere all'interno dell'elemento `html`.
|
||
|
|
||
|
```js
|
||
|
assert([...document.querySelector('html')?.children].some(x => x?.localName === 'body'));
|
||
|
```
|
||
|
|
||
|
# --seed--
|
||
|
|
||
|
## --seed-contents--
|
||
|
|
||
|
```html
|
||
|
|
||
|
--fcc-editable-region--
|
||
|
|
||
|
--fcc-editable-region--
|
||
|
|
||
|
```
|
||
|
|
||
|
```css
|
||
|
|
||
|
```
|