Re: Parsing: Equals sign in unquoted attributes

On Fri, 30 May 2008 12:26:28 +0200, Simon Pieters <simonp@opera.com> wrote:

> The spec made the equals sign a parse error in unquoted attributes in  
> order to catch this authoring mistake:
>
>     <p class=="foo">
>
> This seems to result in false positives for:
>
>     <a href=foo?bar=baz>
>
> ...which is pretty common. Since the spec bans the " and ' characters in  
> unquoted attributes, the above authoring mistake would be cought anyway.  
> Therefore, I think that = should be allowed in unquoted attributes, at  
> least when it's not the first character.

Some data (thanks Philip`!):

    http://philip.html5.org/data/some-unquoted-attributes-with-equals.txt


I haven't counted how common each of the cases below were, but sorted them  
roughly with the most common case first. URL with query parameter seemed  
to be the marjority case. foo=="bar" didn't show up at all.

(Another thought: should <foo bar=> be made non-conforming in order to  
avoid it being changed to <foo bar= baz=quux> later on?)



** Deliberate **

URL with query parameter
    <A TARGET=_blank class=tekst  
HREF=http://www.meldal.no/lesmer.asp?N_ID=148>

Event handler attributes
    <select onChange=location=options[selectedIndex].value; name=selectTeam>

Meta charset
    <META HTTP-EQUIV=content-type CONTENT=text/html;charset=x-sjis>

Meta refresh
    <META http-equiv=refresh content=5;URL=http://www.greenbananas.com>

Hashes
    <META content=u/AXR3EH20oR67DzNJXkmRtxNTnW7xoN2pswdXej7gI=  
name=verify-v1  >

IE transitions
    <META http-equiv=page-enter  
content=revealtrans(duration=1,transition=12)>

IE filter in style
    <td colspan=9 height=121 align=center  
style=filter:progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=teal,endColorStr=white);>

Other
    <INPUT type=hidden value=BGCOLOR=#FFFFFF name=nonUPS_body>



** Autoring mistakes **

Intended empty value
    <td width= valign=top>

Repeating the attribute name in the value
    <TD WIDTH=width=450 bgcolor="#cccccc" align=center valign=middle>

Missing space
    <FONT FACE=ARIALSIZE=1 color="#FFCC66">

'<' instead of space
    <TABLE width=240 height=300 border=0<cellspacing=0 cellpadding=0  
bgcolor="083a81">

',' instead of space
    <FONT face=Arial,color=#ffffcc>

Other
    <META name= robots= content "INDEX, FOLLOW" >
    <meta name=keywords="LARP">

-- 
Simon Pieters
Opera Software

Received on Friday, 30 May 2008 12:54:51 UTC