http://stilbuero.de Klaus Hartl – Stilbüro - Klaus Hartl


Jump to: Search, Additional Information.


Archive for September, 2006

Flicker Fixed

Dan Popa found an interesting fix for the ever annoying flickering CSS background images in IE.

There is also a fix that involves configuring your server, which I prefer, because the new solution relies on JavaScript.

Still it’s an amazing discovery and it’s very useful in cases you don’t have access to the server configuration. I really wonder why Microsoft kept that a secret for such a long time. Maybe there are some yet unknown side effects.

Via Ajaxian.

IE’s universal selector is really universal

As it turned out, the universal selector is a little too universal in IE 7 (RC 1).

Some simple CSS like

body * {
    display: block;
    border: 1px solid;
    padding: .25em .5em;
    background: #808080;
}

with such HTML

<body>
    <p>
        ...
    </p>
    <!-- An HTML coment -->
    <p>
        ...
    </p>
</body>

results in 3 Boxes in IE 7.

Here’s my own test.

This opens the door for some new hacks and even an amazing technique to make the :before and :after pseudo-elements possible to some extend.

This technique would also make for a good clearing floats without presentational markup, as long as the clear property is applied (not tested).

Apart from that, this is not a minor issue. With such a parser bug the universal selector becomes useless or we the web developers are doomed to never use HTML comments again to be able to rely on this selector. I cannot believe that this “feature” will make it into the final release.

Cookie Plugin for jQuery

I contributed a cookie plugin for jQuery yesterday. You can get it from the (Subversion) repository:

svn://jquery.com/plugins

Or get it here. A few simple examples of how to use it:

$.cookie('the_cookie'); // get cookie
$.cookie('the_cookie', 'the_value'); // set cookie
$.cookie('the_cookie', 'the_value', { expires: 7 }); // set cookie with an expiration date seven days in the future
$.cookie('the_cookie', '', { expires: -1 }); // delete cookie

You’ll find the complete documentation inline.

Update

Ralf Engelschall suggested on the jQuery mailing list, that it is more intuitive to delete a cookie by passing null as value:

$.cookie('the_cookie', null); // delete cookie

I agree and updated the plugin accordingly. The old syntax for deleting still works of course.



Klaus Hartl – Stilbüro is powered by WordPress, jQuery, XHTML, CSS and me.