A LIST Apart: For People Who Make Websites

No. 175

Discuss: The Table Ruler

Pages

 <  1 2 3 4 5 >  Last »

21 nice article

Looking at the posts, yeah, IE doesn’t support it, but it doesn’t mean it’s a “hack”.

As Felipe said, a small note about the pure CSS implementation (with an explanation that it’s a :hover problem in IE) could have been discussed in the main article. I’m sure several readers are wondering about it.

It’s still a good read though. =)

posted at 01:13 am on March 28, 2004 by starvingartist

22 yep, <tfoot> is before <tbody> :))

if you put the <tfoot> after <tbody> in your table, the w3c validator will tell you that this is not standards compliant. still, if you put <tfoot> and <tbody> in the right order, the browser should display the contents of the <tfoot> at the end of the table ;) makes sense…?

i actually tried to make hover <td>s using css only, but in IE that is not possible :( so you have to use JS to make it “IE compliant” :)) but i think a little modification in the JS code of the “zebra stripes” article can bring you the desired result.

posted at 02:19 am on March 28, 2004 by Nick

23 Some comments on the JavaScript.

First of all, nice article. Best JavaScript I’ve seen here in a while. However, there are some small points.

1) As said before, you can’t assume there’s only one class being used.
2) In XHTML documents node.nodeName is lowercase. Therefore, when you compare node.nodeName it’s best to lowercase it and compare it to a lowercase tag name: trs[j][removed].nodeNam.toLowerCase() e==‘tbody’
3) Nitpicking: I rather see trs.item(j) than trs[j]. It doesn’t make a difference at all, but item() is semantically a bit more right.
4) Don’t hijack events when you don’t know what other code is running. Use a cross-browser addEvent method like Scott Andrews: http://www.scottandrew.com/weblog/articles/cbs-events

posted at 04:23 am on March 28, 2004 by Mark Wubben

24 Thanks for all the input

However could you please read through the comments before repeating questions and solutions? The IE7 hack (and in that I include other .htc shenanigans) was mentioned, same way that not only hover as IE does not support it without them.

I realised the opera problem earlier aswell, and I am at loss of an explanation, a shame as it is my favourite browser atm (7.5 beta that is).

Good points about the tfoot, will rectify that on my copy of the article.

Also the lowercase will be implemented, however I still don’t see the point in several classes, when you can add in ID and a contextual selector?

posted at 05:55 am on March 28, 2004 by Chris

25 Why one would use several classes

Chris said:
“however I still don’t see the point in several classes, when you can add in ID and a contextual selector?”

You could be styling two tables using one class. If one of these tables uses the ruler, however, you have to reside on using the ID. It’s a matter of preference how one solves this problem.

In my opinion third-party JavaScript code should not effect the way the site must be build in any way. By this I mean, among other things, event hijacking and classNames.

posted at 06:56 am on March 28, 2004 by Mark Wubben

26 Using className

The great thing about switching the class of the hovered element is that when you want to change the colors, you don’t have to update all the code, just that class in the CSS file.
BTW “htc shennanigans” is a phrase I intend to use a lot from now on.

posted at 12:12 pm on March 28, 2004 by Dante-Cubed

27 Item()

No offense, but using item(i) over [i] because of “Semantics” is one of the stupidest things I’ve ever heard.

posted at 03:33 pm on March 28, 2004 by Dante-Cubed

28 Problem with mulitple classes.

One small thing—which isn’t a fault on your part, the script won’t work if you have multiple classes. I’m not sure where the blame should lye here (if anyone is to be blamed at all, that is).

Since we’re accessing the class using a special “className” property, as opposed to just “class” (the name of an attribute), one would expect it to do more that just compare a string.

Have the browsers got it wrong? Or should we have to split the “className” or regex it each time we need to use it?

posted at 04:12 pm on March 28, 2004 by Justin

29 ClassNames

Seems like you need to apply a regExp as explained earlier to do that. I wouldn’t have expected multiple classnames to be that widely, used as I am a big fan of contextual selectors instead (I don’t like adding loads of attributes in the HTML).

posted at 04:42 pm on March 28, 2004 by Chris

30 Combining with zebra tables...

CM Harrington: To do this, I had to change the scripts a bit.

For the zebra table, I changed it to apply a class to each odd tr, rather than a bg color to each td in the tr.

For the ruler script, I had to get the current/old class just before it is changed to the ‘ruler’ class, the place the old class back, rather than an empty string.

Works nicely at the moment. Will post code if anyone wants it.

posted at 04:50 pm on March 28, 2004 by Justin

Pages

 <  1 2 3 4 5 >  Last »

Discussion Closed

New comments are not being accepted, but you are welcome to explore what people said before we closed the door.

Got something to say?

Discuss this article. We reserve the right to delete flames, trolls, and wood nymphs.

Create a new account or sign in below if you’d like to leave a comment.

Remember me

Forgot your password?

Subscribe to this article's comments: RSS (what’s this?)