Re: CSS comment hacks (was: small errors in the CSS2.1 grammar)

On Friday 17 January 2003 01:23, James Craig wrote:
|  On 1/16/03 5:15 AM, "Lars Knoll" <lars@trolltech.com> wrote:
[...]
|
|  > Even here I think this is a bad idea. In javascript we've seen similar
|  > problems happen (this is from a real web page):
|  >
|  > if ( isNS ) {
|  > // do something
|  > } else if ( isIE ) {
|  > // different way of doing the same thing
|  > }
|  >
|  > Now guess what happened with konqueror (where isIE and isNS where both
|  > false). The site broke completely even though konqueror would have been
|  > able to correctly interpret both the NS and IE javascript sniplet. Using
|  > some sort of mechanism like the above one would make the same happen for
|  > CSS. Smaller browsers some web designer don't test for will break
|  > because they get unstyled contents.
|
|  Your example is flawed because the equivalent of what I was proposing
| would be more like (to continue the JavaScript analogy):
|
|  if(isIE) {
|    // do something
|  } else if(isNS4) {
|    // do something else
|  } else {
|    // do some something DOM-compliant that 'should' work in any browser
|  }

Your example, is wrong, as default branch is usually left for 
non-DOM-compliant browsers (Opera, Lynx, old Netscape Navigator 4.7, etc.)
So, suggestion that Konqueror or Safari  (both are KHTML-based) should go into 
"default" branch is wrong and non-acceptable for me.

Correct segemtn fo code should be something like this:

if(isDOM) {
  // DOM-specific code
} else if(isIE4up) {
  // IE4 specific code
} else if (isNN4) {
  // NN 4.x specific code
else
 {
  // code for non-DOM, non-DHTML browsers, should work in any browser
}

And you just demonstrated that web designers *can't* write good enough code.

So, I strongly back proposal that web authors should write W3C-compliant code, 
without hacks for "this, this and this" browser.
And good CSS code is one of the ways to achieve this goal.


|
|  But it's still not quite the same. I'll continue.
|
[...]
|
|  Later,
|  James
|
|  PS. I used the MacIE5 hack merely as an example. I could have used some
|  other hack on a different browser and I'm making no claims as the the
|  'superiority' of one browser or parser versus another.

BTW: if you need "portable" solution to distribute some corporate web-based 
application inside a company, you should make one browser the standard in 
your company, and write code specific to that browser only.
Than you would avoid compatibility problems.
Another solution could be to use Netscape7/Mozilla in mixed environment 
(supposing that you need browser on Windows platform, too), and write 
DOM-based, CSS-based code only.

Cheers,
-- 

Vadim Plessky
SVG Icons * BlueSphere Icons 0.3.0 released
http://svgicons.sourceforge.net
My KDE page
http://kde2.newmail.ru  (English)
KDE mini-Themes
http://kde2.newmail.ru/themes/

Received on Saturday, 25 January 2003 09:50:11 UTC