diff --git a/common/framework/parsers/template/TemplateParser_v2.php b/common/framework/parsers/template/TemplateParser_v2.php
index ec5a6c873..b1d6c0c46 100644
--- a/common/framework/parsers/template/TemplateParser_v2.php
+++ b/common/framework/parsers/template/TemplateParser_v2.php
@@ -236,7 +236,7 @@ class TemplateParser_v2
// Convert all src and srcset attributes.
$regexp = '#(<(?:img|audio|video|script|input|source|link)\s[^>]*)(src|srcset|poster)="([^"]+)"#';
- return preg_replace_callback($regexp, function($match) use ($basepath) {
+ $content = preg_replace_callback($regexp, function($match) use ($basepath) {
if ($match[2] !== 'srcset')
{
$src = trim($match[3]);
@@ -253,6 +253,21 @@ class TemplateParser_v2
return $match[1] . sprintf('srcset="%s"', implode(', ', $result));
}
}, $content);
+
+ // Convert relative paths in CSS url() function.
+ $regexp = ['#\b(style=")([^"]+)(")#', '#(';
+ $target = '';
+ $this->assertEquals($target, $this->_parse($source));
+
+ // No url() conversion in other tags or attributes
+ $source = '
url(img/foo.jpg); }
'; + $target = 'url(img/foo.jpg); }
'; + $this->assertEquals($target, $this->_parse($source)); } public function testBlockConditions()