mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Prevent JsHelper::writeBuffer() to return empty lines (or empty onDomReady events)
Signed-off-by: Mark Story <mark@mark-story.com>
This commit is contained in:
parent
0bc1126114
commit
2d9b13fe88
1 changed files with 4 additions and 0 deletions
|
@ -195,6 +195,10 @@ class JsHelper extends AppHelper {
|
||||||
$defaults = array('onDomReady' => true, 'inline' => true, 'cache' => false, 'clear' => true, 'safe' => true);
|
$defaults = array('onDomReady' => true, 'inline' => true, 'cache' => false, 'clear' => true, 'safe' => true);
|
||||||
$options = array_merge($defaults, $options);
|
$options = array_merge($defaults, $options);
|
||||||
$script = implode("\n", $this->getBuffer($options['clear']));
|
$script = implode("\n", $this->getBuffer($options['clear']));
|
||||||
|
|
||||||
|
if (empty($script)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if ($options['onDomReady']) {
|
if ($options['onDomReady']) {
|
||||||
$script = $this->{$this->__engineName}->domReady($script);
|
$script = $this->{$this->__engineName}->domReady($script);
|
||||||
|
|
Loading…
Reference in a new issue