generated from oddbird/polyfill-template
-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from oddbird/animation-frame-api
Allow updating anchor on every animationFrame.
- Loading branch information
Showing
7 changed files
with
192 additions
and
74 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#my-anchor-update { | ||
anchor-name: --my-anchor-update; | ||
} | ||
|
||
#my-anchor-update[data-small] { | ||
width: 100px; | ||
} | ||
|
||
#my-anchor-update[data-large] { | ||
width: 400px; | ||
} | ||
|
||
#my-target-update { | ||
position: absolute; | ||
right: anchor(--my-anchor-update right); | ||
top: anchor(--my-anchor-update bottom); | ||
} |
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,8 @@ | ||
export {}; | ||
|
||
declare global { | ||
interface Window { | ||
UPDATE_ANCHOR_ON_ANIMATION_FRAME?: boolean; | ||
CHECK_LAYOUT_DELAY?: boolean; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import { polyfill } from './polyfill.js'; | ||
|
||
// @ts-expect-error Used by the WPT test harness to delay test assertions | ||
// Used by the WPT test harness to delay test assertions | ||
// and give the polyfill time to apply changes | ||
window.CHECK_LAYOUT_DELAY = true; | ||
|
||
// apply polyfill | ||
if (document.readyState !== 'complete') { | ||
window.addEventListener('load', () => { | ||
polyfill(); | ||
polyfill(true); | ||
}); | ||
} else { | ||
polyfill(); | ||
polyfill(true); | ||
} |
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
Oops, something went wrong.