need to rearrange things to keep them working
Arthur Axel 'fREW' Schmidt [Mon, 12 Apr 2010 05:34:15 +0000 (00:34 -0500)]
lib/HTML/Zoom/SelectorParser.pm

index f643c6b..aba1123 100644 (file)
@@ -18,6 +18,19 @@ sub _raw_parse_simple_selector {
     /\G\*/gc and
       return sub { 1 };
 
+     # 'el[attr="foo"]
+
+    /\G$sel_re\[$sel_re="$sel_re"\]/gc and
+      return do {
+        my $name = $1;
+        my $attr = $2;
+        my $val = $3;
+        sub {
+           $_[0]->{name} && $_[0]->{name} eq $name and
+           $_[0]->{attrs}{$attr} && $_[0]->{attrs}{$attr} eq $val
+        }
+      };
+
     # 'element' - match on tag name
 
     /\G$sel_re/gc and
@@ -70,19 +83,6 @@ sub _raw_parse_simple_selector {
         }
       };
 
-     # 'el[attr="foo"]
-
-    /\G$sel_re\[$sel_re="$sel_re"\]/gc and
-      return do {
-        my $name = $1;
-        my $attr = $2;
-        my $val = $3;
-        sub {
-           $_[0]->{name} && $_[0]->{name} eq $name and
-           $_[0]->{attrs}{$attr} && $_[0]->{attrs}{$attr} eq $val
-        }
-      };
-
     confess "Couldn't parse $_ as starting with simple selector";
   }
 }