mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-09-24 23:01:18 +08:00
fix(curriculum): cat photo app step 36 to 40 (#56340)
This commit is contained in:
+5
-4
@@ -18,26 +18,27 @@ Add a `head` element above the `body` element.
|
||||
You have either deleted the `body` element or it is missing an opening tag or closing tag.
|
||||
|
||||
```js
|
||||
assert(document.querySelector('body') && code.match(/<\/body>/));
|
||||
assert.exists(document.querySelector('body'));
|
||||
assert.match(code, /<\/body>/);
|
||||
```
|
||||
|
||||
Your `head` element should have an opening tag. Opening tags have the following syntax: `<elementName>`.
|
||||
|
||||
```js
|
||||
assert(code.match(/\<head\>/));
|
||||
assert.match(code, /\<head\>/);
|
||||
```
|
||||
|
||||
Your `head` element should have a closing tag. Closing tags have a `/` just after the `<` character.
|
||||
|
||||
```js
|
||||
assert(code.match(/\<\/head\>/));
|
||||
assert.match(code, /\<\/head\>/);
|
||||
```
|
||||
|
||||
Your `head` element should be above the opening `body` element tag. You have put it somewhere else.
|
||||
|
||||
```js
|
||||
const noSpaces = code.replace(/\s/g, '');
|
||||
assert(noSpaces.match(/\<\/head\>\<body\>/));
|
||||
assert.match(noSpaces, /\<\/head\>\<body\>/);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
+5
-4
@@ -18,26 +18,27 @@ Add a `title` element within the `head` element using the text below:
|
||||
You have either deleted the `head` element or it is missing an opening tag or closing tag.
|
||||
|
||||
```js
|
||||
assert(code.match(/\<head\>/) && code.match(/\<\/head\>/));
|
||||
assert.match(code, /\<head\>/);
|
||||
assert.match(code, /\<\/head\>/);
|
||||
```
|
||||
|
||||
Your `title` element should be nested in the `head` element. Make sure to add an opening tag and closing tag for the `title` element.
|
||||
|
||||
```js
|
||||
const noSpaces = code.replace(/\s/g, '');
|
||||
assert(noSpaces.match(/\<head\>\<title\>.*\<\/title\>\<\/head\>/));
|
||||
assert.match(noSpaces, /\<head\>\<title\>.*\<\/title\>\<\/head\>/);
|
||||
```
|
||||
|
||||
Your `title` element should have a closing tag. Closing tags have a `/` just after the `<` character.
|
||||
|
||||
```js
|
||||
assert(code.match(/\<\/title\>/));
|
||||
assert.match(code, /\<\/title\>/);
|
||||
```
|
||||
|
||||
Your `title` element's text should be `CatPhotoApp`. You have either omitted the text or have a typo.
|
||||
|
||||
```js
|
||||
assert(document.title && document.title.toLowerCase() === 'catphotoapp');
|
||||
assert.equal(document.title?.toLowerCase(), 'catphotoapp');
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
+3
-2
@@ -18,14 +18,15 @@ Add the `lang` attribute with the value `en` to the opening `html` tag to specif
|
||||
You have either deleted the `html` element or it is missing an opening tag or closing tag.
|
||||
|
||||
```js
|
||||
assert(code.match(/\<html.*?\>/) && code.match(/\<\/html\>/));
|
||||
assert.match(code, /\<html.*?\>/);
|
||||
assert.match(code, /\<\/html\>/);
|
||||
```
|
||||
|
||||
Your `html` element should have a `lang` attribute with the value `en`. You may have omitted the attribute/value, or have a typo.
|
||||
|
||||
```js
|
||||
const extraSpacesRemoved = code.replace(/\s+/g, " ");
|
||||
assert(extraSpacesRemoved.match(/\<html\s+lang\s*\=\s*("?|'?)en\1\s*\>/));
|
||||
assert.match(extraSpacesRemoved, /\<html\s+lang\s*\=\s*("?|'?)en\1\s*\>/);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
+2
-2
@@ -18,14 +18,14 @@ Add this declaration as the first line of the code.
|
||||
Your code should begin with the declaration `<!DOCTYPE html>`. You may have omitted the declaration, have a typo, or it is not the first line of code.
|
||||
|
||||
```js
|
||||
assert(code.match(/\<\s*!DOCTYPE\s+html\s*\>/));
|
||||
assert.match(code, /\<\s*!DOCTYPE\s+html\s*\>/);
|
||||
```
|
||||
|
||||
Your `<!DOCTYPE html>` must be located at the top of the document.
|
||||
|
||||
```js
|
||||
const noSpaces = code.replace(/\s/g, '');
|
||||
assert(noSpaces.match(/^\<\!DOCTYPEhtml\>\<html/));
|
||||
assert.match(noSpaces, /^\<\!DOCTYPEhtml\>\<html/);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
Reference in New Issue
Block a user