Skip to content

Commit

Permalink
fix conflicts 1
Browse files Browse the repository at this point in the history
  • Loading branch information
andrepereiradasilva committed Aug 14, 2016
1 parent dad2030 commit 3a48e5b
Showing 1 changed file with 11 additions and 23 deletions.
34 changes: 11 additions & 23 deletions libraries/joomla/document/renderer/html/head.php
Expand Up @@ -187,35 +187,23 @@ public function fetchHead($document)
$defaultJsMimes = array('text/javascript', 'application/javascript', 'text/x-javascript', 'application/x-javascript');

// Generate script file links
foreach ($document->_scripts as $strSrc => $strAttribs)
foreach ($document->_scripts as $strSrc => $strAttr)
{
$buffer .= $tab . '<script src="' . $strSrc . '"';

// Add script tag attributes.
foreach ($strAttribs as $attrib => $value)
if (!is_null($strAttr['mime']) && (!$document->isHtml5() || !in_array($strAttr['mime'], $defaultJsMimes)))
{
// Don't add type attribute if document is HTML5 and it's a default mime type. 'mime' is for B/C.
if (in_array($attrib, array('type', 'mime')) && $document->isHtml5() && in_array($value, $defaultJsMimes))
{
continue;
}

// Don't add type attribute if document is HTML5 and it's a default mime type. 'mime' is for B/C.
if ($attrib === 'mime')
{
$attrib = 'type';
}
// B/C defer and async can be set to yes when using the old method.
elseif (in_array($attrib, array('defer', 'async')) && $value === true)
{
$value = $attrib;
}
$buffer .= ' type="' . $strAttr['mime'] . '"';
}

// Json encode value if it's an array.
$value = !is_scalar($value) ? json_encode($value) : $value;
if ($strAttr['defer'])
{
$buffer .= ' defer="defer"';
}

// Add attribute to script tag output.
$buffer .= ' ' . htmlspecialchars($attrib, ENT_COMPAT, 'UTF-8') . '="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '"';
if ($strAttr['async'])
{
$buffer .= ' async="async"';
}

$buffer .= '></script>' . $lnEnd;
Expand Down

0 comments on commit 3a48e5b

Please sign in to comment.