-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
diagnostic.css
330 lines (264 loc) · 10.3 KB
/
diagnostic.css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
/* content styles */
applet:hover:after, basefont:hover:after, center:hover:after, dir:hover:after, font:hover:after, isindex:hover:after, menu:hover:after, strike:hover:after, s:hover:after, u:hover:after, *[background]:hover:after, *[bgcolor]:hover:after, *[clear]:hover:after, *[color]:hover:after, *[compact]:hover:after, *[noshade]:hover:after, *[nowrap]:hover:after, *[size]:hover:after, *[start]:hover:after, *[bottommargin]:hover:after, *[leftmargin]:hover:after, *[rightmargin]:hover:after, *[topmargin]:hover:after, *[marginheight]:hover:after, *[marginwidth]:hover:after, *[alink]:hover:after, *[link]:hover:after, *[text]:hover:after, *[vlink]:hover:after, *[align]:hover:after, *[valign]:hover:after, *[hspace]:hover:after, *[vspace]:hover:after, *[height]:hover:after, *[width]:hover:after, ul[type]:hover:after, ol[type]:hover:after, li[type]:hover:after, iframe:not([title]):hover:after, div[role="img"]:not([aria-label]):hover:after, a[href=""]:hover:after, a[href="#"]:hover:after, a:not([href]):hover:after, a[href*=javascript\:]:hover:after, a[onclick]:hover:after, a[href=""]:focus:after, a[href="#"]:focus:after, a:not([href]):focus:after, a[href*=javascript\:]:focus:after, a[onclick]:focus:after, fieldset > :not(legend):first-child:after, fieldset > legend:not(:first-child):after, label:not([for]):hover:after, *[accesskey]:hover:after, th:empty:hover:after, table > tr:only-child:after, table > tbody > tr:only-child:after, table[align]:after, table[bgcolor]:after, table[outline]:after, table[cellpadding]:after, table[cellspacing]:after, table[width]:after, td[width]:after, td[valign]:after {
position: absolute;
display: block;
width: 200px;
background: #fcfcfc;
color: #333;
outline: 2px solid;
padding: 5px;
}
/* content styles */
applet:hover:after, basefont:hover:after, center:hover:after, dir:hover:after, font:hover:after, isindex:hover:after, menu:hover:after, strike:hover:after, s:hover:after, u:hover:after, *[background]:hover:after, *[bgcolor]:hover:after, *[clear]:hover:after, *[color]:hover:after, *[compact]:hover:after, *[noshade]:hover:after, *[nowrap]:hover:after, *[size]:hover:after, *[start]:hover:after, *[bottommargin]:hover:after, *[leftmargin]:hover:after, *[rightmargin]:hover:after, *[topmargin]:hover:after, *[marginheight]:hover:after, *[marginwidth]:hover:after, *[alink]:hover:after, *[link]:hover:after, *[text]:hover:after, *[vlink]:hover:after, *[align]:hover:after, *[valign]:hover:after, *[hspace]:hover:after, *[vspace]:hover:after, *[height]:hover:after, *[width]:hover:after, ul[type]:hover:after, ol[type]:hover:after, li[type]:hover:after, iframe:not([title]):hover:after {
position: absolute;
background: #fff;
padding: 3px;
outline: 2px solid;
color: #333;
}
/* Deprecated Elements - cannot be overridden by user styles */
applet, basefont, center, dir, font, isindex, menu, s, strike, u {
outline: 2px dotted red !important;
}
applet:hover:after {
content: " <applet> is a deprecated HTML element";
}
basefont:hover:after {
content: " <basefont> is a deprecated HTML element";
}
center:hover:after {
content: " <center> is a deprecated HTML element";
}
dir:hover:after {
content: " <dir> is a deprecated HTML element";
}
font:hover:after {
content: " <font> is a deprecated HTML element";
}
isindex:hover:after {
content: " <isindex> is a deprecated HTML element";
}
menu:hover:after {
content: " <menu> is a deprecated HTML element";
}
strike:hover:after {
content: " <strike> is a deprecated HTML element";
}
s:hover:after {
content: " <s> is a deprecated HTML element";
}
u:hover:after {
content: " <u> is a deprecated HTML element";
}
/* Deprecated Attributes - cannot be overridden by user styles */
*[background], *[bgcolor], *[clear], *[color], *[compact], *[noshade], *[nowrap], *[size], *[start], *[bottommargin], *[leftmargin], *[rightmargin], *[topmargin], *[marginheight], *[marginwidth], *[alink], *[link], *[text], *[vlink], *[align], *[valign], *[hspace], *[vspace], *[height], *[width], ul[type], ol[type], li[type] {
outline: 2px solid red;
}
img[height], img[width] {
outline: none;
}
*[background]:hover:after {
content: " background is a deprecated HTML attribute";
}
*[bgcolor]:hover:after {
content: " bgcolor is a deprecated HTML attribute";
}
*[clear]:hover:after {
content: " clear is a deprecated HTML attribute";
}
*[color]:hover:after {
content: " color is a deprecated HTML attribute";
}
*[compact]:hover:after {
content: " compact is a deprecated HTML attribute";
}
*[noshade]:hover:after {
content: " noshade is a deprecated HTML attribute";
}
*[nowrap]:hover:after {
content: " nowrap is a deprecated HTML attribute";
}
*[size]:hover:after {
content: " size is a deprecated HTML attribute";
}
*[start]:hover:after {
content: " start is a deprecated HTML attribute";
}
*[bottommargin]:hover:after {
content: " bottommargin is a deprecated HTML attribute";
}
*[leftmargin]:hover:after {
content: " leftmargin is a deprecated HTML attribute";
}
*[rightmargin]:hover:after {
content: " rightmargin is a deprecated HTML attribute";
}
*[topmargin]:hover:after {
content: " topmargin is a deprecated HTML attribute";
}
*[marginheight]:hover:after {
content: " marginheight is a deprecated HTML attribute";
}
*[marginwidth]:hover:after {
content: " marginwidth is a deprecated HTML attribute";
}
*[alink]:hover:after {
content: " alink is a deprecated HTML attribute";
}
*[link]:hover:after {
content: " link is a deprecated HTML attribute";
}
*[text]:hover:after {
content: " text is a deprecated HTML attribute";
}
*[vlink]:hover:after {
content: " vlink is a deprecated HTML attribute";
}
*[align]:hover:after {
content: " align is a deprecated HTML attribute";
}
*[valign]:hover:after {
content: " valign is a deprecated HTML attribute";
}
*[hspace]:hover:after {
content: " hspace is a deprecated HTML attribute";
}
*[vspace]:hover:after {
content: " vspace is a deprecated HTML attribute";
}
*[height]:hover:after {
content: " height is a deprecated HTML attribute";
}
*[width]:hover:after {
content: " width is a deprecated HTML attribute";
}
ul[type]:hover:after, ol[type]:hover:after, li[type]:hover:after {
content: " type is a deprecated HTML attribute";
}
/* Inline frames without title attribute */
iframe:not([title]) {
outline: 2px solid red !important;
}
iframe:not([title]):hover:after {
content: " <iframe> does not have a title attribute defined.";
}
/**
* Image-related checks
* Can't add generated content to images. Think...
*/
/* server-side image map. Yes these are sometimes still seen, if rarely */
img[ismap] {
outline: 2px solid red;
}
/* Images without alt attribute */
img:not([alt]) {
outline: 2px solid red;
}
/* something that has a role of image but no alternative */
div[role="img"]:not([aria-label]) {
outline: 2px solid red;
}
/* I don't know if that will work; but worth a try. */
div[role="img"]:not([aria-label]):hover:after {
content: " This content has a role of image but no aria-label attribute.";
}
/* images without a source */
img:not([src]),
img[src=""],
img[src="#"] {
outline: 2px solid red !important;
}
/**
* Link-related checks
*/
/* Bad links, possibly relying on javascript to do something */
a[href=""], a[href="#"], a:not([href]), a[href*=javascript\:], a[onclick] {
outline: 2px solid red !important;
}
a[href=""]:hover:after, a[href="#"]:hover:after, a:not([href]):hover:after, a[href*=javascript\:]:hover:after, a[onclick]:hover:after,
a[href=""]:focus:after, a[href="#"]:focus:after, a:not([href]):focus:after, a[href*=javascript\:]:focus:after, a[onclick]:focus:after {
content: " This link may depend on JavaScript to perform it's function.";
}
/**
* form-related checks
*/
/*
Legends
*/
fieldset > :not(legend):first-child, /* no other element than a legend can be first child of a fieldset element */
fieldset > legend:not(:first-child) {
/* and a legend can't be anything else than first child of a fieldset element */
outline: 2px dashed red !important;
}
fieldset > :not(legend):first-child:after,
fieldset > legend:not(:first-child):after {
content: " <legend> must be the first child of a fieldset";
}
/*
Input[type="image"] and their alt attribute
Note: adding :before or :after on this type of element won't work. Maybe background-image encoded in base64?
@reference Technique for WCAG 2.0 H36: Using alt attributes on images used as submit buttons - http://www.w3.org/TR/WCAG-TECHS/H36.html
@reference Technique for WCAG 2.0 F65: Failure (...) due to omitting the alt attribute on (...) input elements of type "image" - http://www.w3.org/TR/WCAG-TECHS/F65.html
*/
input[type="image"][alt=""],
input[type="image"]:not([alt]) {
display: block;
background-color: red !important;
width: 200px !important;
height: 3em !important;
}
/* Missing 'for' attribute on a label */
label:not([for]) {
outline: 2px solid red !important;
}
label:not([for]):hover:after {
content: " This label does not have a for attribute associating it with a form input.";
}
/* Accesskey is a bad idea.
* @reference Old discussion but still hits on salient points http://www.cs.tut.fi/~jkorpela/forms/accesskey.html */
*[accesskey] {
outline: 2px solid red;
}
*[accesskey]:hover:after {
content: " Do not use the accesskey attribute.";
}
/**
* TABLE RELATED CHECKS
*/
/* Empty Header Cells */
th:empty {
padding: 20px;
outline: 2px solid yellow !important;
}
th:empty:after {
content: " Table header cell is empty.";
}
/* only one TR in the table. Is that a layout table? */
table > tr:only-child,
table > tbody > tr:only-child {
outline: 2px solid red;
}
table > tr:only-child:after, table > tbody > tr:only-child:after {
content: " Table has only one row. Is this a layout table?"
}
/* Deprecated attributes on table */
table[align],
table[bgcolor],
table[outline],
table[cellpadding],
table[cellspacing],
table[width],
td[width],
td[valign] {
outline: 2px solid red;
}
table[align]:after,
table[bgcolor]:after,
table[outline]:after,
table[cellpadding]:after,
table[cellspacing]:after,
table[width]:after,
td[width]:after,
td[valign]:after {
content: " This table uses one or more deprecated attributes: align, bgcolor, outline, cellpadding, cellspacing, width, or valign";
}