Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix for issue #81 #82

Merged
merged 1 commit into from

2 participants

@gotcha

Base URL should be RegExp escaped.

@LeaVerou LeaVerou merged commit bbf08a3 into LeaVerou:gh-pages
@LeaVerou
Owner

Looks ok to me. Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 20, 2012
  1. @gotcha

    Base URL should be RegExp escaped :

    gotcha authored
    Fix for issue #81
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 2 deletions.
  1. +4 −2 prefixfree.js
View
6 prefixfree.js
@@ -52,8 +52,10 @@ var self = window.StyleFix = {
});
// behavior URLs shoudn’t be converted (Issue #19)
- css = css.replace(RegExp('\\b(behavior:\\s*?url\\(\'?"?)' + base, 'gi'), '$1');
- }
+ // base should be escaped before added to RegExp (Issue #81)
+ var escaped_base = base.replace(/([\\\^\$*+[\]?{}.=!:(|)])/g,"\\$1");
+ css = css.replace(RegExp('\\b(behavior:\\s*?url\\(\'?"?)' + escaped_base, 'gi'), '$1');
+ }
var style = document.createElement('style');
style.textContent = css;
Something went wrong with that request. Please try again.