[css-syntax] Error-correcting unclosed empty url()

Right now, the Syntax spec defines url() to be handled the same way as
anything else when you hit of EOF while it's unclosed - it gets closed
and is valid.

That is, the following two examples are equivalent per spec, assuming
the file ends after the last character:

    foo { background-image: url(foo

    foo { background-image: url(foo)}

This behavior is inconsistent across browsers - Firefox agrees with
the spec and treats these as equivalent, but Chrome refuses to
recognize a url() as valid until it sees the close parenthesis.


Browsers currently agree in behavior when the url() is completely empty, like:

    foo { background-image: url(

They all treat this as invalid and throw out the declaration.  But
they all consider this valid:

    foo { background-image: url()

So the error-handling is inconsistent with how other functions work.


How should we proceed?  I suggest keeping the current spec behavior.
When there's some content in the url(), this matches at least one
browser.  When it's empty, it matches no browser I've tested, but it's
consistent with the rest of the platform, and I doubt content is
relying on this behavior.

~TJ

Received on Tuesday, 7 October 2014 21:47:57 UTC