Skip to content

Commit 1cfefc3

Browse files
a2937gikf
andauthored
feat(curriculum) : no jQuery in cafe menu (freeCodeCamp#55907)
Co-authored-by: Krzysztof G. <[email protected]>
1 parent f13bebd commit 1cfefc3

29 files changed

+169
-135
lines changed

curriculum/challenges/english/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f33294a6af5e9188dbdb8f3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ assert(code.match(/<\/main>/i));
2626
You should not change your `body` element. Make sure you don't accidentally delete your closing tag.
2727

2828
```js
29-
assert($('body').length === 1);
29+
assert.lengthOf(document.querySelectorAll('body'), 1);
3030
```
3131

3232
Your `main` tag should be within your `body` tag.

curriculum/challenges/english/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f332a88dc25a0fd25c7687a.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ assert(code.match(/<\/h1>/i));
2626
You should not change your existing `main` element.
2727

2828
```js
29-
assert($('main').length === 1);
29+
assert.lengthOf(document.querySelectorAll('main'), 1);
3030
```
3131

3232
Your `h1` element should be nested in your `main` element.
3333

3434
```js
35-
assert($('h1')[0].parentElement.tagName === "MAIN");
35+
assert.equal(document.querySelector('h1')?.parentElement?.tagName, "MAIN");
3636
```
3737
3838
Your `h1` element should have the text `CAMPER CAFE`.

curriculum/challenges/english/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f332b23c2045fb843337579.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ assert(code.match(/<\/p>/i));
2626
You should not change your existing `h1` element. Make sure you did not delete the closing tag.
2727

2828
```js
29-
assert($('h1').length === 1);
29+
assert.lengthOf(document.querySelectorAll('h1'),1);
3030
```
3131

3232
Your `p` element should be below your `h1` element.
3333

3434
```js
35-
assert($('p')[0].previousElementSibling.tagName === 'H1');
35+
assert.equal(document.querySelector('p')?.previousElementSibling?.tagName, 'H1');
3636
```
3737
3838
Your `p` element should have the text `Est. 2020`.

curriculum/challenges/english/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f344fbc22624a2976425065.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ assert(code.match(/<\/h2\s*>/i));
2626
You should not change your existing `section` element. Make sure you did not delete the closing tag.
2727

2828
```js
29-
assert($('section').length === 1);
29+
assert.lengthOf(document.querySelectorAll('section'),1);
3030
```
3131

3232
Your `h2` element should be within your `section` element.

curriculum/challenges/english/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f344fc1520b6719f2e35605.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ assert(code.match(/<\/section\s*>/i));
2626
You should not change your existing `main` element. Make sure you didn't delete the closing tag.
2727

2828
```js
29-
assert($('main').length === 1);
29+
assert.lengthOf(document.querySelectorAll('main'),1);
3030
```
3131

3232
Your `section` element should be within your `main` element.

curriculum/challenges/english/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f3477cbcb6ba47918c1da92.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@ Add the following within the `head` element:
2020
Your code should have two `meta` elements.
2121

2222
```js
23-
assert(code.match(/<meta.*?\/?>/g).length === 2);
23+
assert.lengthOf(code.match(/<meta.*?\/?>/g),2);
2424
```
2525

2626
Your `meta` element should have a `name` attribute with a value of `viewport`.
2727

2828
```js
29-
const meta = $('meta');
30-
assert(meta[0].outerHTML.match(/name=('|")viewport\1/) || meta[1].outerHTML.match(/name=('|")viewport\1/));
29+
const meta = document.querySelectorAll('meta');
30+
assert.exists(meta[0]?.outerHTML?.match(/name=('|")viewport\1/) || meta[1]?.outerHTML?.match(/name=('|")viewport\1/));
3131
```
3232
3333
Your `meta` element should have a `content` attribute with a value of `width=device-width, initial-scale=1.0`.
3434
3535
```js
36-
const meta = $('meta');
37-
assert(meta[0].outerHTML.match(/content=('|")width=device-width, initial-scale=1.0\1/) || meta[1].outerHTML.match(/content=('|")width=device-width, initial-scale=1.0\1/));
36+
const meta = document.querySelectorAll('meta');
37+
assert.exists(meta[0]?.outerHTML?.match(/content=('|")width=device-width, initial-scale=1.0\1/) || meta[1]?.outerHTML?.match(/content=('|")width=device-width, initial-scale=1.0\1/));
3838
```
3939
4040
# --seed--

curriculum/challenges/english/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed60a5decd94ab66986.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ assert(code.match(/\/\*\s*background-color:\s*burlywood;?\s*\*\//i));
2727
Your `body` should have a white background.
2828

2929
```js
30-
const bodyCSS = $('body').css('background-color');
31-
assert(bodyCSS === "rgba(0, 0, 0, 0)")
30+
const body = document.querySelector("body");
31+
const compStyles = window.getComputedStyle(body);
32+
const backgroundColor = compStyles?.getPropertyValue('background-color');
33+
assert.equal(backgroundColor,"rgba(0, 0, 0, 0)")
3234
```
3335
3436
# --seed--

curriculum/challenges/english/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed69db0a491745e2bb6.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ To apply the class's styling to the `div` element, remove the `id` attribute and
1414
Your `div` should still render. Make sure you haven't malformed the `<div>` tag.
1515

1616
```js
17-
assert($('div').length === 1);
17+
assert.lengthOf(document.querySelectorAll('div'),1);
1818
```
1919

2020
Your `div` element should have the `menu` class.
2121

2222
```js
23-
assert($('div').attr('class').includes('menu'));
23+
assert.isTrue(document.querySelector('div').classList.contains('menu'));
2424
```
2525

2626
Your `div` element should no longer have the `menu` id.
2727

2828
```js
29-
assert(!$('div#menu').length);
29+
assert.lengthOf(document.querySelectorAll('div#menu'),0);
3030
```
3131

3232
# --seed--

curriculum/challenges/english/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f356ed6cf6eab5f15f5cfe6.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ Inside the opening `div` tag, add the `id` attribute with a value of `menu`.
1616
Your opening `<div>` tag should have an `id` attribute set to `menu`.
1717

1818
```js
19-
const div = $('div')[0];
20-
assert(div.id === 'menu');
19+
assert.strictEqual(document.querySelector('div')?.id, 'menu');
2120
```
2221
2322
You should have a closing `</div>` tag.
@@ -29,14 +28,13 @@ assert(code.match(/<\/div>/i));
2928
You should not change your existing `body` element. Make sure you did not delete the closing tag.
3029
3130
```js
32-
assert($('body').length === 1);
31+
assert.lengthOf(document.querySelectorAll('body'), 1);
3332
```
3433
3534
Your `div` tag should be nested in the `body`.
3635
3736
```js
38-
const div = $('div')[0];
39-
assert(div.parentElement.tagName === 'BODY');
37+
assert.equal(document.querySelector('div')?.parentElement?.tagName, 'BODY');
4038
```
4139
4240

curriculum/challenges/english/14-responsive-web-design-22/learn-basic-css-by-building-a-cafe-menu/5f35e5c4321f818cdc4bed30.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ It’s looking good. Time to start adding some menu items. Add an empty `article
1414
You should have an opening `<article>` tag.
1515

1616
```js
17-
assert(code.match(/<article>/i));
17+
assert.match(code,/<article>/i);
1818
```
1919

2020
You should have a closing `</article>` tag.
@@ -26,14 +26,14 @@ assert(code.match(/<\/article>/i));
2626
You should not change the existing `h2` element.
2727

2828
```js
29-
assert($('h2').length === 1);
29+
assert.lengthOf(document.querySelectorAll('h2'),1);
3030
```
3131

3232
Your `article` element should come after your `h2` element.
3333

3434
```js
35-
const article = $('article')[0];
36-
assert(article.previousElementSibling.tagName === 'H2');
35+
const article = document.querySelector('article');
36+
assert.equal(article?.previousElementSibling?.tagName, 'H2');
3737
```
3838
3939
# --seed--

0 commit comments

Comments
 (0)