I’m sorry… this blog thinging chokes on greater than signs… One last try
When I daydream, I often travel back in time. To buy Netscape stock before it set records? No. I go back to a time before CSS and before browsers were more than just a CSCI project. I go back to correct the horrible, horrible mistakes made by those who created the XHTML/CSS standards, which is to blame for the situation that we now toil under.
I want to flesh this out into a proper blog entry, but here are some points that I think are relevant to this discussion:
1: Making a language forgiving does not make it easier. In fact, it almost always has the opposite result. Example: in old VB, what is the result of 1 + “3.5”? It’s not immediately obvious (is it “13.5” or 4.5?). Is it really harder to write 1 + toInt(“3.5”)? Forgiveness necessitates ambiguity. Errors happen in front of your audience, which is using a browser that you don’t have and that came to different conclusions about your ambiguous code.
2: Strict enforcement of the language does not necessarily mean hard. The trouble with what is out there is that we lack a sufficiently complete CSS standard. Powerful tools could have been provided and without confusing ambiguity. Cases in point:
CSS Conditionals:
It would be great to be able to ask if a feature is supported or which browser you are working with within CSS and then implement code accordingly. Why not this kind of statement:
min-width? (min-width:40% | (width: [Microsoft garbage here]
The ‘?’ would basically have asked, “Is it supported?”. How much simpler is this compared to what we have to do now. Just this one feature alone would suck much of the horrible complexity that we deal with today. And asking “which browser/version” would cover bad implementations as well. For cases like this:
browser(“Explorer”, (less than sign) 7)?(background(“Crapy.gif”) | (background(“Pretty.png”}
Or how about the ability to do this:
margin-top: =(SomeIDName(width) – 2px);
…or…
width: (80% - 2px);
Features like the above examples would fundamentally change the way the XHTML is designed. It would remove most of the empty DIV tags that we’re forced to pollute our beautiful code with.
Most, except for when we have to make a rounded box. Enough has been written on that subject. I don’t have to hammer out fantasy pseudo code, which would just serve to depress.
The main point is that XHTML has ALMOST enough in it to be completely fine (add br/ back in and I’m happy). CSS, which is designed for graphic designers, does not have enough positioning and conditional tools to solve most of our problems without depending on browser bugs and redundant and ugly code. Demanding quotes, closed end tags and unique ID’s makes it much easier for design tools and browser to interpret the code easily. To be lazy with these details solves nothing.