From 75f6ae273d5901c803d5bd2de3478b00942e7d00 Mon Sep 17 00:00:00 2001 From: Anna Date: Mon, 26 Aug 2024 02:46:17 -0400 Subject: [PATCH] fix(curriculum) : update head step 4 (#55882) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Lasse Jørgensen <28780271+lasjorg@users.noreply.github.com> --- .../5d822fd413a79914d39e98cc.md | 43 +++++++++++++------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/curriculum/challenges/english/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98cc.md b/curriculum/challenges/english/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98cc.md index d313f81782a..cccff942147 100644 --- a/curriculum/challenges/english/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98cc.md +++ b/curriculum/challenges/english/14-responsive-web-design-22/learn-css-variables-by-building-a-city-skyline/5d822fd413a79914d39e98cc.md @@ -14,13 +14,20 @@ Within the `head`, nest a `meta` element with a `charset` of `UTF-8`, a `title` You should create a `meta` element within the `head` element. ```js -assert.exists(document.querySelector('head > meta')); +const headContentRegex = /(?<=)[\S|\s]*(?=<\/head\s*>)/; +const headElementContent = code.match(headContentRegex); + +const headElement = document.createElement("head"); +headElement.innerHTML = headElementContent; +assert.isNotNull(headElement.querySelector('meta')); ``` You should give the `meta` tag a `charset` of `UTF-8`. ```js -assert.equal(document.querySelector('head > meta')?.getAttribute('charset')?.toLowerCase(), 'utf-8'); +const linkElement = document.querySelector('meta'); +const charset = linkElement?.getAttribute("charset").toLowerCase(); +assert.strictEqual(charset, 'utf-8'); ``` Your code should have a `title` element. @@ -33,7 +40,12 @@ assert.exists(title); The `title` element should be within the `head` element. ```js -assert.exists(document.querySelector('head > title')); +const headContentRegex = /(?<=)[\S|\s]*(?=<\/head\s*>)/; +const headElementContent = code.match(headContentRegex); + +const headElement = document.createElement("head"); +headElement.innerHTML = headElementContent; +assert.isNotNull(headElement.querySelector('title')); ``` Your project should have a title of `City Skyline`. @@ -53,41 +65,46 @@ assert.equal(title.text, 'City Skyline'); Your code should have a `link` element. ```js -assert.match(code, / link')); +const headContentRegex = /(?<=)[\S|\s]*(?=<\/head\s*>)/; +const headElementContent = code.match(headContentRegex); + +const headElement = document.createElement("head"); +headElement.innerHTML = headElementContent; +assert.isNotNull(headElement.querySelector('link')); ``` Your `link` element should have a `rel` attribute with the value `stylesheet`. ```js -const link_element = document.querySelector('link'); -const rel = link_element.getAttribute("rel"); -assert.equal(rel, "stylesheet"); +const linkElement = document.querySelector('link'); +const rel = linkElement?.getAttribute("rel"); +assert.strictEqual(rel, "stylesheet"); ``` Your `link` element should have an `href` attribute with the value `styles.css`. ```js -const link = document.querySelector('link'); -assert.equal(link.dataset.href, "styles.css"); +const linkElement = document.querySelector('link'); +assert.strictEqual(linkElement?.dataset.href, "styles.css"); ``` # --seed--