5
5
< title > Web Platform Design Principles</ title >
6
6
< meta content ="ED " name ="w3c-status ">
7
7
< 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 ">
9
9
< link href ="https://www.w3.org/TR/design-principles/ " rel ="canonical ">
10
- < meta content ="c28ea6474f7b4b7a9debea583ccd23b59a3ed668 " name ="revision ">
10
+ < meta content ="2aa21c40868fc31721c53843df6fd1a3039707b1 " name ="revision ">
11
11
< style >
12
12
table .data {
13
13
text-align : left;
699
699
< div class ="head ">
700
700
< 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 >
701
701
< 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 >
703
703
< details open >
704
704
< summary > More details about this document</ summary >
705
705
< div data-fill-with ="spec-metadata ">
@@ -3456,8 +3456,8 @@ <h3 class="heading settled" data-level="12.1" id="naming-common-words"><span cla
3456
3456
than < code > cardinality</ code > .</ p >
3457
3457
</ div >
3458
3458
< 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.
3461
3461
For instance,
3462
3462
it may be appropriate to use technical language or well-known terms of art
3463
3463
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"
4177
4177
< dt id ="biblio-css-backgrounds-3 "> [CSS-BACKGROUNDS-3]
4178
4178
< 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 >
4179
4179
< 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 >
4181
4181
< 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 >
4183
4183
< dt id ="biblio-css-grid-1 "> [CSS-GRID-1]
4184
4184
< 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 >
4185
4185
< 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
4766
4766
4767
4767
function positionDfnPanel ( dfnPanel ) {
4768
4768
const dfn = dfnPanel . dfn ;
4769
- const dfnPos = getRootLevelAbsolutePosition ( dfn ) ;
4769
+ const dfnPos = getBounds ( dfn ) ;
4770
4770
dfnPanel . style . top = dfnPos . bottom + "px" ;
4771
4771
dfnPanel . style . left = dfnPos . left + "px" ;
4772
4772
@@ -4835,40 +4835,19 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
4835
4835
} ) ;
4836
4836
}
4837
4837
4838
+ // TODO: shared util
4838
4839
// 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 ;
4858
4845
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
+ }
4872
4851
}
4873
4852
4874
4853
function scrollToTargetAndHighlight ( event ) {
@@ -4877,10 +4856,6 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
4877
4856
hash = decodeURIComponent ( hash . substring ( 1 ) ) ;
4878
4857
const dest = document . getElementById ( hash ) ;
4879
4858
if ( dest ) {
4880
- // Maybe prevent default scroll.
4881
- if ( scrolledIntoView ( dest ) ) {
4882
- event . preventDefault ( ) ;
4883
- }
4884
4859
dest . classList . add ( 'highlighted' ) ;
4885
4860
setTimeout ( ( ) => dest . classList . remove ( 'highlighted' ) , 1000 ) ;
4886
4861
}
@@ -5417,7 +5392,7 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
5417
5392
5418
5393
function positionRefHint ( refHint ) {
5419
5394
const link = refHint . forLink ;
5420
- const linkPos = getRootLevelAbsolutePosition ( link ) ;
5395
+ const linkPos = getBounds ( link ) ;
5421
5396
refHint . style . top = linkPos . bottom + "px" ;
5422
5397
refHint . style . left = linkPos . left + "px" ;
5423
5398
@@ -5433,31 +5408,17 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
5433
5408
5434
5409
// TODO: shared util
5435
5410
// 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 ;
5455
5416
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
+ }
5461
5422
}
5462
5423
5463
5424
function showRefHintListener ( e ) {
@@ -5483,7 +5444,7 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
5483
5444
}
5484
5445
5485
5446
document . addEventListener ( "DOMContentLoaded" , ( ) => {
5486
- document . body . addEventListener ( "mouseover " , showRefHintListener ) ;
5447
+ document . body . addEventListener ( "mousedown " , showRefHintListener ) ;
5487
5448
document . body . addEventListener ( "focus" , showRefHintListener ) ;
5488
5449
5489
5450
document . body . addEventListener ( "click" , hideAllHintsListener ) ;
0 commit comments