File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 11
11
function fakeFetch ( url ) {
12
12
const urlObj = new URL ( url )
13
13
let html = ''
14
- if ( url . pathname === '/results' ) {
14
+ if ( urlObj . pathname === '/results' ) {
15
15
const doc = document . createElement ( 'div' )
16
16
doc . innerHTML = `<li>Hubot</li><li>BB-8</li><li>Wall-E</li><li>Bender</li>`
17
- const q = url . searchParams . get ( 'q' )
17
+ const q = urlObj . searchParams . get ( 'q' )
18
18
for ( const el of doc . querySelectorAll ( 'li' ) ) {
19
19
if ( q !== '' && ! el . textContent . toLowerCase ( ) . match ( q . toLowerCase ( ) ) ) el . remove ( )
20
20
}
21
21
html = doc . innerHTML
22
- } else if ( url . pathname === '/marquee' ) {
23
- html = `<marquee>${ url . searchParams . get ( 'q' ) || '🐈 Nothing to preview 🐈' } </marquee>`
22
+ } else if ( urlObj . pathname === '/marquee' ) {
23
+ html = `<marquee>${ urlObj . searchParams . get ( 'q' ) || '🐈 Nothing to preview 🐈' } </marquee>`
24
24
}
25
25
const promiseHTML = new Promise ( resolve => resolve ( html ) )
26
26
return new Promise ( resolve => resolve ( { ok : true , text : ( ) => promiseHTML } ) )
You can’t perform that action at this time.
0 commit comments