Skip to content

Commit

Permalink
Merge pull request #107 from Nazin/feature/headscript-html5
Browse files Browse the repository at this point in the history
Updated HeadScript to allow for proper html5 syntax creation
  • Loading branch information
Shardj authored Sep 29, 2020
2 parents dc33366 + 87e2b29 commit 9f5e7f1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions library/Zend/View/Helper/HeadScript.php
Original file line number Diff line number Diff line change
@@ -423,10 +423,14 @@ public function itemToString($item, $indent, $escapeStart, $escapeEnd)
{
continue;
}
if ('defer' == $key) {
if ('defer' === $key && !$this->view->doctype()->isHtml5()) {
$value = 'defer';
}
$attrString .= sprintf(' %s="%s"', $key, ($this->_autoEscape) ? $this->_escape($value) : $value);
if ($this->view->doctype()->isHtml5() && empty($value)) {
$attrString .= sprintf(' %s', $key);
} else {
$attrString .= sprintf(' %s="%s"', $key, ($this->_autoEscape) ? $this->_escape($value) : $value);
}
}
}

0 comments on commit 9f5e7f1

Please sign in to comment.