Skip to content

Commit 36ddf89

Browse files
a2937gikf
andauthored
feat(curriculum): remove jquery from applied visual design (freeCodeCamp#55921)
Co-authored-by: Krzysztof G. <[email protected]>
1 parent 4014a9f commit 36ddf89

File tree

51 files changed

+263
-198
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+263
-198
lines changed

curriculum/challenges/english/01-responsive-web-design/applied-visual-design/add-a-box-shadow-to-a-card-like-element.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ The element now has an id of `thumbnail`. With this selector, use the example CS
4040
Your code should add a `box-shadow` property for the `thumbnail` id.
4141

4242
```js
43-
assert(code.match(/#thumbnail\s*?{\s*?box-shadow/g));
43+
assert.match(code,(/#thumbnail\s*?{\s*?box-shadow/g));
4444
```
4545

4646
You should use the given CSS for the `box-shadow` value.

curriculum/challenges/english/01-responsive-web-design/applied-visual-design/adjust-the-background-color-property-of-text.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,20 @@ assert(
3838
Your code should add a `padding` property to the `h4` element and set it to 10 pixels.
3939

4040
```js
41-
assert(
42-
$('h4').css('padding-top') == '10px' &&
43-
$('h4').css('padding-right') == '10px' &&
44-
$('h4').css('padding-bottom') == '10px' &&
45-
$('h4').css('padding-left') == '10px'
46-
);
41+
const h4Element = document.querySelector("h4");
42+
const h4style = window.getComputedStyle(h4Element);
43+
assert.equal(h4style?.paddingTop, "10px");
44+
assert.equal(h4style?.paddingRight, "10px");
45+
assert.equal(h4style?.paddingBottom, "10px");
46+
assert.equal(h4style?.paddingLeft, "10px");
4747
```
4848
4949
The `height` property on the `h4` element should be removed.
5050
5151
```js
52-
assert(!($('h4').css('height') == '25px'));
52+
const h4Element = document.querySelector("h4");
53+
const h4style = window.getComputedStyle(h4Element);
54+
assert.notEqual(h4style?.height, '25px');
5355
```
5456
5557
# --seed--

curriculum/challenges/english/01-responsive-web-design/applied-visual-design/adjust-the-color-of-various-elements-to-complementary-colors.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,33 @@ This page will use a shade of teal (`#09A7A1`) as the dominant color, and its or
2020
The `header` element should have a `background-color` of #09A7A1.
2121

2222
```js
23-
assert($('header').css('background-color') == 'rgb(9, 167, 161)');
23+
const headerElement = document.querySelector('header');
24+
const headerStyle = window.getComputedStyle(headerElement);
25+
assert.equal(headerStyle?.backgroundColor, 'rgb(9, 167, 161)');
2426
```
2527
2628
The `footer` element should have a `background-color` of #09A7A1.
2729
2830
```js
29-
assert($('footer').css('background-color') == 'rgb(9, 167, 161)');
31+
const footerElement = document.querySelector('footer');
32+
const footerStyle = window.getComputedStyle(footerElement);
33+
assert.equal(footerStyle?.backgroundColor, 'rgb(9, 167, 161)');
3034
```
3135
3236
The `h2` element should have a `color` of #09A7A1.
3337
3438
```js
35-
assert($('h2').css('color') == 'rgb(9, 167, 161)');
39+
const h2Element = document.querySelector('h2');
40+
const h2Style = window.getComputedStyle(h2Element);
41+
assert.equal(h2Style?.color, 'rgb(9, 167, 161)');
3642
```
3743
3844
The `button` element should have a `background-color` of #FF790E.
3945
4046
```js
41-
assert($('button').css('background-color') == 'rgb(255, 121, 14)');
47+
const buttonElement = document.querySelector('button');
48+
const buttonStyle = window.getComputedStyle(buttonElement);
49+
assert.equal(buttonStyle?.backgroundColor, 'rgb(255, 121, 14)');
4250
```
4351
4452
# --seed--

curriculum/challenges/english/01-responsive-web-design/applied-visual-design/adjust-the-height-of-an-element-using-the-height-property.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,10 @@ Add a `height` property to the `h4` tag and set it to 25px.
2828
Your code should change the `h4` `height` property to a value of 25 pixels.
2929

3030
```js
31-
assert(
32-
Math.round(document.querySelector('h4').getBoundingClientRect().height) ===
33-
25 &&
34-
/h4{\S*height:25px(;\S*}|})/.test($('style').text().replace(/\s/g, ''))
35-
);
31+
const spaceFreeText = document.querySelector("style")?.textContent?.replace(/\s/g, '');
32+
const h4Element = document.querySelector('h4');
33+
assert.equal(Math.round(h4Element?.getBoundingClientRect()?.height),25);
34+
assert.match(spaceFreeText,/h4{\S*height:25px(;\S*}|})/);
3635
```
3736
3837
# --seed--

curriculum/challenges/english/01-responsive-web-design/applied-visual-design/adjust-the-hover-state-of-an-anchor-tag.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ The code editor has a CSS rule to style all `a` tags black. Add a rule so that w
2828
The anchor tag `color` should remain black, only add CSS rules for the `:hover` state.
2929

3030
```js
31-
assert($('a').css('color') == 'rgb(0, 0, 0)');
31+
const anchorElement = document.querySelector("a");
32+
const anchorStyle = window.getComputedStyle(anchorElement);
33+
assert.equal(anchorStyle?.color, 'rgb(0, 0, 0)');
3234
```
3335
3436
The anchor tag should have a `color` of blue on hover.
3537
3638
```js
37-
assert(
38-
code.match(
39+
assert.match(code,
3940
/a:hover\s*?{\s*?color:\s*?(blue|rgba\(\s*?0\s*?,\s*?0\s*?,\s*?255\s*?,\s*?1\s*?\)|#00F|rgb\(\s*?0\s*?,\s*?0\s*?,\s*?255\s*?\))\s*?;\s*?}/gi
40-
)
41-
);
41+
);
4242
```
4343
4444
# --seed--

curriculum/challenges/english/01-responsive-web-design/applied-visual-design/adjust-the-hue-of-a-color.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,37 +30,43 @@ Change the `background-color` of each `div` element based on the class names (`g
3030
Your code should use the `hsl()` function to declare the color green.
3131

3232
```js
33-
assert(code.match(/\.green\s*?{\s*?background-color\s*:\s*?hsl/gi));
33+
assert.match(code,/\.green\s*?{\s*?background-color\s*:\s*?hsl/gi);
3434
```
3535

3636
Your code should use the `hsl()` function to declare the color cyan.
3737

3838
```js
39-
assert(code.match(/\.cyan\s*?{\s*?background-color\s*:\s*?hsl/gi));
39+
assert.match(code,/\.cyan\s*?{\s*?background-color\s*:\s*?hsl/gi);
4040
```
4141

4242
Your code should use the `hsl()` function to declare the color blue.
4343

4444
```js
45-
assert(code.match(/\.blue\s*?{\s*?background-color\s*:\s*?hsl/gi));
45+
assert.match(code,/\.blue\s*?{\s*?background-color\s*:\s*?hsl/gi);
4646
```
4747

4848
The `div` element with class `green` should have a `background-color` of green.
4949

5050
```js
51-
assert($('.green').css('background-color') == 'rgb(0, 255, 0)');
51+
const greenElement = document.querySelector(".green");
52+
const greenStyle = window.getComputedStyle(greenElement);
53+
assert.equal(greenStyle?.backgroundColor, 'rgb(0, 255, 0)');
5254
```
5355
5456
The `div` element with class `cyan` should have a `background-color` of cyan.
5557
5658
```js
57-
assert($('.cyan').css('background-color') == 'rgb(0, 255, 255)');
59+
const cyanElement = document.querySelector(".cyan");
60+
const cyanStyle = window.getComputedStyle(cyanElement);
61+
assert.equal(cyanStyle?.backgroundColor, 'rgb(0, 255, 255)');
5862
```
5963
6064
The `div` element with class `blue` should have a `background-color` of blue.
6165
6266
```js
63-
assert($('.blue').css('background-color') == 'rgb(0, 0, 255)');
67+
const blueElement = document.querySelector(".blue");
68+
const blueStyle = window.getComputedStyle(blueElement);
69+
assert.equal(blueStyle?.backgroundColor, 'rgb(0, 0, 255)');
6470
```
6571
6672
# --seed--

curriculum/challenges/english/01-responsive-web-design/applied-visual-design/adjust-the-size-of-a-heading-element-versus-a-paragraph-element.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ To make the heading significantly larger than the paragraph, change the `font-si
2020
Your code should add a `font-size` property to the `h4` element set to 27 pixels.
2121

2222
```js
23-
assert($('h4').css('font-size') == '27px');
23+
24+
const h4Element =document.querySelector('h4')
25+
const h4Style = window.getComputedStyle(h4Element);
26+
assert.equal(h4Style?.fontSize,'27px');
2427
```
2528
2629
# --seed--

curriculum/challenges/english/01-responsive-web-design/applied-visual-design/adjust-the-width-of-an-element-using-the-width-property.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ Your code should change the `width` property of the card to 245 pixels by using
2727

2828
```js
2929
const fullCard = code.match(/\.fullCard\s*{[\s\S]+?[^}]}/g);
30-
assert(
31-
fullCard &&
32-
/width\s*:\s*245px\s*(;|})/gi.test(fullCard[0]) &&
33-
$('.fullCard').css('maxWidth') === 'none'
34-
);
30+
const fullCardElement = document.querySelector('.fullCard');
31+
const fullCardStyle = window.getComputedStyle(fullCardElement);
32+
assert.match(code,/\.fullCard\s*{[\s\S]+?[^}]}/g);
33+
34+
assert.match(fullCard?.[0],/width\s*:\s*245px\s*(;|})/gi);
35+
assert.equal(fullCardStyle?.maxWidth, 'none');
3536
```
3637
3738
# --seed--

curriculum/challenges/english/01-responsive-web-design/applied-visual-design/animate-elements-at-variable-rates.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Alter the animation rate for the element with the class name of `star-1` by chan
2222
The `@keyframes` rule for the `star-1` class should be 50%.
2323

2424
```js
25-
assert(code.match(/twinkle-1\s*?{\s*?50%/g));
25+
assert.match(code,/twinkle-1\s*?{\s*?50%/g);
2626
```
2727

2828
# --seed--

curriculum/challenges/english/01-responsive-web-design/applied-visual-design/animate-elements-continually-using-an-infinite-animation-count.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ To keep the ball bouncing on the right on a continuous loop, change the `animati
2626
The `animation-iteration-count` property should have a value of `infinite`.
2727

2828
```js
29-
assert($('#ball').css('animation-iteration-count') == 'infinite');
29+
const ballElement = document.querySelector('#ball');
30+
const ballStyle = window.getComputedStyle(ballElement);
31+
assert.equal(ballStyle?.animationIterationCount, 'infinite');
3032
```
3133

3234
# --seed--

0 commit comments

Comments
 (0)