Re: Better file path use... in the JS version?
Thanks for the kind words!
I do have some thoughts around this... unfortunately none of them are perfect. The PIE.js version suffers from the same limitation of the behavior version: the script has no visibility into what stylesheet a particular style was declared in. So all the script sees is the string "url(./images/some_image.png)", and it doesn't know what stylesheet that was declared in, so (for now) it just makes a blanket assumption that it's relative to the HTML file. I know, it sucks.
My thoughts are as follows:
1) If there is only a *single* stylesheet linked from the HTML page, or multiple stylesheets that are all *in the same external directory*, then we can safely assume what the base path should be for any relative paths declared therein. This would of course fail as soon as there are multiple stylesheets in different directories, which is very often the case.
2) It would be trivial to add a way for users to specify a custom base URL to be used instead of the HTML file path. Something like -pie-base:url(/my/base/css/directory); -- this adds a little bit of flexibility but unfortunately would be global across all stylesheets, so you couldn't set a different base URL for each stylesheet.
3) I've purposely steered well clear of anything that would require actually parsing stylesheets, as that takes a huge performance hit that I feel is unacceptable in most cases. But I might be open to adding something that would parse the stylesheets and resolve/rewrite relative URLs that it finds, as long as it would be controlled by an opt-in flag (e.g. -pie-resolve-relative-urls:true;) that is disabled by default. It might even be a separate .js script, that way it could resolve behavior urls properly too.
Anyone else have thoughts on this?