Skip to content

Commit ed1152f

Browse files
a2937gikf
andauthored
feat(curriculum) : remove jQuery from legacy applied accessibility (freeCodeCamp#55916)
Co-authored-by: Krzysztof G. <[email protected]>
1 parent 3c85dac commit ed1152f

22 files changed

+94
-98
lines changed

curriculum/challenges/english/01-responsive-web-design/applied-accessibility/add-a-text-alternative-to-images-for-visually-impaired-accessibility.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Camper Cat happens to be both a coding ninja and an actual ninja, who is buildin
2828
Your `img` tag should have an `alt` attribute and it should not be empty.
2929

3030
```js
31-
assert($('img').attr('alt'));
31+
assert.isNotEmpty(document.querySelector('img')?.getAttribute('alt'));
3232
```
3333
3434
# --seed--

curriculum/challenges/english/01-responsive-web-design/applied-accessibility/add-an-accessible-date-picker.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,25 @@ Camper Cat is setting up a Mortal Kombat tournament and wants to ask his competi
3131
Your code should add one `input` tag for the date selector field.
3232

3333
```js
34-
assert($('input').length == 2);
34+
assert.lengthOf(document.querySelectorAll('input'), 2);
3535
```
3636

3737
Your `input` tag should have a `type` attribute with a value of `date`.
3838

3939
```js
40-
assert($('input').attr('type') == 'date');
40+
assert.equal(document.querySelector('input')?.getAttribute('type'), 'date');
4141
```
4242
4343
Your `input` tag should have an `id` attribute with a value of `pickdate`.
4444
4545
```js
46-
assert($('input').attr('id') == 'pickdate');
46+
assert.equal(document.querySelector('input')?.getAttribute('id'),'pickdate');
4747
```
4848
4949
Your `input` tag should have a `name` attribute with a value of `date`.
5050
5151
```js
52-
assert($('input').attr('name') == 'date');
52+
assert.equal(document.querySelector('input')?.getAttribute('name'), 'date');
5353
```
5454
5555
# --seed--

curriculum/challenges/english/01-responsive-web-design/applied-accessibility/avoid-colorblindness-issues-by-carefully-choosing-colors-that-convey-information.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ Camper Cat is testing different styles for an important button, but the yellow (
2727
Your code should change the text `color` for the `button` to the dark blue.
2828

2929
```js
30-
assert($('button').css('color') == 'rgb(0, 51, 102)');
30+
const button = document.querySelector('button');
31+
const buttonColor = window.getComputedStyle(button).color;
32+
assert.equal(buttonColor, 'rgb(0, 51, 102)');
3133
```
3234

3335
# --seed--

curriculum/challenges/english/01-responsive-web-design/applied-accessibility/avoid-colorblindness-issues-by-using-sufficient-contrast.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ Camper Cat is experimenting with using color for his blog text and background, b
2626
Your code should only change the lightness value for the text `color` property to a value of 15%.
2727

2828
```js
29-
assert(code.match(/color:\s*?hsl\(0,\s*?55%,\s*?15%\)/gi));
29+
assert.match(code ,/color:\s*?hsl\(0,\s*?55%,\s*?15%\)/gi);
3030
```
3131

3232
Your code should only change the lightness value for the `background-color` property to a value of 55%.
3333

3434
```js
35-
assert(code.match(/background-color:\s*?hsl\(120,\s*?25%,\s*?55%\)/gi));
35+
assert.match(code ,/background-color:\s*?hsl\(120,\s*?25%,\s*?55%\)/gi);
3636
```
3737

3838
# --seed--

curriculum/challenges/english/01-responsive-web-design/applied-accessibility/give-links-meaning-by-using-descriptive-link-text.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,19 @@ The link text that Camper Cat is using is not very descriptive without the surro
2222
Your code should move the anchor `a` tags from around the words `Click here` to wrap around the words `information about batteries`.
2323

2424
```js
25-
assert(
26-
$('a')
27-
.text()
28-
.match(/^(information about batteries)$/g)
29-
);
25+
assert.match(document.querySelector('a')?.textContent, /^(information about batteries)$/g);
3026
```
3127
3228
The `a` element should have an `href` attribute with a value of an empty string `""`.
3329
3430
```js
35-
assert($('a').attr('href') === '');
31+
assert.isEmpty(document.querySelector('a')?.getAttribute('href'));
3632
```
3733
3834
The `a` element should have a closing tag.
3935
4036
```js
41-
assert(
42-
code.match(/<\/a>/g) &&
43-
code.match(/<\/a>/g).length === code.match(/<a href=(''|"")>/g).length
44-
);
37+
assert.isTrue(code.match(/<\/a>/g)?.length === code.match(/<a href=(''|"")>/g)?.length);
4538
```
4639
4740
# --seed--

curriculum/challenges/english/01-responsive-web-design/applied-accessibility/improve-accessibility-of-audio-content-with-the-audio-element.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,49 +35,49 @@ Time to take a break from Camper Cat and meet fellow camper Zersiax (@zersiax),
3535
Your code should have one `audio` tag.
3636

3737
```js
38-
assert($('audio').length === 1);
38+
assert.lengthOf(document.querySelectorAll('audio'),1);
3939
```
4040

4141
Your `audio` element should have a closing tag.
4242

4343
```js
44-
assert(
45-
code.match(/<\/audio>/g).length === 1 &&
46-
code.match(/<audio.*>[\s\S]*<\/audio>/g)
47-
);
44+
assert.match(code,/<audio.*>[\s\S]*<\/audio>/g);
45+
assert.lengthOf(code.match(/<\/audio>/g),1);
4846
```
4947

5048
The `audio` tag should have the `controls` attribute.
5149

5250
```js
53-
assert($('audio').attr('controls'));
51+
assert.exists(document.querySelector('audio')?.getAttribute('controls'));
5452
```
5553
5654
Your code should have one `source` tag.
5755
5856
```js
59-
assert($('source').length === 1);
57+
assert.lengthOf(document.querySelectorAll('source'), 1);
6058
```
6159
6260
Your `source` tag should be inside the `audio` tags.
6361
6462
```js
65-
assert($('audio').children('source').length === 1);
63+
const audio = document.querySelector('audio');
64+
const children = audio.querySelectorAll(`:scope ${'source'}`);
65+
assert.lengthOf(children,1);
6666
```
6767
6868
The value for the `src` attribute on the `source` tag should match the link in the instructions exactly.
6969
7070
```js
71-
assert(
72-
$('source').attr('src') ===
73-
'https://cdn.freecodecamp.org/curriculum/applied-accessibility/screen-reader.mp3'
71+
assert.equal(
72+
document.querySelector('source')?.getAttribute('src'),
73+
'https://cdn.freecodecamp.org/curriculum/applied-accessibility/screen-reader.mp3'
7474
);
7575
```
7676
7777
Your code should include a `type` attribute on the `source` tag with a value of audio/mpeg.
7878
7979
```js
80-
assert($('source').attr('type') === 'audio/mpeg');
80+
assert.equal(document.querySelector('source')?.getAttribute('type'), 'audio/mpeg');
8181
```
8282
8383
# --seed--

curriculum/challenges/english/01-responsive-web-design/applied-accessibility/improve-chart-accessibility-with-the-figure-element.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,39 +34,40 @@ Camper Cat is hard at work creating a stacked bar chart showing the amount of ti
3434
Your code should have one `figure` tag.
3535

3636
```js
37-
assert($('figure').length == 1);
37+
assert.lengthOf(document.querySelectorAll('figure') , 1);
3838
```
3939

4040
Your code should have one `figcaption` tag.
4141

4242
```js
43-
assert($('figcaption').length == 1);
43+
assert.lengthOf(document.querySelectorAll('figcaption') , 1);
4444
```
4545

4646
Your code should not have any `div` tags.
4747

4848
```js
49-
assert($('div').length == 0);
49+
assert.lengthOf(document.querySelectorAll('div'), 0);
5050
```
5151

5252
Your code should not have any `p` tags.
5353

5454
```js
55-
assert($('p').length == 0);
55+
assert.lengthOf(document.querySelectorAll('p') , 0);
5656
```
5757

5858
The `figcaption` should be a child of the `figure` tag.
5959

6060
```js
61-
assert($('figure').children('figcaption').length == 1);
61+
const figure = document.querySelector('figure');
62+
const children = figure?.querySelectorAll(`:scope ${'figcaption'}`);
63+
assert.lengthOf(children, 1);
6264
```
6365
6466
Your `figure` element should have a closing tag.
6567
6668
```js
67-
assert(
68-
code.match(/<\/figure>/g) &&
69-
code.match(/<\/figure>/g).length === code.match(/<figure>/g).length
69+
assert.isTrue(
70+
code.match(/<\/figure>/g)?.length === code.match(/<figure>/g)?.length
7071
);
7172
```
7273

curriculum/challenges/english/01-responsive-web-design/applied-accessibility/improve-form-field-accessibility-with-the-label-element.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ Camper Cat expects a lot of interest in his thoughtful blog posts and wants to i
3333
Your code should have a `for` attribute on the `label` tag that is not empty.
3434

3535
```js
36-
assert($('label').attr('for'));
36+
assert.isNotEmpty(document.querySelector('label')?.getAttribute('for'));
3737
```
3838
3939
Your `for` attribute value should match the `id` value on the email `input`.
4040
4141
```js
42-
assert($('label').attr('for') == 'email');
42+
assert.equal(document.querySelector('label')?.getAttribute('for'), 'email');
4343
```
4444
4545
# --seed--

curriculum/challenges/english/01-responsive-web-design/applied-accessibility/improve-readability-with-high-contrast-text.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,17 @@ Camper Cat's choice of light gray text on a white background for his recent blog
2222
Your code should change the text `color` for the `body` to the darker gray.
2323

2424
```js
25-
assert($('body').css('color') == 'rgb(99, 99, 99)');
25+
const body = document.querySelector('body');
26+
const bodyColor = window.getComputedStyle(body).color;
27+
assert(bodyColor == 'rgb(99, 99, 99)');
2628
```
2729

2830
Your code should not change the `background-color` for the `body`.
2931

3032
```js
31-
assert($('body').css('background-color') == 'rgb(255, 255, 255)');
33+
const body = document.querySelector('body');
34+
const backgroundColor = window.getComputedStyle(body).backgroundColor;
35+
assert.equal(backgroundColor , 'rgb(255, 255, 255)');
3236
```
3337

3438
# --seed--

curriculum/challenges/english/01-responsive-web-design/applied-accessibility/jump-straight-to-the-content-using-the-main-element.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ Camper Cat has some big ideas for his ninja weapons page. Help him set up his ma
2626
Your code should have one `main` tag.
2727

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

3232
The `main` tags should be between the closing `header` tag and the opening `footer` tag.
3333

3434
```js
35-
assert(code.match(/<\/header>\s*?<main>\s*?<\/main>/gi));
35+
assert.match(code,/<\/header>\s*?<main>\s*?<\/main>/gi);
3636
```
3737

3838
# --seed--

0 commit comments

Comments
 (0)