2005-09-05

Root node wild card selector for IE only rules

Justin Rogers wrote a post on IEBlog about improving the CSS 2.1 strict parser for IE 7. IE 7 skips * html selectors in strict mode. I wonder what happens if you use the “comment before doctype” hack to get IE 6 in quirks mode.

<!-- IE6 in quirks -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

I anticipate that IE 7 will render in strict mode using the above hack.

Update: Using this hack will cause IE 7 to render in quirks mode according to John A. Bilicki.

Tags:

2005-09-04

Javascript objects: accessing sibling functions

I was messing around in Javascript to be able to access sibling functions in an object. Let's say you have the following code:

function MyObject(){
  this.click = function(){
    // Here I want to call myFunction
  }

  this.myFunction = function(){
  }

  whatever.addEventListener('click', this.click, false);
}

I used an ugly hack to access myFunction. I passed the object instance's variable name to the object as a parameter and used it to access the function using the eval function. Eew!

There is a far more simple way to do this. Create a variable in your object and assign this to it:

function MyObject(){
  var obj = this;

  this.click = function(){
    obj.myFunction();
  }

  this.myFunction = function(){
  }

  whatever.addEventListener('click', this.click, false);
}

Vacation pictures

For those of you who are interested: I've posted some vacation pictures on my personal (Dutch) blog.

2005-09-02

Blogger keep current time user script now auto checks

The checkbox in the Blogger keep current time user script (original post) for Greasemonkey will now be automatically checked for new and for draft posts.

Screenshot

Note: I've renamed the script. You'll have to uninstall the script called ‘Blogger enhancements’ if you have the old version of the script installed.

2005-08-31

Blogger previous post link with accesskey in valid HTML

I used this trick to create a previous post link. Basically you just generate the previous posts list where you start hiding items after you have displayed the first item. This method generates valid HTML and allows you to set an accesskey which only accesses the first (visible) item.

<BloggerPreviousItems>
  <a href="<$BlogItemPermalinkURL$>" accesskey="v">Previous:<br><$BlogPreviousItemTitle$></a>
  <div class="hide"><![CDATA[
</BloggerPreviousItems>
<div class="hide">]]></div>

Update 2005-09-01: Changed ‘next’ to ‘previous’ because it makes more sense this way.