Skip to content

Commit

Permalink
deploy: 2aa21c4
Browse files Browse the repository at this point in the history
  • Loading branch information
plinss committed Mar 5, 2024
1 parent 944c2de commit 1dfd46f
Showing 1 changed file with 31 additions and 70 deletions.
101 changes: 31 additions & 70 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<title>Web Platform Design Principles</title>
<meta content="ED" name="w3c-status">
<link href="https://www.w3.org/StyleSheets/TR/2021/W3C-ED" rel="stylesheet">
<meta content="Bikeshed version e20e08949, updated Wed Jan 24 11:50:28 2024 -0800" name="generator">
<meta content="Bikeshed version d5d58a306, updated Fri Jan 26 16:12:28 2024 -0800" name="generator">
<link href="https://www.w3.org/TR/design-principles/" rel="canonical">
<meta content="c28ea6474f7b4b7a9debea583ccd23b59a3ed668" name="revision">
<meta content="2aa21c40868fc31721c53843df6fd1a3039707b1" name="revision">
<style>
table.data {
text-align: left;
Expand Down Expand Up @@ -699,7 +699,7 @@
<div class="head">
<p data-fill-with="logo"><a class="logo" href="https://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2021/logos/W3C" width="72"> </a> </p>
<h1 class="p-name no-ref" id="title">Web Platform Design Principles</h1>
<p id="w3c-state"><a href="https://www.w3.org/standards/types#ED">Editor’s Draft</a>, <time class="dt-updated" datetime="2024-01-25">25 January 2024</time></p>
<p id="w3c-state"><a href="https://www.w3.org/standards/types#ED">Editor’s Draft</a>, <time class="dt-updated" datetime="2024-03-05">5 March 2024</time></p>
<details open>
<summary>More details about this document</summary>
<div data-fill-with="spec-metadata">
Expand Down Expand Up @@ -3456,8 +3456,8 @@ <h3 class="heading settled" data-level="12.1" id="naming-common-words"><span cla
than <code>cardinality</code>.</p>
</div>
<p>Value readability over brevity.
Keep in mind, however, that sometimes
the shorter name is the clearer one.
Keep in mind, however, that
the shorter name is often the clearer one.
For instance,
it may be appropriate to use technical language or well-known terms of art
in the specification where the API is defined.</p>
Expand Down Expand Up @@ -4177,9 +4177,9 @@ <h3 class="no-num no-ref heading settled" id="informative"><span class="content"
<dt id="biblio-css-backgrounds-3">[CSS-BACKGROUNDS-3]
<dd>Elika Etemad; Brad Kemper. <a href="https://drafts.csswg.org/css-backgrounds/"><cite>CSS Backgrounds and Borders Module Level 3</cite></a>. URL: <a href="https://drafts.csswg.org/css-backgrounds/">https://drafts.csswg.org/css-backgrounds/</a>
<dt id="biblio-css-fonts-4">[CSS-FONTS-4]
<dd>John Daggett; Myles Maxfield; Chris Lilley. <a href="https://drafts.csswg.org/css-fonts-4/"><cite>CSS Fonts Module Level 4</cite></a>. URL: <a href="https://drafts.csswg.org/css-fonts-4/">https://drafts.csswg.org/css-fonts-4/</a>
<dd>Chris Lilley. <a href="https://drafts.csswg.org/css-fonts-4/"><cite>CSS Fonts Module Level 4</cite></a>. URL: <a href="https://drafts.csswg.org/css-fonts-4/">https://drafts.csswg.org/css-fonts-4/</a>
<dt id="biblio-css-fonts-5">[CSS-FONTS-5]
<dd>Myles Maxfield; Chris Lilley. <a href="https://drafts.csswg.org/css-fonts-5/"><cite>CSS Fonts Module Level 5</cite></a>. URL: <a href="https://drafts.csswg.org/css-fonts-5/">https://drafts.csswg.org/css-fonts-5/</a>
<dd>Chris Lilley. <a href="https://drafts.csswg.org/css-fonts-5/"><cite>CSS Fonts Module Level 5</cite></a>. URL: <a href="https://drafts.csswg.org/css-fonts-5/">https://drafts.csswg.org/css-fonts-5/</a>
<dt id="biblio-css-grid-1">[CSS-GRID-1]
<dd>Tab Atkins Jr.; et al. <a href="https://drafts.csswg.org/css-grid/"><cite>CSS Grid Layout Module Level 1</cite></a>. URL: <a href="https://drafts.csswg.org/css-grid/">https://drafts.csswg.org/css-grid/</a>
<dt id="biblio-css-inline-3">[CSS-INLINE-3]
Expand Down Expand Up @@ -4766,7 +4766,7 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content

function positionDfnPanel(dfnPanel) {
const dfn = dfnPanel.dfn;
const dfnPos = getRootLevelAbsolutePosition(dfn);
const dfnPos = getBounds(dfn);
dfnPanel.style.top = dfnPos.bottom + "px";
dfnPanel.style.left = dfnPos.left + "px";

Expand Down Expand Up @@ -4835,40 +4835,19 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
});
}

