I've been attempting to make these functionalities compatible with IE 7, but I'm encountering difficulties. I've downloaded and included the jQuery plugin for it in the header as shown below:
<!--[if lte IE 7]>
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.pseudo.js"></script>
<![endif]-->
Despite this, it's still not functioning properly.
Here's the code snippet from the jQuery plugin:
(function($){
var patterns = {
text: /^['"]?(.+?)["']?$/,
url: /^url\(["']?(.+?)['"]?\)$/
};
function clean(content) {
if(content && content.length) {
var text = content.match(patterns.text)[1],
url = text.match(patterns.url);
return url ? '<img src="' + url[1] + '" />': text;
}
}
function inject(prop, elem, content) {
if(prop != 'after') prop = 'before';
if(content = clean(elem.currentStyle[prop])) {
$(elem)[prop == 'before' ? 'prepend' : 'append'](
$(document.createElement('span')).addClass(prop).html(content)
);
}
}
$.pseudo = function(elem) {
inject('before', elem);
inject('after', elem);
elem.runtimeStyle.behavior = null;
};
if(document.createStyleSheet) {
var o = document.createStyleSheet(null, 0);
o.addRule('.dummy','display: static;');
o.cssText = 'html, head, head *, body, *.before, *.after, *.before *, *.after * { behavior: none; } * { behavior: expression($.pseudo(this)); }';
}
})(jQuery);
I speculated that the issue might involve replacing the $
symbols with jQuery
due to the WordPress framework I'm using, which reserves the $
symbol for prototype. However, this adjustment didn't resolve the problem; it eliminated the JS errors, but the functionality still didn't work.