designer schrieb:
#tester{
     width : 500px;
     [/*ie only*/width: 610px;]  or just  [width: 610px;]
     padding : 50px;
     border : 5px solid #ff0000;
}
I find the square brackets to be neat, simple and it makes for readable and more 'understandable' code. It validates fine and there doesn't seem to be a problem. However, I do understand that, whereas the underscore is not reserved for future developments, other characters such as square brackets are actually considered by the W3C to be syntax errors at this time (even though, as I said, the markup validates).

I hope I am not entirely wrong with the following. Where did this hack came from? Is this a variation of http://www.dithered.com/css_filters/nonvalidating/index.php [Alt...] hack?

Now, I have also been told that the problem will occur when I start to parse XML - but when is that likely to be?

If you want to, this could be today:
http://princexml.com/
http://www.yeslogic.com/prince/

If It's going to be five years off, then IE5 and it's kin will be long gone and I can delete these IE only lines.

Five years from now, maybe another one has to do the maintenance on that hack soup, and maybe his or her thoughts wouldn't be warmly.

When do you reckon that using [ ] will be a problem and in what way, from a practical point of view?

1)
If you want to, you can shrug your shoulders about this:
- Prince does drop the entire rule #tester, just with the message:
"failed to parse all CSS rules"

2)
But this one is a blocker for your hack:

- Firefox JavaScript console says:
"Error: Expected declaration but found '['. Skipped to next declaration. Source File: ... Line: ..."

say, we have

#tester{
  width : 500px;
  [width: 610px;]
  background: red;
  height: 50px;
  border: 5px solid #ff0000;
  }

"Skipped to next declaration" means: find the next good ";" or "}" and restart parsing there: no red background, or in your example: no 50px padding. Same in Opera.


3)
The problem with your validation:

Am I right that you have validated through the web developer toolbar on a local file? If so, you was fooled.

Say, this test file
http://www.satzansatz.de/cssd/tmp/test.html
download it, if you want to.

I validated it through the web developer toolbar via: "validate local CSS file": No error or warning found ... Valid CSS information:
#tester  {
    border : 5px solid rgb(255,0,0);
    width : 500px;
    height : 50px;
}

Valid? Note that the background is missing? When you validate through web developer toolbar from a local file, you are validating it through the eyes of FF.

Now, validate the online file directly via W3C:

URI : http://www.satzansatz.de/cssd/tmp/test.html
    * Line: 27 Context : #tester
      Parse Error - [width: 610px;
    * Line: 28 Context : #tester
      Parse error - Unrecognized : ;] background: red;
    * Line: 31
      Parse Error - : 50px; border: 5px solid #ff0000; }

--

You could change the hack to [width:600px]; to overcome the declaration skip, but it wouln't validate.



Ingo



______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to