Commit a4c644d3 by Alexander Makarov

Fixes #3325: fixed generated markup for conditional comments

No changelog line since feature was introduced after beta
parent 00923815
......@@ -216,7 +216,7 @@ class BaseHtml
if (isset($options['condition'])) {
$condition = $options['condition'];
unset($options['condition']);
return "<!--[if $condition]-->\n" . static::tag('link', '', $options) . "\n<![endif]-->";
return "<!--[if $condition]>\n" . static::tag('link', '', $options) . "\n<![endif]-->";
} else {
return static::tag('link', '', $options);
}
......@@ -243,7 +243,7 @@ class BaseHtml
if (isset($options['condition'])) {
$condition = $options['condition'];
unset($options['condition']);
return "<!--[if $condition]-->\n" . static::tag('script', '', $options) . "\n<![endif]-->";
return "<!--[if $condition]>\n" . static::tag('script', '', $options) . "\n<![endif]-->";
} else {
return static::tag('script', '', $options);
}
......
......@@ -85,14 +85,14 @@ class HtmlTest extends TestCase
{
$this->assertEquals('<link href="http://example.com" rel="stylesheet">', Html::cssFile('http://example.com'));
$this->assertEquals('<link href="/test" rel="stylesheet">', Html::cssFile(''));
$this->assertEquals("<!--[if IE 9]-->\n" . '<link href="http://example.com" rel="stylesheet">' . "\n<![endif]-->", Html::cssFile('http://example.com', ['condition' => 'IE 9']));
$this->assertEquals("<!--[if IE 9]>\n" . '<link href="http://example.com" rel="stylesheet">' . "\n<![endif]-->", Html::cssFile('http://example.com', ['condition' => 'IE 9']));
}
public function testJsFile()
{
$this->assertEquals('<script src="http://example.com"></script>', Html::jsFile('http://example.com'));
$this->assertEquals('<script src="/test"></script>', Html::jsFile(''));
$this->assertEquals("<!--[if IE 9]-->\n" . '<script src="http://example.com"></script>' . "\n<![endif]-->", Html::jsFile('http://example.com', ['condition' => 'IE 9']));
$this->assertEquals("<!--[if IE 9]>\n" . '<script src="http://example.com"></script>' . "\n<![endif]-->", Html::jsFile('http://example.com', ['condition' => 'IE 9']));
}
public function testBeginForm()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment