Skip to content

Commit 8a61280

Browse files
committed
Remove unused flag values and make empty string an option to remove them
1 parent 91eee9a commit 8a61280

4 files changed

Lines changed: 68 additions & 21 deletions

File tree

docs/CSS12-user_prefs.md

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,30 @@ You don’t need to remove the variable before setting another value, the new va
3737

3838
#### Removing
3939

40+
You can either remove the style explicitly with `removeProperty()`:
41+
4042
```
4143
var root = document.documentElement;
4244
4345
root.style.removeProperty("name of var");
4446
```
4547

48+
Or implicitly by using an empty string as a value with `setProperty()`:
49+
50+
```
51+
var root = document.documentElement;
52+
53+
root.style.setProperty("name of var", "");
54+
```
55+
56+
Setting a property with an empty string as the value will indeed invoke `removeProperty()`, as defined in the [CSS Object Model Spec](https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-setproperty).
57+
4658
## Flags
4759

4860
Some variables behave like flags. You could also use custom `data-*` attributes or CSS classes to manage the following ones. See the [“Quickstart” doc](../docs/CSS02-quickstart.md) for customization.
4961

62+
By default, those flags are not set. Then their initialization depends on your user settings’ management e.g. apply user settings to all EPUBs, only the ones that have already been customized, etc.
63+
5064
### User view
5165

5266
Allows to switch between paged and scroll view.
@@ -55,10 +69,12 @@ Allows to switch between paged and scroll view.
5569
--USER__view
5670
```
5771

58-
Possible values: `readium-paged-on` | `readium-scroll-on`
72+
Supported values: `readium-paged-on` | `readium-scroll-on`
5973

6074
Override class: Chrome (should be applied by any means necessary)
6175

76+
If the flag is not set, ReadiumCSS will fall back to the paged view.
77+
6278
### Font Family override
6379

6480
Acts as an explicit switch to override the publisher’s `font-family`.
@@ -67,11 +83,11 @@ Acts as an explicit switch to override the publisher’s `font-family`.
6783
--USER__fontOverride
6884
```
6985

70-
Possible values: `readium-font-on` | `readium-font-off`
86+
Supported value: `readium-font-on`
7187

7288
Override class: None. This flag is required to change the `font-family` user setting.
7389

74-
To switch back to the publisher’s font, you can either change the value to `readium-font-off` or remove the flag.
90+
To switch back to the publisher’s font, you can either set an empty string as a value or remove the property.
7591

7692
### Advanced Settings
7793

@@ -83,11 +99,11 @@ If you provide users with a “Publisher’s styles” toggle, it must be enable
8399
--USER__advancedSettings
84100
```
85101

86-
Possible values: `readium-advanced-on` | `readium-advanced-off`
102+
Supported value: `readium-advanced-on`
87103

88104
Override class: None. This flag is required to apply the `font-family`, the `font-size` and/or advanced user settings.
89105

90-
To switch back to the publisher’s styles, you can either change the value to `readium-advanced-off` or remove it. This will disable all advanced settings requiring the flag.
106+
To switch back to the publisher’s styles, you can either set an empty string as a value or remove the property. This will disable all advanced settings requiring the flag.
91107

92108
### Reading Modes
93109

@@ -97,10 +113,12 @@ We currently have two reading modes for night and sepia.
97113
--USER__appearance
98114
```
99115

100-
Possible values: `readium-day-on` | `readium-sepia-on` | `readium-night-on`
116+
Supported values: `readium-day-on` | `readium-sepia-on` | `readium-night-on`
101117

102118
Override class: Chrome (should be applied by any means necessary)
103119

120+
If the flag is not set, ReadiumCSS will fall back to the day mode.
121+
104122
### Filters
105123

