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 1111 function fakeFetch ( url ) {
1212 const urlObj = new URL ( url )
1313 let html = ''
14- if ( url . pathname === '/results' ) {
14+ if ( urlObj . pathname === '/results' ) {
1515 const doc = document . createElement ( 'div' )
1616 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' )
1818 for ( const el of doc . querySelectorAll ( 'li' ) ) {
1919 if ( q !== '' && ! el . textContent . toLowerCase ( ) . match ( q . toLowerCase ( ) ) ) el . remove ( )
2020 }
2121 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>`
2424 }
2525 const promiseHTML = new Promise ( resolve => resolve ( html ) )
2626 return new Promise ( resolve => resolve ( { ok : true , text : ( ) => promiseHTML } ) )
You can’t perform that action at this time.
0 commit comments