// TODO: shared util
// Returns the root-level absolute position {left and top} of element.
function getRootLevelAbsolutePosition(el) {
const boundsRect = el.getBoundingClientRect();
let xPos = 0;
let yPos = 0;

while (el) {
let xScroll = el.scrollLeft;
let yScroll = el.scrollTop;

// Ignore scrolling of body.
if (el.tagName === "BODY") {
xScroll = 0;
yScroll = 0;
}
xPos += (el.offsetLeft - xScroll + el.clientLeft);
yPos += (el.offsetTop - yScroll + el.clientTop);

el = el.offsetParent;
}
function getBounds(el, relativeTo=document.body) {
const relativeRect = relativeTo.getBoundingClientRect();
const elRect = el.getBoundingClientRect();
const top = elRect.top - relativeRect.top;
const left = elRect.left - relativeRect.left;
return {
left: xPos,
top: yPos,
right: xPos + boundsRect.width,
bottom: yPos + boundsRect.height,
};
}

function scrolledIntoView(element) {
const rect = element.getBoundingClientRect();
return (
rect.top > 0 &&
rect.bottom < window.innerHeight
);
top,
left,
bottom: top + elRect.height,
right: left + elRect.width,
}
}

function scrollToTargetAndHighlight(event) {
Expand All @@ -4877,10 +4856,6 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
hash = decodeURIComponent(hash.substring(1));
const dest = document.getElementById(hash);
if (dest) {
// Maybe prevent default scroll.
if (scrolledIntoView(dest)) {
event.preventDefault();
}
dest.classList.add('highlighted');
setTimeout(() => dest.classList.remove('highlighted'), 1000);
}
Expand Down Expand Up @@ -5417,7 +5392,7 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content

function positionRefHint(refHint) {
const link = refHint.forLink;
const linkPos = getRootLevelAbsolutePosition(link);
const linkPos = getBounds(link);
refHint.style.top = linkPos.bottom + "px";
refHint.style.left = linkPos.left + "px";

Expand All @@ -5433,31 +5408,17 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content

// TODO: shared util
// Returns the root-level absolute position {left and top} of element.
function getRootLevelAbsolutePosition(el) {
const boundsRect = el.getBoundingClientRect();
let xPos = 0;
let yPos = 0;

while (el) {
let xScroll = el.scrollLeft;
let yScroll = el.scrollTop;

// Ignore scrolling of body.
if (el.tagName === "BODY") {
xScroll = 0;
yScroll = 0;
}
xPos += (el.offsetLeft - xScroll + el.clientLeft);
yPos += (el.offsetTop - yScroll + el.clientTop);

el = el.offsetParent;
}
function getBounds(el, relativeTo=document.body) {
const relativeRect = relativeTo.getBoundingClientRect();
const elRect = el.getBoundingClientRect();
const top = elRect.top - relativeRect.top;
const left = elRect.left - relativeRect.left;
return {
left: xPos,
top: yPos,
right: xPos + boundsRect.width,
bottom: yPos + boundsRect.height,
};
top,
left,
bottom: top + elRect.height,
right: left + elRect.width,
}
}

function showRefHintListener(e) {
Expand All @@ -5483,7 +5444,7 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
}

document.addEventListener("DOMContentLoaded", () => {
document.body.addEventListener("mouseover", showRefHintListener);
document.body.addEventListener("mousedown", showRefHintListener);
document.body.addEventListener("focus", showRefHintListener);

document.body.addEventListener("click", hideAllHintsListener);
Expand Down

0 comments on commit 1dfd46f

Please sign in to comment.