ie7 fix
For those of you that read my previous post mentioning how IE7 may be used to emulate the ^=
selector in CSS, here is what needs to be done.
Download a copy of IE7 and unzip it. Overwrite /ie7/ie7-css3.js
with /ie7/src/ie7-css3.js
. Edit /ie7/ie7-css3.js
and change:
attributeTests["^="] = function(attribute, value) { return "/^" + unquote(value) + "/.test(" + attribute + ")"; };
to:
attributeTests["^="] = function(attribute, value) { value=value.replace(/\//g,'\/'); return "/^" + unquote(value) + "/.test(" + attribute + ")"; };
It may be safe (although less readable) to change it to the following instead, if you wish:
attributeTests["^="] = function(attribute, value) { return "/^" + unquote( value.replace(/\//g,'\/') ) + "/.test(" + attribute + ")"; };
The reason for the above changes is that the return
line returns a regexp which the script uses to determine a match. Unfortunately, that regexp breaks if an un-escaped ‘/’ is entered. The above code escapes all forward-slashes.