Skip to content

Commit 1dfd46f

Browse files
committed
deploy: 2aa21c4
1 parent 944c2de commit 1dfd46f

File tree

1 file changed

+31
-70
lines changed

1 file changed

+31
-70
lines changed

index.html

Lines changed: 31 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
<title>Web Platform Design Principles</title>
66
<meta content="ED" name="w3c-status">
77
<link href="https://www.w3.org/StyleSheets/TR/2021/W3C-ED" rel="stylesheet">
8-
<meta content="Bikeshed version e20e08949, updated Wed Jan 24 11:50:28 2024 -0800" name="generator">
8+
<meta content="Bikeshed version d5d58a306, updated Fri Jan 26 16:12:28 2024 -0800" name="generator">
99
<link href="https://www.w3.org/TR/design-principles/" rel="canonical">
10-
<meta content="c28ea6474f7b4b7a9debea583ccd23b59a3ed668" name="revision">
10+
<meta content="2aa21c40868fc31721c53843df6fd1a3039707b1" name="revision">
1111
<style>
1212
table.data {
1313
text-align: left;
@@ -699,7 +699,7 @@
699699
<div class="head">
700700
<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>
701701
<h1 class="p-name no-ref" id="title">Web Platform Design Principles</h1>
702-
<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>
702+
<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>
703703
<details open>
704704
<summary>More details about this document</summary>
705705
<div data-fill-with="spec-metadata">
@@ -3456,8 +3456,8 @@ <h3 class="heading settled" data-level="12.1" id="naming-common-words"><span cla
34563456
than <code>cardinality</code>.</p>
34573457
</div>
34583458
<p>Value readability over brevity.
3459-
Keep in mind, however, that sometimes
3460-
the shorter name is the clearer one.
3459+
Keep in mind, however, that
3460+
the shorter name is often the clearer one.
34613461
For instance,
34623462
it may be appropriate to use technical language or well-known terms of art
34633463
in the specification where the API is defined.</p>
@@ -4177,9 +4177,9 @@ <h3 class="no-num no-ref heading settled" id="informative"><span class="content"
41774177
<dt id="biblio-css-backgrounds-3">[CSS-BACKGROUNDS-3]
41784178
<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>
41794179
<dt id="biblio-css-fonts-4">[CSS-FONTS-4]
4180-
<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>
4180+
<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>
41814181
<dt id="biblio-css-fonts-5">[CSS-FONTS-5]
4182-
<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>
4182+
<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>
41834183
<dt id="biblio-css-grid-1">[CSS-GRID-1]
41844184
<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>
41854185
<dt id="biblio-css-inline-3">[CSS-INLINE-3]
@@ -4766,7 +4766,7 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
47664766

47674767
function positionDfnPanel(dfnPanel) {
47684768
const dfn = dfnPanel.dfn;
4769-
const dfnPos = getRootLevelAbsolutePosition(dfn);
4769+
const dfnPos = getBounds(dfn);
47704770
dfnPanel.style.top = dfnPos.bottom + "px";
47714771
dfnPanel.style.left = dfnPos.left + "px";
47724772

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

4838+
// TODO: shared util
48384839
// Returns the root-level absolute position {left and top} of element.
4839-
function getRootLevelAbsolutePosition(el) {
4840-
const boundsRect = el.getBoundingClientRect();
4841-
let xPos = 0;
4842-
let yPos = 0;
4843-
4844-
while (el) {
4845-
let xScroll = el.scrollLeft;
4846-
let yScroll = el.scrollTop;
4847-
4848-
// Ignore scrolling of body.
4849-
if (el.tagName === "BODY") {
4850-
xScroll = 0;
4851-
yScroll = 0;
4852-
}
4853-
xPos += (el.offsetLeft - xScroll + el.clientLeft);
4854-
yPos += (el.offsetTop - yScroll + el.clientTop);
4855-
4856-
el = el.offsetParent;
4857-
}
4840+
function getBounds(el, relativeTo=document.body) {
4841+
const relativeRect = relativeTo.getBoundingClientRect();
4842+
const elRect = el.getBoundingClientRect();
4843+
const top = elRect.top - relativeRect.top;
4844+
const left = elRect.left - relativeRect.left;
48584845
return {
4859-
left: xPos,
4860-
top: yPos,
4861-
right: xPos + boundsRect.width,
4862-
bottom: yPos + boundsRect.height,
4863-
};
4864-
}
4865-
4866-
function scrolledIntoView(element) {
4867-
const rect = element.getBoundingClientRect();
4868-
return (
4869-
rect.top > 0 &&
4870-
rect.bottom < window.innerHeight
4871-
);
4846+
top,
4847+
left,
4848+
bottom: top + elRect.height,
4849+
right: left + elRect.width,
4850+
}
48724851
}
48734852

48744853
function scrollToTargetAndHighlight(event) {
@@ -4877,10 +4856,6 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
48774856
hash = decodeURIComponent(hash.substring(1));
48784857
const dest = document.getElementById(hash);
48794858
if (dest) {
4880-
// Maybe prevent default scroll.
4881-
if (scrolledIntoView(dest)) {
4882-
event.preventDefault();
4883-
}
48844859
dest.classList.add('highlighted');
48854860
setTimeout(() => dest.classList.remove('highlighted'), 1000);
48864861
}
@@ -5417,7 +5392,7 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
54175392

54185393
function positionRefHint(refHint) {
54195394
const link = refHint.forLink;
5420-
const linkPos = getRootLevelAbsolutePosition(link);
5395+
const linkPos = getBounds(link);
54215396
refHint.style.top = linkPos.bottom + "px";
54225397
refHint.style.left = linkPos.left + "px";
54235398

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

54345409
// TODO: shared util
54355410
// Returns the root-level absolute position {left and top} of element.
5436-
function getRootLevelAbsolutePosition(el) {
5437-
const boundsRect = el.getBoundingClientRect();
5438-
let xPos = 0;
5439-
let yPos = 0;
5440-
5441-
while (el) {
5442-
let xScroll = el.scrollLeft;
5443-
let yScroll = el.scrollTop;
5444-
5445-
// Ignore scrolling of body.
5446-
if (el.tagName === "BODY") {
5447-
xScroll = 0;
5448-
yScroll = 0;
5449-
}
5450-
xPos += (el.offsetLeft - xScroll + el.clientLeft);
5451-
yPos += (el.offsetTop - yScroll + el.clientTop);
5452-
5453-
el = el.offsetParent;
5454-
}
5411+
function getBounds(el, relativeTo=document.body) {
5412+
const relativeRect = relativeTo.getBoundingClientRect();
5413+
const elRect = el.getBoundingClientRect();
5414+
const top = elRect.top - relativeRect.top;
5415+
const left = elRect.left - relativeRect.left;
54555416
return {
5456-
left: xPos,
5457-
top: yPos,
5458-
right: xPos + boundsRect.width,
5459-
bottom: yPos + boundsRect.height,
5460-
};
5417+
top,
5418+
left,
5419+
bottom: top + elRect.height,
5420+
right: left + elRect.width,
5421+
}
54615422
}
54625423

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

54855446
document.addEventListener("DOMContentLoaded", () => {
5486-
document.body.addEventListener("mouseover", showRefHintListener);
5447+
document.body.addEventListener("mousedown", showRefHintListener);
54875448
document.body.addEventListener("focus", showRefHintListener);
54885449

54895450
document.body.addEventListener("click", hideAllHintsListener);

0 commit comments

Comments
 (0)