keithclark / selectivizr

selectivizr is a JavaScript utility that emulates CSS3 pseudo-classes and attribute selectors in Internet Explorer 6-8.
1.71k stars 247 forks source link

Updated RegExp for Data URI's #5

Closed ckorhonen closed 13 years ago

ckorhonen commented 13 years ago

I was encountering some issues earlier today where Data URI's were being converted into file URL's by Selectivizr, generating junk HTTP requests and preventing the images from being rendered. I've updated the RegExp to exclude them.

keithclark commented 13 years ago

Good catch. I'd recommend a minor amend to the RegExp as your fix will filter out any url begining with the term data, for example: background: url("dataimage.jpg")

At the very least the RegExp should be:

\burl\(\s*(["']?)(?!data:)([^"')]+)\1\s*\)

ckorhonen commented 13 years ago

Silly me - I was writing this in a hurry, updated the commit.