mirror of
https://github.com/gtbu/Typesetter-5.3-p8.git
synced 2025-04-18 20:23:14 +02:00
update js-minifier 1.7
This commit is contained in:
parent
0cc0b251a4
commit
68943b54ee
1 changed files with 7 additions and 1 deletions
8
include/thirdparty/JShrink/Minifier.php
vendored
8
include/thirdparty/JShrink/Minifier.php
vendored
|
@ -112,6 +112,8 @@ class Minifier
|
|||
|
||||
protected static $keywords = ["delete", "do", "for", "in", "instanceof", "return", "typeof", "yield"];
|
||||
|
||||
protected $max_keyword_len;
|
||||
|
||||
/**
|
||||
* Contains lock ids which are used to replace certain code patterns and
|
||||
* prevent them from being minified
|
||||
|
@ -189,6 +191,8 @@ class Minifier
|
|||
$this->b = "\n";
|
||||
$this->last_char = "\n";
|
||||
$this->output = "";
|
||||
|
||||
$this->max_keyword_len = max(array_map('strlen', static::$keywords));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -201,6 +205,7 @@ class Minifier
|
|||
'-' => true,
|
||||
'+' => true,
|
||||
'[' => true,
|
||||
'#' => true,
|
||||
'@' => true];
|
||||
|
||||
|
||||
|
@ -657,7 +662,8 @@ class Minifier
|
|||
protected function endsInKeyword() {
|
||||
|
||||
# When this function is called A is not yet assigned to output.
|
||||
$testOutput = $this->output . $this->a;
|
||||
# Regular expression only needs to check final part of output for keyword.
|
||||
$testOutput = substr($this->output . $this->a, -1 * ($this->max_keyword_len + 10));
|
||||
|
||||
foreach(static::$keywords as $keyword) {
|
||||
if (preg_match('/[^\w]'.$keyword.'[ ]?$/i', $testOutput) === 1) {
|
||||
|
|
Loading…
Reference in a new issue