It's the only way that makes any sense. Take images for example:
/* this is somestyles.css */
body
{
background-image:url(images/background.gif)
}
If you resolved the path to background.gif from the page, rather than from somestyles.css then every page would have to sit at the same level as the images directory, which precludes having a site heirachy.
Fortunately this is not how the world works - URIs are resolved based on the base URI of the stylesheet, and everyone's happy...
...except IE (6, but presumably 5+) doesn't do this for DHTML behaviours - the path to the HTC is resolved based on the page that the behaviour applies to. WTF!?
That I never noticed this before is a testament to how little I've ever used DHTML behaviours (I regard them as some kind of voodoo), but that there's been no public outcry presumably means no-one else is either. Or did I miss some kind of wierd DOCTYPE setting to force IE into 'not crap' mode?
(Sure you can make the path root-relative, ie
.someClass
{
behavior:url(/behaviors/Moo.htc)
}
...but imagine if you're writing an app in a subdirectory (which is the normal VS.Net paradime):.someClass
{
behavior:url(/MyApp/behaviors/Moo.htc)
}
'MyApp' might be the name you use in development, but it might be MyAppDaily for the dailybuild, and it might be just / (as in, run at the root of the site) when you eventually deploy. Want to keep changing your CSS per-environment? I don't think so)References:
The documentation - not very explicit on how it's expected to work
Other people who have noticed: 'Keith' (comment 15), Dean Edwards, 'Lithium' on microsoft.public.scripting.jscript, but unless my Google-fu is failing there's not many of them.
No comments:
Post a Comment