File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,6 +42,8 @@ private function convertToXPath($query)
4242
4343 $ xpath = preg_replace (
4444 [
45+ "/ \n{1,}/ " ,
46+ "/\s{2,}/ " ,
4547 "/([^,])\s/ " ,
4648 "/\/>\// " ,
4749
@@ -75,6 +77,8 @@ private function convertToXPath($query)
7577 "/^\[/ " ,
7678 ],
7779 [
80+ "" ,
81+ " " ,
7882 "$1/ " ,
7983 "/ " ,
8084
@@ -141,6 +145,20 @@ public function removeAttribute($attr)
141145 $ this ->obj = null ;
142146 }
143147
148+
149+ public function hasAttribute ($ attr , $ val )
150+ {
151+
152+ foreach ($ this ->obj as $ item )
153+ {
154+ $ attrs = $ item ->getAttribute ("$ attr " );
155+ }
156+
157+ $ bool = (preg_match ("/ " .preg_quote ($ val )."/ " , $ attrs )) ? true : false ;
158+
159+ return $ bool ;
160+ }
161+
144162 public function href ($ url )
145163 {
146164
@@ -199,19 +217,6 @@ public function hasClass($class)
199217 return $ bool ;
200218 }
201219
202- public function hasAttr ($ attr , $ val )
203- {
204-
205- foreach ($ this ->obj as $ item )
206- {
207- $ attrs = $ item ->getAttribute ("$ attr " );
208- }
209-
210- $ bool = (preg_match ("/ " .preg_quote ($ val )."/ " , $ attrs )) ? true : false ;
211-
212- return $ bool ;
213- }
214-
215220 public function html ($ html = null ){
216221
217222 if (!isset ($ html ))
You can’t perform that action at this time.
0 commit comments