From 048dfd4fc406e72ac1689091f9944dfe566345f2 Mon Sep 17 00:00:00 2001 From: Miles Malerba Date: Thu, 25 Jul 2024 08:25:01 -0700 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Jonny Gerig Meyer --- .vscode/settings.json | 3 ++ index.html | 19 +++++++----- public/anchor-media-query.css | 12 +++++--- src/cascade.ts | 14 ++++----- src/dom.ts | 55 ++++++++++++++++++++--------------- src/parse.ts | 2 +- src/polyfill.ts | 10 ++++--- src/validate.ts | 25 +++++++++------- tests/helpers.ts | 3 +- 9 files changed, 85 insertions(+), 58 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..1277f84 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "editor.rulers": [80] +} diff --git a/index.html b/index.html index e0cb667..729b5ef 100644 --- a/index.html +++ b/index.html @@ -810,24 +810,29 @@

Anchor declared in media query

-
Anchor
+
Screen Anchor
+
Print Anchor
Target

- With polyfill applied: Target is positioned at Anchor's bottom right - corner. + With polyfill applied: Target and Screen Anchor's right and top edges + line up.

@media all {
-  #my-anchor-media-query {
+>@media print {
+  #my-print-anchor-media-query {
     anchor-name: --my-anchor-media-query;
   }
 }
 
+#my-anchor-media-query {
+  anchor-name: --my-anchor-media-query;
+}
+
 #my-target-media-query {
   position: absolute;
-  top: anchor(--my-anchor-media-query bottom);
-  left: anchor(--my-anchor-media-query right);
+  top: anchor(--my-anchor-media-query top);
+  right: anchor(--my-anchor-media-query right);
 }