Skip to content

Commit

Permalink
Update phpQueryObject.php
Browse files Browse the repository at this point in the history
Added charset check to parseSelector
  • Loading branch information
sokal32 committed Apr 15, 2014
1 parent 00d30fc commit 0018074
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions phpQuery/phpQuery/phpQueryObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,10 @@ protected function isChar($char) {
protected function parseSelector($query) {
// clean spaces
// TODO include this inside parsing ?
$modifier = strtolower(str_replace('-', '', $this->charset)) == 'utf8' ? 'u' : '';
$query = trim(
preg_replace('@\s+@u', ' ',
preg_replace('@\s*(>|\\+|~)\s*@u', '\\1', $query)
preg_replace('@\s+@' . $modifier, ' ',
preg_replace('@\s*(>|\\+|~)\s*@' . $modifier, '\\1', $query)
)
);
$queries = array(array());
Expand Down

0 comments on commit 0018074

Please sign in to comment.