Hooks in XHTML? What's that?

“Strong XHTML skills; knowledge of how to use appropriate hooks in XHTML to limit the amount of classes and ID*s required on a page.”

I came across a job application that that mentions the line above. I’m not sure what it means or what it refers to. Can anyone explain? Thanks in advance.

1 Like

A simple example would be this:

<div class="header">

How do you style that <p>? You could put a class or ID on it (e.g. [COLOR="#FF8C00"]<p class="header-text">Hello</p>[/COLOR]) and then target it like so:

.header-text { ... }

but you could style the <p> without adding a class to it:

.header p { ... }

So that’s a simple example of using a hook—the class on the container div—to avoid an unnecessary class on the <p>.

Oh well, yeah. I’m surprised they would specify something like this. Thanks for the response.

Yeah, most job ads have a lot of fluff in them (to make the advertiser sound sophisticated or something). “Strong XHTML skills” implies the rest anyway. I’m surprised they didn’t specify HTML5 instead, as that’s the hip buzzword nowadays. :shifty:

Yeah, I was surprised by the XHTML specification as well. Are they intentionally holding off on HTML5? Oh well, perhaps I’ll find out.

If so, I have to say it’s to their credit. :slight_smile:

I was wondering the same, and thus googled and found your post. The next line in the recruiting ad is “Deep understanding of CSS inheritance…” so I would tend to agree that they are looking to minimize id tags and leverage a deeper CSS path for styling without use of id tags. With that said however, if they want backward compatibility to XHTML 4 then then need to have id tags on the fragment items ( elements a, applet, form, frame, iframe, img, and map ). So, not sure what they mean by hooks overall, but if they want a well structured style-able document, you could limit the id tags to key container items (if there are more than one in same class of course). Anything there is one of, you can just use a class tag. The use of id tags is for items where there are more than one item of similar style/class.

The other thing I was thinking was they might be meaning clean Xpaths for Selenium testing, as well. If you can design the addressable sections of a page for CSS and Selenium so they are minimal, then that is likely a good set of markup.

The goal is stability overall id for addressing these items for styling and testability ultimately. You can suggest the use of contain objects for scoping inner elements and when doing so, the hunt for the inner elements is much faster due to the pre-selection of a sub-section of the dom tree to search through. The overall idea there is not to use id’s only everywhere because then for both JS addressing and CSS, each id has to be hunted for through the entire DOM tree.

Anyhow, hope any of my thoughts help you.

There’s no such thing as XHTML 4.

XHTML 1.0 is the XHTML equivalent to HTML 4 and XHTML 5 has the same relationship to HTML 5. While XHTML 1.1 and XHTML 2 exist neither became all that popular because neitherhave an HTML equivalent and until IE8 is finally dead you can’t use XHTML as IE8 and earlier don’t support it.

1 Like

What is being called “hooks” IMHO would more appropriately be called “selectors”

But I guess we can’t expect supers to be in the know about the lingo as much as we “in the ranks” folks are.

1 Like

That was type-o. Good catch. Hooks == Selectors whether for CSS for style or CSS/Xpath selectors for Selenium etc. The idea I believe is whomever on their end is more worried about making everyone’s life easy, than adding a teeny bit of HTML bloat with id tags. If there is a concern at this low a level and it is over emphasized, well then it is likely the big picture and more important stuff could also suffer. General good practices for organizing things in container divs would more than likely be sufficient to minimize DOM search via whatever selector approach is used. Thanks gain for pointing out the error. No more time now on this one. See ya. :wink:

this could be a great HINT for the interview. The employer (or at least the HR excec) may be hinting as to what was the downfall of the last person have held the position/ or what they are looking for.

Specifically in this case , one could argue this employer has something against ‘opt-in’ classes?

Has anybody noticed that this topic was started in January 2012?