mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-14 21:30:17 +08:00
Fixes #3325: fixed generated markup for conditional comments
No changelog line since feature was introduced after beta
This commit is contained in:
@@ -216,7 +216,7 @@ class BaseHtml
|
|||||||
if (isset($options['condition'])) {
|
if (isset($options['condition'])) {
|
||||||
$condition = $options['condition'];
|
$condition = $options['condition'];
|
||||||
unset($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 {
|
} else {
|
||||||
return static::tag('link', '', $options);
|
return static::tag('link', '', $options);
|
||||||
}
|
}
|
||||||
@@ -243,7 +243,7 @@ class BaseHtml
|
|||||||
if (isset($options['condition'])) {
|
if (isset($options['condition'])) {
|
||||||
$condition = $options['condition'];
|
$condition = $options['condition'];
|
||||||
unset($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 {
|
} else {
|
||||||
return static::tag('script', '', $options);
|
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="http://example.com" rel="stylesheet">', Html::cssFile('http://example.com'));
|
||||||
$this->assertEquals('<link href="/test" rel="stylesheet">', Html::cssFile(''));
|
$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()
|
public function testJsFile()
|
||||||
{
|
{
|
||||||
$this->assertEquals('<script src="http://example.com"></script>', Html::jsFile('http://example.com'));
|
$this->assertEquals('<script src="http://example.com"></script>', Html::jsFile('http://example.com'));
|
||||||
$this->assertEquals('<script src="/test"></script>', Html::jsFile(''));
|
$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()
|
public function testBeginForm()
|
||||||
|
|||||||
Reference in New Issue
Block a user