mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 14:26:54 +08:00
Fixes #15272: Removed type attribute from script tag
This commit is contained in:

committed by
Alexander Makarov

parent
9e566d7021
commit
b566dd522c
@ -4,6 +4,7 @@ Yii Framework 2 Change Log
|
|||||||
2.0.14 under development
|
2.0.14 under development
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
|
- Enh #15272: Removed type attribute from script tag (aleksbelic)
|
||||||
- Enh #15120: Refactored dynamic caching introducing `DynamicContentAwareInterface` and `DynamicContentAwareTrait` (sergeymakinen)
|
- Enh #15120: Refactored dynamic caching introducing `DynamicContentAwareInterface` and `DynamicContentAwareTrait` (sergeymakinen)
|
||||||
- Bug #8983: Only truncate the original log file for rotation (matthewyang, developeruz)
|
- Bug #8983: Only truncate the original log file for rotation (matthewyang, developeruz)
|
||||||
- Bug #11401: Fixed `yii\web\DbSession` concurrency issues when writing and regenerating IDs (samdark, andreasanta, cebe)
|
- Bug #11401: Fixed `yii\web\DbSession` concurrency issues when writing and regenerating IDs (samdark, andreasanta, cebe)
|
||||||
|
File diff suppressed because one or more lines are too long
@ -566,7 +566,7 @@ class View extends \yii\base\View
|
|||||||
$lines[] = implode("\n", $this->jsFiles[self::POS_HEAD]);
|
$lines[] = implode("\n", $this->jsFiles[self::POS_HEAD]);
|
||||||
}
|
}
|
||||||
if (!empty($this->js[self::POS_HEAD])) {
|
if (!empty($this->js[self::POS_HEAD])) {
|
||||||
$lines[] = Html::script(implode("\n", $this->js[self::POS_HEAD]), ['type' => 'text/javascript']);
|
$lines[] = Html::script(implode("\n", $this->js[self::POS_HEAD]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return empty($lines) ? '' : implode("\n", $lines);
|
return empty($lines) ? '' : implode("\n", $lines);
|
||||||
@ -584,7 +584,7 @@ class View extends \yii\base\View
|
|||||||
$lines[] = implode("\n", $this->jsFiles[self::POS_BEGIN]);
|
$lines[] = implode("\n", $this->jsFiles[self::POS_BEGIN]);
|
||||||
}
|
}
|
||||||
if (!empty($this->js[self::POS_BEGIN])) {
|
if (!empty($this->js[self::POS_BEGIN])) {
|
||||||
$lines[] = Html::script(implode("\n", $this->js[self::POS_BEGIN]), ['type' => 'text/javascript']);
|
$lines[] = Html::script(implode("\n", $this->js[self::POS_BEGIN]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return empty($lines) ? '' : implode("\n", $lines);
|
return empty($lines) ? '' : implode("\n", $lines);
|
||||||
@ -618,19 +618,19 @@ class View extends \yii\base\View
|
|||||||
$scripts[] = implode("\n", $this->js[self::POS_LOAD]);
|
$scripts[] = implode("\n", $this->js[self::POS_LOAD]);
|
||||||
}
|
}
|
||||||
if (!empty($scripts)) {
|
if (!empty($scripts)) {
|
||||||
$lines[] = Html::script(implode("\n", $scripts), ['type' => 'text/javascript']);
|
$lines[] = Html::script(implode("\n", $scripts));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!empty($this->js[self::POS_END])) {
|
if (!empty($this->js[self::POS_END])) {
|
||||||
$lines[] = Html::script(implode("\n", $this->js[self::POS_END]), ['type' => 'text/javascript']);
|
$lines[] = Html::script(implode("\n", $this->js[self::POS_END]));
|
||||||
}
|
}
|
||||||
if (!empty($this->js[self::POS_READY])) {
|
if (!empty($this->js[self::POS_READY])) {
|
||||||
$js = "jQuery(function ($) {\n" . implode("\n", $this->js[self::POS_READY]) . "\n});";
|
$js = "jQuery(function ($) {\n" . implode("\n", $this->js[self::POS_READY]) . "\n});";
|
||||||
$lines[] = Html::script($js, ['type' => 'text/javascript']);
|
$lines[] = Html::script($js);
|
||||||
}
|
}
|
||||||
if (!empty($this->js[self::POS_LOAD])) {
|
if (!empty($this->js[self::POS_LOAD])) {
|
||||||
$js = "jQuery(window).on('load', function () {\n" . implode("\n", $this->js[self::POS_LOAD]) . "\n});";
|
$js = "jQuery(window).on('load', function () {\n" . implode("\n", $this->js[self::POS_LOAD]) . "\n});";
|
||||||
$lines[] = Html::script($js, ['type' => 'text/javascript']);
|
$lines[] = Html::script($js);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ class BaseMailerTest extends TestCase
|
|||||||
|
|
||||||
<a href="http://yiifresh.com/index.php?r=site%2Freset-password&token=abcdef">http://yiifresh.com/index.php?r=site%2Freset-password&token=abcdef</a>
|
<a href="http://yiifresh.com/index.php?r=site%2Freset-password&token=abcdef">http://yiifresh.com/index.php?r=site%2Freset-password&token=abcdef</a>
|
||||||
|
|
||||||
</p><script type="text/javascript">alert("hi")</script>
|
</p><script>alert("hi")</script>
|
||||||
|
|
||||||
<p>Test Lorem ipsum...</p>
|
<p>Test Lorem ipsum...</p>
|
||||||
</body>
|
</body>
|
||||||
|
@ -35,7 +35,7 @@ class ViewTest extends TestCase
|
|||||||
$view = new View();
|
$view = new View();
|
||||||
$view->registerJsVar('username', 'samdark');
|
$view->registerJsVar('username', 'samdark');
|
||||||
$html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']);
|
$html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']);
|
||||||
$this->assertContains('<script type="text/javascript">var username = "samdark";</script></head>', $html);
|
$this->assertContains('<script>var username = "samdark";</script></head>', $html);
|
||||||
|
|
||||||
$view = new View();
|
$view = new View();
|
||||||
$view->registerJsVar('objectTest', [
|
$view->registerJsVar('objectTest', [
|
||||||
@ -43,7 +43,7 @@ class ViewTest extends TestCase
|
|||||||
'question' => 'Unknown',
|
'question' => 'Unknown',
|
||||||
]);
|
]);
|
||||||
$html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']);
|
$html = $view->render('@yiiunit/data/views/layout.php', ['content' => 'content']);
|
||||||
$this->assertContains('<script type="text/javascript">var objectTest = {"number":42,"question":"Unknown"};</script></head>', $html);
|
$this->assertContains('<script>var objectTest = {"number":42,"question":"Unknown"};</script></head>', $html);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRegisterJsFileWithAlias()
|
public function testRegisterJsFileWithAlias()
|
||||||
|
Reference in New Issue
Block a user