Skip to content

Commit

Permalink
feat: rules add attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
jae-jae committed Apr 3, 2020
1 parent e527c63 commit 85903fa
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Dom/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,13 @@ protected function extractContent(phpQueryObject $pqObj, $ruleName, $rule)
})->all();
break;
default:
$content = $pqObj->attr($rule['attr']);
if(preg_match('/attr\((.+)\)/', $rule['attr'], $arr)) {
$content = $pqObj->attr($arr[1]);
} elseif (preg_match('/attrs\((.+)\)/', $rule['attr'], $arr)) {
$content = (new Elements($pqObj))->attrs($arr[1])->all();
} else {
$content = $pqObj->attr($rule['attr']);
}
break;
}

Expand Down

0 comments on commit 85903fa

Please sign in to comment.