106124
Please note night mode provides two extra specific variables:
@@ -109,18 +127,22 @@ Please note night mode provides two extra specific variables:
109127
--USER__darkenFilter
110128
```
111129

112-
Possible values: `readium-darken-on` | `readium-darken-off`
130+
Supported value: `readium-darken-on`
113131

114132
Override class: Chrome advanced (optional but should be applied by any means necessary if provided to users)
115133

134+
To disable the filter, you can either set an empty string as a value or remove the property.
135+
116136
```
117137
--USER__invertFilter
118138
```
119139

120-
Possible values: `readium-invert-on` | `readium-invert-off`
140+
Supported value: `readium-invert-on`
121141

122142
Override class: Chrome advanced (optional but should be applied by any means necessary if provided to users)
123143

144+
To disable the filter, you can either set an empty string as a value or remove the property.
145+
124146
### Accessibility Normalization
125147

126148
Users may want to normalize text (no bold, no italics, etc.) for accessibility reasons, using a non a11y-specific typeface.
@@ -129,12 +151,14 @@ Users may want to normalize text (no bold, no italics, etc.) for accessibility r
129151
--USER__a11yNormalize
130152
```
131153

132-
Possible values: `readium-a11y-on` | `readium-a11y-off`
154+
Supported value: `readium-a11y-on`
133155

134156
Required flag: `--USER__fontOverride: readium-font-on`
135157

136158
Override class: User settings advanced (optional but should be applied by any means necessary if provided to users)
137159

160+
To disable the normalization, you can either set an empty string as a value or remove the property.
161+
138162
## List of variables
139163

140164
### Layout

docs/ReadiumCSS_docs.epub

257 Bytes
Binary file not shown.

docs/ReadiumCSS_docs/OEBPS/Text/Section-012.xhtml

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,26 @@
5050
<section id="setting" class="level4">
5151
<h4 class="sigil_not_in_toc">Setting</h4>
5252

53-
<pre><code>var root = document.documentElement; root.style.setProperty("name of var", "value");</code></pre>
53+
<pre><code>var root = document.documentElement;
54+
root.style.setProperty("name of var", "value");</code></pre>
5455

5556
<p>You don’t need to remove the variable before setting another value, the new value will simply override the existing one.</p>
5657
</section>
5758

5859
<section id="removing" class="level4">
5960
<h4 class="sigil_not_in_toc">Removing</h4>
6061

61-
<pre><code>var root = document.documentElement; root.style.removeProperty("name of var");</code></pre>
62+
<p>You can either remove the style explicitly with <code>removeProperty()</code>:</p>
63+
64+
<pre><code>var root = document.documentElement;
65+
root.style.removeProperty("name of var");</code></pre>
66+
67+
<p>Or implicitly by using an empty string as a value with <code>setProperty()</code>:</p>
68+
69+
<pre><code>var root = document.documentElement;
70+
root.style.setProperty("name of var", "");</code></pre>
71+
72+
<p>Setting a property with an empty string as the value will indeed invoke <code>removeProperty()</code>, as defined in the <a href="https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-setproperty">CSS Object Model Spec</a>.</p>
6273
</section>
6374
</section>
6475
</section>
@@ -68,16 +79,20 @@
6879

6980
<p>Some variables behave like flags. You could also use custom <code>data-*</code> attributes or CSS classes to manage the following ones. See the <a href="../Text/Section-002.xhtml">“Quickstart” doc</a> for customization.</p>
7081

82+
<p>By default, those flags are not set. Then their initialization depends on your user settings’ management e.g. apply user settings to all EPUBs, only the ones that have already been customized, etc.</p>
83+
7184
<section id="user-view" class="level3">
7285
<h3 class="sigil_not_in_toc">User view</h3>
7386

7487
<p>Allows to switch between paged and scroll view.</p>
7588

7689
<pre><code>--USER__view</code></pre>
7790

78-
<p>Possible values: <code>readium-paged-on</code> | <code>readium-scroll-on</code></p>
91+
<p>Supported values: <code>readium-paged-on</code> | <code>readium-scroll-on</code></p>
7992

8093
<p>Override class: Chrome (should be applied by any means necessary)</p>
94+
95+
<p>If the flag is not set, ReadiumCSS will fall back to the paged view.</p>
8196
</section>
8297

8398
<section id="font-family-override" class="level3">
@@ -87,11 +102,11 @@
87102

88103
<pre><code>--USER__fontOverride</code></pre>
89104

90-
<p>Possible values: <code>readium-font-on</code> | <code>readium-font-off</code></p>
105+
<p>Supported value: <code>readium-font-on</code></p>
91106

92107
<p>Override class: None. This flag is required to change the <code>font-family</code> user setting.</p>
93108

