100 lines
2.1 KiB
Markdown
100 lines
2.1 KiB
Markdown
|
---
|
||
|
id: 60f0286404aefb0562a4fdf9
|
||
|
title: Passo 4
|
||
|
challengeType: 0
|
||
|
dashedName: step-4
|
||
|
---
|
||
|
|
||
|
# --description--
|
||
|
|
||
|
Adicione um elemento `title` ao `head`e dê ao projeto um título de `Registration Form`. Da mesma forma, aninhe um elemento `link` de fechamento automático ao elemento `head`. Dê a ele um atributo `rel` com o valor `stylesheet`, um atributo `type` com o valor `text/css` e um atributo `href` com o valor `styles.css`.
|
||
|
|
||
|
# --hints--
|
||
|
|
||
|
O código deve ter um elemento `title`.
|
||
|
|
||
|
```js
|
||
|
const title = document.querySelector('title');
|
||
|
assert.exists(title);
|
||
|
```
|
||
|
|
||
|
O elemento `title` deve estar dentro do elemento `head`.
|
||
|
|
||
|
```js
|
||
|
assert.exists(document.querySelector('head > title'));
|
||
|
```
|
||
|
|
||
|
O projeto deve ter o título `Registration Form`.
|
||
|
|
||
|
```js
|
||
|
const title = document.querySelector('title');
|
||
|
assert.equal(title.text.toLowerCase(), 'registration form')
|
||
|
```
|
||
|
|
||
|
Lembre-se, maiúsculas, minúsculas e a ortografia são importantes para o título.
|
||
|
|
||
|
```js
|
||
|
const title = document.querySelector('title');
|
||
|
assert.equal(title.text, 'Registration Form');
|
||
|
```
|
||
|
|
||
|
O código deve ter um elemento `link`.
|
||
|
|
||
|
```js
|
||
|
assert.match(code, /<link/)
|
||
|
```
|
||
|
|
||
|
Você não deve alterar as tags `head` existentes. Verifique se você não excluiu a tag de fechamento.
|
||
|
|
||
|
```js
|
||
|
const heads = document.querySelectorAll('head');
|
||
|
assert.equal(heads?.length, 1);
|
||
|
```
|
||
|
|
||
|
O elemento `link` deve ser um elemento de fechamento automático.
|
||
|
|
||
|
```js
|
||
|
assert(code.match(/<link[\w\W\s]+\/>/i));
|
||
|
```
|
||
|
|
||
|
O elemento `link` deve estar dentro do elemento `head`.
|
||
|
|
||
|
```js
|
||
|
assert(code.match(/<head>[\w\W\s]*<link[\w\W\s]*\/>[\w\W\s]*<\/head>/i))
|
||
|
```
|
||
|
|
||
|
O elemento `link` deve ter um atributo `rel` com o valor `stylesheet`.
|
||
|
|
||
|
```js
|
||
|
assert.match(code, /<link[\s\S]*?rel=('|"|`)stylesheet\1/)
|
||
|
```
|
||
|
|
||
|
O elemento `link` deve ter um atributo `type` com o valor `text/css`.
|
||
|
|
||
|
```js
|
||
|
assert.match(code, /<link[\s\S]*?type=('|"|`)text\/css\1/)
|
||
|
```
|
||
|
|
||
|
O elemento `link` deve ter um atributo `href` com o valor `styles.css`.
|
||
|
|
||
|
```js
|
||
|
assert.match(code, /<link[\s\S]*?href=('|"|`)(\.\/)?styles\.css\1/)
|
||
|
```
|
||
|
|
||
|
# --seed--
|
||
|
|
||
|
## --seed-contents--
|
||
|
|
||
|
```html
|
||
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
--fcc-editable-region--
|
||
|
<head>
|
||
|
|
||
|
</head>
|
||
|
<body>
|
||
|
</body>
|
||
|
--fcc-editable-region--
|
||
|
</html>
|
||
|
```
|