@@ -14,13 +14,20 @@ Within the `head`, nest a `meta` element with a `charset` of `UTF-8`, a `title`
1414You should create a ` meta ` element within the ` head ` element.
1515
1616``` js
17- assert .exists (document .querySelector (' head > meta' ));
17+ const headContentRegex = / (?<=<head\s * >)[\S |\s ] * (?=<\/ head\s * >)/ ;
18+ const headElementContent = code .match (headContentRegex);
19+
20+ const headElement = document .createElement (" head" );
21+ headElement .innerHTML = headElementContent;
22+ assert .isNotNull (headElement .querySelector (' meta' ));
1823```
1924
2025You should give the ` meta ` tag a ` charset ` of ` UTF-8 ` .
2126
2227``` js
23- assert .equal (document .querySelector (' head > meta' )? .getAttribute (' charset' )? .toLowerCase (), ' utf-8' );
28+ const linkElement = document .querySelector (' meta' );
29+ const charset = linkElement? .getAttribute (" charset" ).toLowerCase ();
30+ assert .strictEqual (charset, ' utf-8' );
2431` ` `
2532
2633Your code should have a ` title` element.
@@ -33,7 +40,12 @@ assert.exists(title);
3340The ` title` element should be within the ` head` element.
3441
3542` ` ` js
36- assert .exists (document .querySelector (' head > title' ));
43+ const headContentRegex = / (?<=<head\s * >)[\S |\s ] * (?=<\/ head\s * >)/ ;
44+ const headElementContent = code .match (headContentRegex);
45+
46+ const headElement = document .createElement (" head" );
47+ headElement .innerHTML = headElementContent;
48+ assert .isNotNull (headElement .querySelector (' title' ));
3749` ` `
3850
3951Your project should have a title of ` City Skyline` .
@@ -53,41 +65,46 @@ assert.equal(title.text, 'City Skyline');
5365Your code should have a ` link` element.
5466
5567` ` ` js
56- assert .match (code, / < link/ )
68+ assert .isNotNull ( document . querySelector ( ' link' ));
5769` ` `
5870
5971You should not change your existing ` head` tags. Make sure you did not delete the closing tag.
6072
6173` ` ` js
62- const heads = document .querySelectorAll (' head' );
63- assert .equal (heads ? .length , 1 );
74+ const headElements = document .querySelectorAll (' head' );
75+ assert .strictEqual (headElements ? .length , 1 );
6476` ` `
6577
6678You should have one void ` link` element.
6779
6880` ` ` js
69- assert (document .querySelectorAll (' link' ).length === 1 );
81+ assert . strictEqual (document .querySelectorAll (' link' )? .length , 1 );
7082` ` `
7183
7284Your ` link` element should be within your ` head` element.
7385
7486` ` ` js
75- assert .exists (document .querySelector (' head > link' ));
87+ const headContentRegex = / (?<=<head\s * >)[\S |\s ] * (?=<\/ head\s * >)/ ;
88+ const headElementContent = code .match (headContentRegex);
89+
90+ const headElement = document .createElement (" head" );
91+ headElement .innerHTML = headElementContent;
92+ assert .isNotNull (headElement .querySelector (' link' ));
7693` ` `
7794
7895Your ` link` element should have a ` rel` attribute with the value ` stylesheet` .
7996
8097` ` ` js
81- const link_element = document .querySelector (' link' );
82- const rel = link_element .getAttribute (" rel" );
83- assert .equal (rel, " stylesheet" );
98+ const linkElement = document .querySelector (' link' );
99+ const rel = linkElement ? .getAttribute (" rel" );
100+ assert .strictEqual (rel, " stylesheet" );
84101` ` `
85102
86103Your ` link` element should have an ` href` attribute with the value ` styles .css ` .
87104
88105` ` ` js
89- const link = document .querySelector (' link' );
90- assert .equal ( link .dataset .href , " styles.css" );
106+ const linkElement = document .querySelector (' link' );
107+ assert .strictEqual (linkElement ? .dataset .href , " styles.css" );
91108` ` `
92109
93110# --seed--
0 commit comments