94-
<p>To switch back to the publisher’s font, you can either change the value to <code>readium-font-off</code> or remove the flag.</p>
109+
<p>To switch back to the publisher’s font, you can either set an empty string as a value or remove the property.</p>
95110
</section>
96111

97112
<section id="advanced-settings" class="level3">
@@ -103,11 +118,11 @@
103118

104119
<pre><code>--USER__advancedSettings</code></pre>
105120

106-
<p>Possible values: <code>readium-advanced-on</code> | <code>readium-advanced-off</code></p>
121+
<p>Supported value: <code>readium-advanced-on</code></p>
107122

108123
<p>Override class: None. This flag is required to apply the <code>font-family</code>, the <code>font-size</code> and/or advanced user settings.</p>
109124

110-
<p>To switch back to the publisher’s styles, you can either change the value to <code>readium-advanced-off</code> or remove it. This will disable all advanced settings requiring the flag.</p>
125+
<p>To switch back to the publisher’s styles, you can either set an empty string as a value or remove the property. This will disable all advanced settings requiring the flag.</p>
111126
</section>
112127

113128
<section id="reading-modes" class="level3">
@@ -117,9 +132,11 @@
117132

118133
<pre><code>--USER__appearance</code></pre>
119134

120-
<p>Possible values: <code>readium-day-on</code> | <code>readium-sepia-on</code> | <code>readium-night-on</code></p>
135+
<p>Supported values: <code>readium-day-on</code> | <code>readium-sepia-on</code> | <code>readium-night-on</code></p>
121136

122137
<p>Override class: Chrome (should be applied by any means necessary)</p>
138+
139+
<p>If the flag is not set, ReadiumCSS will fall back to the day mode.</p>
123140
</section>
124141

125142
<section id="filters" class="level3">
@@ -129,15 +146,19 @@
129146

130147
<pre><code>--USER__darkenFilter</code></pre>
131148

132-
<p>Possible values: <code>readium-darken-on</code> | <code>readium-darken-off</code></p>
149+
<p>Supported value: <code>readium-darken-on</code></p>
133150

134151
<p>Override class: Chrome advanced (optional but should be applied by any means necessary if provided to users)</p>
135152

153+
<p>To disable the filter, you can either set an empty string as a value or remove the property.</p>
154+
136155
<pre><code>--USER__invertFilter</code></pre>
137156

138-
<p>Possible values: <code>readium-invert-on</code> | <code>readium-invert-off</code></p>
157+
<p>Supported value: <code>readium-invert-on</code></p>
139158

140159
<p>Override class: Chrome advanced (optional but should be applied by any means necessary if provided to users)</p>
160+
161+
<p>To disable the filter, you can either set an empty string as a value or remove the property.</p>
141162
</section>
142163

143164
<section id="accessibility-normalization" class="level3">
@@ -147,11 +168,13 @@
147168

148169
<pre><code>--USER__a11yNormalize</code></pre>
149170

150-
<p>Possible values: <code>readium-a11y-on</code> | <code>readium-a11y-off</code></p>
171+
<p>Supported value: <code>readium-a11y-on</code></p>
151172

152173
<p>Required flag: <code>--USER__fontOverride: readium-font-on</code></p>
153174

154175
<p>Override class: User settings advanced (optional but should be applied by any means necessary if provided to users)</p>
176+
177+
<p>To disable the normalization, you can either set an empty string as a value or remove the property.</p>
155178
</section>
156179
</section>
157180

docs/ReadiumCSS_docs/OEBPS/content.opf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<dc:language>en</dc:language>
99
<dc:identifier id="epub-id-1">urn:uuid:91cab77e-946f-4814-9e61-8494a5d5cb0f</dc:identifier>
1010
<meta name="cover" content="cover_jpg"/>
11-
<meta property="dcterms:modified">2020-03-09T16:47:28Z</meta>
11+
<meta property="dcterms:modified">2020-03-10T20:56:35Z</meta>
1212
<meta content="0.9.5" name="Sigil version"/>
1313
<meta property="schema:accessibilityFeature">displayTransformability</meta>
1414
<meta property="schema:accessibilityFeature">readingOrder</meta>

0 commit comments

Comments
 (0)