Skip to content

Commit f13bebd

Browse files
a2937gikf
andauthored
feat(curriculum) : no jQuery cat photo app (freeCodeCamp#55908)
Co-authored-by: Krzysztof G. <[email protected]>
1 parent 214f506 commit f13bebd

34 files changed

+148
-160
lines changed

curriculum/challenges/english/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfa2407b521be39a3de7be1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Add a `target` attribute with the value `_blank` to the anchor (`a`) element's o
2424
Your `p` element should have a nested anchor (`a`) element with the text `cat photos`. You may have deleted it or have a typo.
2525

2626
```js
27-
const anchor = $('p > a');
27+
const anchor = document.querySelectorAll('p > a');
2828
assert(
2929
anchor.length &&
3030
anchor[0].innerText.toLowerCase().replace(/\s+/g, ' ') === 'cat photos'

curriculum/challenges/english/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfa37b9eacea3f48c6300b0.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ assert(code.match(/<\/ul>/));
2828
The `ul` element should be above the second `section` element's closing tag.
2929

3030
```js
31-
const secondSectionLastElemNode = $('main > section')[1].lastElementChild;
32-
assert(secondSectionLastElemNode.nodeName === 'UL');
31+
const secondSectionLastElemNode = document.querySelectorAll('main > section')?.[1]?.lastElementChild;
32+
assert.equal(secondSectionLastElemNode?.nodeName , 'UL');
3333
```
3434
3535
# --seed--

curriculum/challenges/english/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfb5ecbeacea3f48c6300b1.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ Within the `ul` element nest three list items to display three things cats love:
2929
You should have three `li` elements. Each `li` element should have its own opening and closing tag.
3030

3131
```js
32-
assert($('li').length === 3 && code.match(/<\/li\>/g).length === 3);
32+
assert.lengthOf(document.querySelectorAll('li'),3)
33+
assert.lengthOf(code.match(/<\/li\>/g),3);
3334
```
3435

3536
You should have three `li` elements with the text `cat nip`, `laser pointers` and `lasagna` in any order. You have either omitted some text or have a typo.

curriculum/challenges/english/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfb6250eacea3f48c6300b2.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@ And its `alt` attribute value to:
2020
There should be an `img` element right after the closing `</ul>` tag.
2121

2222
```js
23-
assert($('section')[1].lastElementChild.nodeName === 'IMG');
23+
assert.equal(document.querySelectorAll('section')?.[1]?.lastElementChild?.nodeName, 'IMG');
2424
```
2525
2626
The new image does not have an `alt` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
2727
2828
```js
29-
assert($('section')[1].lastElementChild.hasAttribute('alt'));
29+
assert.isTrue(document.querySelectorAll('section')?.[1]?.lastElementChild?.hasAttribute('alt'));
3030
```
3131
3232
The new image should have an `alt` value of `A slice of lasagna on a plate.` Make sure the `alt` attribute's value is surrounded with quotation marks.
3333
3434
```js
3535
assert(
36-
$('section')[1]
37-
.lastElementChild.getAttribute('alt')
36+
document.querySelectorAll('section')?.[1]
37+
?.lastElementChild?.getAttribute('alt')
3838
.replace(/\s+/g, ' ')
3939
.match(/^A slice of lasagna on a plate\.?$/i)
4040
);
@@ -43,22 +43,22 @@ assert(
4343
The new image does not have a `src` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.
4444
4545
```js
46-
assert($('section')[1].lastElementChild.hasAttribute('src'));
46+
assert.isTrue(document.querySelectorAll('section')?.[1]?.lastElementChild?.hasAttribute('src'));
4747
```
4848
4949
The new image should have a `src` value of `https://cdn.freecodecamp.org/curriculum/cat-photo-app/lasagna.jpg`. Make sure the `src` attribute's value is surrounded with quotation marks.
5050

5151
```js
52-
assert(
53-
$('section')[1].lastElementChild.getAttribute('src') ===
52+
assert.strictEqual(
53+
document.querySelectorAll('section')?.[1]?.lastElementChild?.getAttribute('src'),
5454
'https://cdn.freecodecamp.org/curriculum/cat-photo-app/lasagna.jpg'
5555
);
5656
```
5757

5858
Although you have set the new image's `src` to the correct URL, it is recommended to always surround the value of an attribute with quotation marks.
5959
6060
```js
61-
assert(!/\<img\s+.+\s+src\s*=\s*https:\/\/cdn\.freecodecamp\.org\/curriculum\/cat-photo-app\/lasagna\.jpg/.test(code));
61+
assert.isTrue(!/\<img\s+.+\s+src\s*=\s*https:\/\/cdn\.freecodecamp\.org\/curriculum\/cat-photo-app\/lasagna\.jpg/.test(code));
6262
```
6363
6464
# --seed--

curriculum/challenges/english/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5dfb655eeacea3f48c6300b3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ assert(code.match(/<\/figure\>/));
2828
There should be an `figure` element right above the second `section` element's closing tag.
2929

3030
```js
31-
assert($('section')[1].lastElementChild.nodeName === 'FIGURE');
31+
assert.equal(document.querySelectorAll('section')?.[1]?.lastElementChild?.nodeName, 'FIGURE');
3232
```
3333
3434
The lasagna `img` element should be nested in the `figure` element.

curriculum/challenges/english/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ assert(code.match(/<\/ol>/));
3232
The `ol` element should be above the second `section` element's closing tag. You have them in the wrong order.
3333

3434
```js
35-
assert($('main > section')[1].lastElementChild.nodeName === 'OL');
35+
assert.equal(document.querySelectorAll('main > section')?.[1]?.lastElementChild?.nodeName, 'OL');
3636
```
3737
3838
The three `li` elements should be nested inside the `ol` element.

curriculum/challenges/english/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ assert(code.match(/<\/figure>/g).length === 2);
2626
There should be a `figure` element right above the second `section` element's closing tag.
2727

2828
```js
29-
assert($('main > section')[1].lastElementChild.nodeName === 'FIGURE');
29+
assert.equal(document.querySelectorAll('main > section')?.[1]?.lastElementChild?.nodeName, 'FIGURE');
3030
```
3131
3232
# --seed--

curriculum/challenges/english/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d6.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ assert(document.querySelector('form').previousElementSibling.nodeName === 'H2');
3737
The `form` element should have no content. Remove any HTML elements or text between the `form` element's tags.
3838

3939
```js
40-
assert($('form')[0].innerHTML.trim().length === 0);
40+
assert.lengthOf(document.querySelector('form')?.innerHTML?.trim(), 0);
4141
```
4242
4343
# --seed--

curriculum/challenges/english/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d7.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ assert(
3535
Your `form` element nested in the last `section` element should be below the `h2` element. You have the `h2` element and the `form` element in the wrong order.
3636

3737
```js
38-
assert(document.querySelector('form').previousElementSibling.nodeName === 'H2');
38+
assert.equal(document.querySelector('form')?.previousElementSibling?.nodeName, 'H2');
3939
```
4040
4141
Your `form` element should have no content. Remove any HTML elements or text between the `form` element's tags.
4242
4343
```js
44-
assert($('form')[0].innerHTML.trim().length === 0);
44+
assert.lengthOf(document.querySelector('form')?.innerHTML?.trim(), 0);
4545
```
4646
4747
Your `form` element does not have an `action` attribute. Check that there is a space after the opening tag's name and/or there are spaces before all attribute names.

curriculum/challenges/english/14-responsive-web-design-22/learn-html-by-building-a-cat-photo-app/5ef9b03c81a63668521804d8.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ assert(document.querySelector('form > input'));
5151
Your `form` should only contain the `input` element. Remove any HTML elements or text between the `form` element's tags.
5252

5353
```js
54-
assert(
55-
$('form')[0].children.length === 1 &&
56-
$('form')[0].innerText.trim().length === 0
54+
assert.isTrue(
55+
document.querySelector('form')?.children?.length === 1 &&
56+
document.querySelector('form')?.innerText?.trim()?.length === 0
5757
);
5858
```
5959

0 commit comments

Comments
 (0)