2.6 KiB
id | title | challengeType | dashedName |
---|---|---|---|
5dfb6250eacea3f48c6300b2 | Passo 21 | 0 | step-21 |
--description--
Após a lista não ordenada, adicione uma nova imagem com o valor do atributo src
definido como:
https://cdn.freecodecamp.org/curriculum/cat-photo-app/lasagna.jpg
Além disso, defina o valor do atributo alt
como:
A slice of lasagna on a plate.
--hints--
Deve haver um elemento img
logo após a tag de fechamento </ul>
.
assert($('section')[1].lastElementChild.nodeName === 'IMG');
A nova imagem não tem um atributo alt
. Verifique se há um espaço depois do nome da tag de abertura e/ou se há espaços antes de todos os nomes dos atributos.
assert($('section')[1].lastElementChild.hasAttribute('alt'));
A nova imagem deve ter o valor de alt
como sendo A slice of lasagna on a plate.
Certifique-se de que o valor de alt
do atributo esteja cercado com aspas.
assert(
$('section')[1]
.lastElementChild.getAttribute('alt')
.replace(/\s+/g, ' ')
.match(/^A slice of lasagna on a plate\.?$/i)
);
A nova imagem não tem um atributo src
. Verifique se há um espaço depois do nome da tag de abertura e/ou se há espaços antes de todos os nomes dos atributos.
assert($('section')[1].lastElementChild.hasAttribute('src'));
A nova imagem deve ter um valor de src
de https://cdn.freecodecamp.org/curriculum/cat-photo-app/lasagna.jpg
. Certifique-se de que o valor do atributo src
esteja cercado com aspas.
assert(
$('section')[1].lastElementChild.getAttribute('src') ===
'https://cdn.freecodecamp.org/curriculum/cat-photo-app/lasagna.jpg'
);
Embora você tenha definido o valor de src
com o URL correto, é recomendável sempre cercar o valor de um atributo com aspas.
assert(!/\<img\s+.+\s+src\s*=\s*https:\/\/cdn\.freecodecamp\.org\/curriculum\/cat-photo-app\/lasagna\.jpg/.test(code));
--seed--
--seed-contents--
<html>
<body>
<h1>CatPhotoApp</h1>
<main>
<section>
<h2>Cat Photos</h2>
<!-- TODO: Add link to cat photos -->
<p>Click here to view more <a target="_blank" href="https://freecatphotoapp.com">cat photos</a>.</p>
<a href="https://freecatphotoapp.com"><img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" alt="A cute orange cat lying on its back."></a>
</section>
<section>
<h2>Cat Lists</h2>
<h3>Things cats love:</h3>
--fcc-editable-region--
<ul>
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>
--fcc-editable-region--
</section>
</main>
</body>
</html>