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:
kleingeist 2009-12-15 01:13:19 +01:00 committed by Mark Story
parent 0bc1126114
commit 2d9b13fe88

View file

@ -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);