This module is great, but I found that it only processes only the child elements of the elements you target, not the elements themselves.

In some cases, it is undesirable to target the element, for example when you have a logo that's a direct child of the BODY tag. In that case, you could target BODY directly, but that would slow down things considerably if the page is complex, because it would go searching for more things to process. One could also add an extra wrapper div, but that's not always possible or rather unpleasant to do (possibly requiring the user to hack his template and provide hooks, for example).

Instead, it's much easier if the attached patch is applied. It adds a simple andSelf() call to the javascript, so the targeted element itself is also processed for background images. I think it's also more along the lines what the casual user would expect; target the thing you want fixed.
I also did something similar in this patch for the case where the image itself is targeted, but that's less elegant because andSelf doesn't allow you to add a conditional filter for the current element.

An alternative would be to let the user specify very precisely what he wants to target, so we can get rid of the find() call altogether. This would possibly speed things up even more, as no traversing would be required for those cases where a large wrapper div with lots of inner content needs a background set.

CommentFileSizeAuthor
jquery.pngFix.js_.diff831 bytesPeter Bex

Comments

avpaderno’s picture

Status: Needs review » Closed (outdated)
Issue tags: -patch, -targeting

I am closing this issue, which is for a not-supported Drupal version.