Skip to content

Commit 8e033c3

Browse files
aduh95ruyadorno
authored andcommitted
doc: rename possibly confusing variable and CSS class
A "selector" usually refers to a CSS selector, when here it refers to a checkbox. PR-URL: #49536 Reviewed-By: Claudio Wunder <cwunder@gnome.org> Reviewed-By: Tierney Cyren <hello@bnb.im> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
1 parent 4126a6e commit 8e033c3

5 files changed

Lines changed: 18 additions & 18 deletions

File tree

‎doc/api_assets/api.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,12 @@
142142
button.addEventListener('click',(el)=>{
143143
constparentNode=el.target.parentNode;
144144

145-
constflavorSelector=parentNode.querySelector('.js-flavor-selector');
145+
constflavorToggle=parentNode.querySelector('.js-flavor-toggle');
146146

147147
letcode='';
148148

149-
if(flavorSelector){
150-
if(flavorSelector.checked){
149+
if(flavorToggle){
150+
if(flavorToggle.checked){
151151
code=parentNode.querySelector('.mjs').textContent;
152152
}else{
153153
code=parentNode.querySelector('.cjs').textContent;

‎doc/api_assets/style.css‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ kbd {
950950
display: block;
951951
}
952952

953-
.js-flavor-selector {
953+
.js-flavor-toggle {
954954
-webkit-appearance: none;
955955
appearance: none;
956956
float: right;
@@ -963,14 +963,14 @@ kbd {
963963
cursor: pointer;
964964
margin:0;
965965
}
966-
.js-flavor-selector:checked {
966+
.js-flavor-toggle:checked {
967967
background-image: url(./js-flavor-esm.svg);
968968
}
969-
.js-flavor-selector:not(:checked) ~ .mjs,
970-
.js-flavor-selector:checked~ .cjs {
969+
.js-flavor-toggle:not(:checked) ~ .mjs,
970+
.js-flavor-toggle:checked~ .cjs {
971971
display: none;
972972
}
973-
.dark-mode .js-flavor-selector {
973+
.dark-mode .js-flavor-toggle {
974974
filter:invert(1);
975975
}
976976

@@ -1001,7 +1001,7 @@ kbd {
10011001
}
10021002

10031003
@supports (aspect-ratio:1/1) {
1004-
.js-flavor-selector {
1004+
.js-flavor-toggle {
10051005
height:1.5em;
10061006
width: auto;
10071007
aspect-ratio:2719/384;
@@ -1058,24 +1058,24 @@ kbd {
10581058
#apicontent {
10591059
overflow: hidden;
10601060
}
1061-
.js-flavor-selector {
1061+
.js-flavor-toggle {
10621062
display: none;
10631063
}
1064-
.js-flavor-selector+* {
1064+
.js-flavor-toggle+* {
10651065
margin-bottom:2rem;
10661066
padding-bottom:2rem;
10671067
border-bottom:1px solid var(--color-text-primary);
10681068
}
1069-
.js-flavor-selector~* {
1069+
.js-flavor-toggle~* {
10701070
display: block !important;
10711071
background-position: top right;
10721072
background-size:142px20px;
10731073
background-repeat: no-repeat;
10741074
}
1075-
.js-flavor-selector~ .cjs {
1075+
.js-flavor-toggle~ .cjs {
10761076
background-image: url(./js-flavor-cjs.svg);
10771077
}
1078-
.js-flavor-selector~ .mjs {
1078+
.js-flavor-toggle~ .mjs {
10791079
background-image: url(./js-flavor-esm.svg);
10801080
}
10811081
}

‎test/doctool/test-doctool-html.mjs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,11 @@ const testData = [
138138
},
139139
{
140140
file: fixtures.path('document_with_esm_and_cjs_code_snippet.md'),
141-
html: '<input class="js-flavor-selector" type="checkbox" checked',
141+
html: '<input class="js-flavor-toggle" type="checkbox" checked',
142142
},
143143
{
144144
file: fixtures.path('document_with_cjs_and_esm_code_snippet.md'),
145-
html: '<input class="js-flavor-selector" type="checkbox" aria-label',
145+
html: '<input class="js-flavor-toggle" type="checkbox" aria-label',
146146
},
147147
];
148148

‎tools/doc/buildCSSForFlavoredJS.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default function buildCSSForFlavoredJS(dynamicSizes) {
4545
`@media(max-width:${getMarginLeft(charCount)+getPaddingLeft(charCount)+
4646
charCount*ESTIMATED_CHAR_WIDTH+TOGGLE_WIDTH+
4747
getPaddingRight(charCount)+getMarginRight(charCount)}px){`+
48-
`.with-${charCount}-chars>.js-flavor-selector{`+
48+
`.with-${charCount}-chars>.js-flavor-toggle{`+
4949
'float:none;'+
5050
'margin:0 0 1em auto;'+
5151
'}'+

‎tools/doc/html.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ export function preprocessElements({ filename }) {
250250
constactualCharCount=Math.max(charCountFirstTwoLines,previousNode.charCountFirstTwoLines);
251251
(dynamicSizes[filename]??=newSet()).add(actualCharCount);
252252
node.value=`<pre class="with-${actualCharCount}-chars">`+
253-
'<input class="js-flavor-selector" type="checkbox"'+
253+
'<input class="js-flavor-toggle" type="checkbox"'+
254254
// If CJS comes in second, ESM should display by default.
255255
(node.lang==='cjs' ? ' checked' : '')+
256256
' aria-label="Show modern ES modules syntax">'+

0 commit comments

Comments
 (0)