arkitrave log

arkitrave :: log

10/27/2005

CSS background images: content or presentation?

Filed under:

A very common scenario: a CSS background containing an image of text, with an HTML file containing the same text in some sort of standard HTML tag. The HTML is hidden, the background image shows pretty text. This happens every day in post-csszengarden.com-land.

From a philosophical, separation-of-content-presentation-behavior viewpoint, is the CSS background image a piece of content inside a style sheet, which should be presentation only?

I need as many reasons as I can get why the background image is not content lurking in a presentation file. Can anyone help me out? (alternate viewpoints welcome too, if you think background images are indeed content…)

Discuss.

10/24/2005

Custom attribute or onclick?

Filed under:

This is a markup question. I’m working on a navigation system in which many of the links are tracked and a friendly name (used for a report given to the client) written to a database when they are followed. The past method of doing this was to write an onclick handler on each link, like so:

<a xhref="link.html" mce_href="link.html" onclick="trackFunction(parameter, parameter, parameter);">

What I thought of doing first was writing a class, assigning it a value, and using that class in an external JavaScript to call the function:

<a xhref="link.html" mce_href="link.html" class="tracking_name">

The problem with this is twofold: First, I’m using a class for something that isn’t really a class. It’s a specific name for a specific link, for the purpose of preparing a tracking report. Second, I have to do some cleaning of the value, because a class can’t have spaces or other characters. Since this is a friendly name, class is rather restrictive, and I’d have to write replace functions to clean up all the values. This is a long-term nightmare, and I’m not going to do it.

Third option: use a custom HTML attribute. All I have to do then is write:

<a xhref="link.html" mce_href="link.html" track="Friendly Tracking Name">

JavaScript will let me at this custom attribute, by using element.track element.getAttribute(’track’), so an external script can easily call the function to write to the tracking database.

The only problem is that it is invalid HTML. We’re not going to go to the extreme of writing a custom DTD for this; we’d just use it and let it be invalid. My developer colleague argues that onclick is valid, and therefore would be better to use, and really, what’s the problem of a little behavior mixed into the HTML?

I’m having a hard time coming up with definitive reasons why the custom attribute is better; it just seems better to me. It’s more semantic, it at least uses markup, even if invalid, and it is cleaner and clearer to write from a front-end point of view.

10/6/2005

HP is my Big Brother

Filed under:

So, I’m printing about 100 sheets of a letterhead. And 30 sheets into the job, I get an error that the black ink cartridge is out. My only option is to change the cartridge or cancel the job.

I would prefer that the printer try to print, and let me judge when the quality reaches a point that I can’t tolerate. So, I open the printer, remove the cartridge, and re-insert it. The error message pops up instantly again. No black ink. I can delete the job, stop the job, or stop all jobs. These choices are slightly less than satisfying.

Interestingly enough, I have the old ink cartridge that did run low and start to produce low-quality prints. I forgot to return it to the mother ship for recycling after it ran out. I hold both of the cartridges in my hands. The one that is supposedly “out of ink” is noticably heavier than the one that actually ran out of ink weeks ago. Curious, I insert the nearly empty cartridge in place of the one that I know is nearly full. Like magic, I’m back in business and printing up a storm.

With a little research, I found this article on a lawsuit against HP. Seems that they have been doing some programming on the sly, and setting dates for the cartridges to keel over and die even if they aren’t out of ink. It seems that this is to nail those who, God forbid, refill their ink cartriges. The horror.

The problem with this kind of 1984 tactics is obvious. I feel ripped off, having spent $25 on an ink cartridge from which I only got $5 of ink. In a world where half the cost of a new printer is the included ink, I’m really inclined to trade in my HP for a company that doesn’t engage in these kinds of dirty tricks.

Don’t look over your shoulder, but they’re watching you.