[whatwg] Quirks Mode Standard

Simon Pieters simonp at opera.com
Fri Feb 17 06:45:37 PST 2012


On Wed, 15 Feb 2012 19:42:39 +0100, Simon Pieters <simonp at opera.com> wrote:

> I have changed the spec for hashless hex color and unitless length to be  
> closer to reality (I hope). I have limited the them to the properties in  
> CSS2.1 that have colors or lengths but aren't in the list above. I made  
> "support hashless hex colors" match IE instead of the other browsers,  
> since IE was stricter (even in compat view). I still haven't figured out  
> 'font', but I'll get to it.

I did some quick and dirty research on dotnetdotcom's web200904 data, and  
based on my findings, I removed outline-color, background-position,  
border-spacing, bottom, font, max-height, max-width, min-height,  
min-width, text-indent and vertical-align from the spec.

outline-color and font I found *no* occurrences that needed these quirks  
(although I didn't run through the whole file when searching for 'font').  
For the others, I applied an arbitrary threshold of usage and made cut-off  
to make the list of properties a bit shorter.

Now follows the scripts I used and some notes.


$ grep -iaPo  
"([a-z]+-)?color\s*:\s*[0-9a-f]{3}([0-9a-f]{3})?(\s|\"|\'|;|$)" web200904  
> color.txt

>>> f = open('color.txt', 'r')
>>> props = {}
>>> for line in f:
>>> 	prop = line.split(':')[0].rstrip().lower()
>>> 	if prop in props:
>>> 		props[prop] += 1
>>> 	else:
>>> 		props[prop] = 1
>>>f.close()
>>>for prop in props:
>>> 	print prop + ':' + str(props[prop])
:28
border-color:2515
color:40731
backgound-color:1
backgroun-color:13
dshadow-color:1
nbackground-color:6
000000;:1
shadow-color:242
face-color:230
text-color:2
dlight-color:216
bottom-color:543
tbackground-color:1
highlight-color:239
arrow-color:228
right-color:326
top-color:304
track-color:272
left-color:330
background-color:8658
font-color:73
darkshadow-color:217
base-color:85
light-color:15

Obviously I made a mistake in the regexp and so e.g. border-right-color  
shows up as right-color.
Other than typos and scrollbar-* properties, the ones that are used are  
the ones that are specced.
In particular, outline-color did not show up at all.



$ grep -iaPo  
"([a-z]+-)*(position|spacing|width|bottom|clip|size|height|left|right|top|bottom|margin|padding|indent|align|width|end|start|columns|border|shadow)\s*:\s*([1-9][0-9]*(\.[0-9]+)?|[0-9]?\.[0-9]+)(\s|\"|\'|;|$|\/|>)"  
web200904 > lengths.txt
^C

>>> (see script in hex color quirk section)
:315
x-start:2
3.00":1
pagging-left:8
min-height:38
border-top:842
v-text-spacing:1
                 2:1
scrollbar-size:2
line-width:1
                24;:1
border-right:1100
columns:5
border-bottom:1725
border-spacing:7
																		21:1
shadow:3
text-align:8
                             1/:1
e-height:1
8.75":1
                                     750:1
xxpadding-top:2
marging-bottom:2
line-spacing:7
x-archive-position:1
line-height:7209
5":1
font-size:35296
right:1226
cell-spacing:2
               100:1
                               908:1
word-spacing:381
mso-columns:2
padding-top:8168
border-left-size:1
scrollbar-border:2
bottom:101
fp-font-size:362
mmargin-left:1
padding-right:9159
7:1
text-size:2
spacing:243
xxpadding-left:2
tab-width:8
max-width:285
30":1
paddin-top:1
content-size:1
border-right-width:1891
y-position:1
w:1
padding-left:16898
1.50":1
6':1
border-bottom-width:3505
height:31132
max-height:95
margin-right:8283
border-top-width:2438
size:5022
left-margin:1
start:49
bottom-margin:1
top:10483
border-width:5602
min-width:219
width:46530
background-position:135
border-left:887
padding:18278
         2:1
border-height:31
                               5:1
margin:5331
border-left-width:2384
letter-spacing:874
vertical-align:47
clip:5
0.0:1
margin-left:11565
padding-bottom:5279
week-end:1
border:4664
end:68
installed-size:1
margin-bottom:11898
lin-height:12
																		102:1
4":1
nfont-size:10
z-position:1
text-indent:378
midlet-jar-size:1
one-day-left:1
margin-top:11393
position:80
left:9219


Forgot to include "-" before the number in the regex (e.g. text-indent  
accepts negative values).

$ grep -iaPo  
"([a-z]+-)*(position|spacing|width|bottom|clip|size|height|left|right|top|bottom|margin|padding|indent|align|width|end|start|columns|border|shadow)\s*:\s*-([1-9][0-9]*(\.[0-9]+)?|[0-9]?\.[0-9]+)(\s|\"|\'|;|$|\/|>)"  
web200904 > negative-lengths.txt
^C

>>> (see script in hex color quirk section)
:1
letter-spacing:31
right:3
bottom:2
top:56
margin-right:4
padding-left:1
margin-bottom:33
word-spacing:1
margin-top:68
margin-left:61
padding-top:1
size:2
margin:6
left:16


'clip'

$ grep -iaPo "clip\s*:\s*rect\([^\)]+\)" web200904 > clip.txt
^C

Looks like 'clip' is used with and without commas, with and without units.


'font'

$ grep -iaPo "font\s*:\s*[^;\}>]+" web200904 > font.txt
^C

I appended a ";" after each line, removed all " and ' (which shouldn't  
affect the font-size thing)
and put the whole thing in a ruleset and loaded it in a quirks mode doc vs  
a standards mode doc in
Firefox to see what was logged to the error console. There were 120465  
lines, supposedly 'font'
declarations. 157+4+6+1+1+1 errors in the console in both quirks mode and  
standards mode. This means
none of them had unitless font-size. Most common error seemed to be to  
omit the font-size and/or
font-family. This may need more research, but maybe we don't need this  
quirk for 'font'.

-- 
Simon Pieters
Opera Software



More information about the whatwg mailing list