From: Alexander Ebert Date: Fri, 19 Jul 2013 22:11:47 +0000 (+0200) Subject: Improved relocation of script tags X-Git-Tag: 2.0.0_Beta_5~32^2~3 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d8e3cedd8e48652ede75aef28cad9ac459531672;p=GitHub%2FWoltLab%2FWCF.git Improved relocation of script tags Previously, conditional comments weren't properly moved, resulting in IE-specific JavaScript being executed in all browsers. --- diff --git a/wcfsetup/install/files/lib/util/HeaderUtil.class.php b/wcfsetup/install/files/lib/util/HeaderUtil.class.php index 1694969680..6733575fb8 100644 --- a/wcfsetup/install/files/lib/util/HeaderUtil.class.php +++ b/wcfsetup/install/files/lib/util/HeaderUtil.class.php @@ -90,8 +90,13 @@ final class HeaderUtil { // move script tags to the bottom of the page $javascript = array(); - self::$output = preg_replace_callback('~~s', function($matches) use (&$javascript) { - $javascript[] = $matches[0]; + self::$output = preg_replace_callback('~(?P)?~s', function($matches) use (&$javascript) { + $match = ''; + if (isset($matches['conditionBefore'])) $match .= $matches['conditionBefore']; + $match .= ''; + if (isset($matches['conditionAfter'])) $match .= $matches['conditionAfter']; + + $javascript[] = $match; return ''; }, self::$output);