Skip to content

Commit

Permalink
fix missed typos
Browse files Browse the repository at this point in the history
  • Loading branch information
omar-dulaimi committed Aug 16, 2022
1 parent 9aedd0c commit 8ae6a71
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The goal is to make route changes on static sites feel faster, like an SPA, with

1. It tells the browser to prefetch visible links in the current page with `IntersectionObserver`.
2. Intercepts click and popstate events, then updates the HTML5 history on route changes.
3. Uses `fetch` to get the next page, swaps the `<body>` out, merges the `<head>`, but does not re-exectute head scripts (unless asked to).
3. Uses `fetch` to get the next page, swaps the `<body>` out, merges the `<head>`, but does not re-execute head scripts (unless asked to).

This means you can have long-lived JavaScript behaviors between navigations. It works especially well with native web components.

Expand Down
2 changes: 1 addition & 1 deletion example/script2.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
console.log('script 2');
document.getElementById('headCheck2').innerText = '✔️ head script works (this shoud NOT appear of hot navigation)';
document.getElementById('headCheck2').innerText = '✔️ head script works (this should NOT appear of hot navigation)';
2 changes: 1 addition & 1 deletion lib/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function runScripts() {
bodyScripts.forEach(replaceAndRunScript);
}

// Private helper to reexecute scripts
// Private helper to re-execute scripts
async function replaceAndRunScript(oldScript: HTMLScriptElement) {
const newScript = document.createElement('script');
const attrs = Array.from(oldScript.attributes);
Expand Down
8 changes: 4 additions & 4 deletions test/main.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect } from '@playwright/test';
import { expect, test } from '@playwright/test';

test('basic navigation works', async ({ page }) => {

Expand Down Expand Up @@ -33,7 +33,7 @@ test('only valid scripts should run', async ({ page }) => {
});


test('navigate programatically', async ({ page }) => {
test('navigate programmatically', async ({ page }) => {

await page.goto('http://localhost:3000');
const about = page.locator('#about');
Expand All @@ -47,7 +47,7 @@ test('navigate programatically', async ({ page }) => {
});


test('metatags are added and removed', async ({ page }) => {
test('meta tags are added and removed', async ({ page }) => {

await page.goto('http://localhost:3000');
const about = page.locator('#about');
Expand Down Expand Up @@ -88,7 +88,7 @@ test('prefetching works', async ({ page }) => {
let testPre = page.locator('link[href="/test"]');
await expect(testPre).toHaveCount(0)

// Validate instersection observer works
// Validate intersection observer works
const heading = page.locator('#chapter');
await heading.click();

Expand Down

0 comments on commit 8ae6a71

Please sign in to comment.