> "foobar".substr(-3) "bar"
In IE7/8 though, this just returns the entire string, as if you’d passed
0 or nothing instead.
I’m amazed that in November 2011, I’m still discovering new, not-previously-encountered IE bugs.
If you use less.js to compile CSS for your site, you probably do development using the nifty client-side compilation. (And if you’re crazy, maybe you even serve your site that way.) You may also have noticed that LESS uses a cache, and in particular it aggressively caches any .less files you include via @import statements. Worse still, emptying your browser cache won’t actually clear this cache because…drumroll…it stores the CSS in the browser’s localStorage (assuming you’re using a modern browser that supports that), which isn’t part of the cache.
When I finally discovered this last fact, it helped restore a bit of sanity. What helped even more though, was writing some JS that would clear this cache on every load when in development because I don’t ever actually want caching while developing the site.
I’ve posted the full solution here as a gist on Github.