-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Playing around with defer and sync WP strategies
- This is a POC
- Loading branch information
1 parent
38cf0a1
commit f0346e2
Showing
6 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
(() => { | ||
/*eslint-disable no-console*/ | ||
console.log('async-elements loaded.'); | ||
const elements = ['async']; | ||
|
||
for (const element of elements) { | ||
const el = document.createElement('h3'); | ||
el.className = element; | ||
el.innerHTML = `${element} element`; | ||
document.querySelector('.page-header-title').insertAdjacentElement('afterend', el); | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
(() => { | ||
/*eslint-disable no-console*/ | ||
console.log('async-script loaded.'); | ||
for (const element of [['async', 'green']]) { | ||
document.querySelector(`.${element[0]}`).style.color = element[1]; | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
(() => { | ||
/*eslint-disable no-console*/ | ||
console.log('defer-element loaded.'); | ||
const elements = ['defer']; | ||
|
||
for (const element of elements) { | ||
const el = document.createElement('h3'); | ||
el.className = element; | ||
el.innerHTML = `${element} element`; | ||
document.querySelector('.page-header-title').insertAdjacentElement('afterend', el); | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
(() => { | ||
/*eslint-disable no-console*/ | ||
console.log('defer-script loaded.'); | ||
for (const element of [['defer', 'purple']]) { | ||
document.querySelector(`.${element[0]}`).style.color = element[1]; | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters