Author: fabien
Date: 2010-01-19 11:50:05 +0100 (Tue, 19 Jan 2010)
New Revision: 26872

Modified:
   branches/1.3/lib/util/sfDomCssSelector.class.php
   branches/1.3/test/unit/util/sfDomCssSelectorTest.php
   branches/1.4/lib/util/sfDomCssSelector.class.php
   branches/1.4/test/unit/util/sfDomCssSelectorTest.php
Log:
[1.3, 1.4] fixed sfDomCssSelector requires quotes for matching attribute values 
when they should be optional (closes #8120)

Modified: branches/1.3/lib/util/sfDomCssSelector.class.php
===================================================================
--- branches/1.3/lib/util/sfDomCssSelector.class.php    2010-01-19 10:43:09 UTC 
(rev 26871)
+++ branches/1.3/lib/util/sfDomCssSelector.class.php    2010-01-19 10:50:05 UTC 
(rev 26872)
@@ -198,7 +198,7 @@
             {
               $attrName = $match[1];
               $attrOperator = $match[2];
-              $attrValue = $match[4];
+              $attrValue = $match[4] ? $match[4] : $match[5];
 
               switch ($attrOperator)
               {

Modified: branches/1.3/test/unit/util/sfDomCssSelectorTest.php
===================================================================
--- branches/1.3/test/unit/util/sfDomCssSelectorTest.php        2010-01-19 
10:43:09 UTC (rev 26871)
+++ branches/1.3/test/unit/util/sfDomCssSelectorTest.php        2010-01-19 
10:50:05 UTC (rev 26872)
@@ -10,7 +10,7 @@
 
 require_once(dirname(__FILE__).'/../../bootstrap/unit.php');
 
-$t = new lime_test(69);
+$t = new lime_test(70);
 
 $html = <<<EOF
 <html>
@@ -89,6 +89,7 @@
 $t->is($c->matchAll('#footer')->getValues(), array('footer'), '->matchAll() 
supports searching html elements by id');
 $t->is($c->matchAll('div#footer')->getValues(), array('footer'), '->matchAll() 
supports searching html elements by id for a tag name');
 $t->is($c->matchAll('*[class="myfoo"]')->getValues(), array('myfoo', 'myfoo 
bis'), '->matchAll() can take a * to match every elements');
+$t->is($c->matchAll('*[class=myfoo]')->getValues(), array('myfoo', 'myfoo 
bis'), '->matchAll() can take a * to match every elements');
 
 $t->is($c->matchAll('.header')->getValues(), array('header'), '->matchAll() 
supports searching html elements by class name');
 $t->is($c->matchAll('p.header')->getValues(), array('header'), '->matchAll() 
supports searching html elements by class name for a tag name');

Modified: branches/1.4/lib/util/sfDomCssSelector.class.php
===================================================================
--- branches/1.4/lib/util/sfDomCssSelector.class.php    2010-01-19 10:43:09 UTC 
(rev 26871)
+++ branches/1.4/lib/util/sfDomCssSelector.class.php    2010-01-19 10:50:05 UTC 
(rev 26872)
@@ -185,7 +185,7 @@
             {
               $attrName = $match[1];
               $attrOperator = $match[2];
-              $attrValue = $match[4];
+              $attrValue = $match[4] ? $match[4] : $match[5];
 
               switch ($attrOperator)
               {

Modified: branches/1.4/test/unit/util/sfDomCssSelectorTest.php
===================================================================
--- branches/1.4/test/unit/util/sfDomCssSelectorTest.php        2010-01-19 
10:43:09 UTC (rev 26871)
+++ branches/1.4/test/unit/util/sfDomCssSelectorTest.php        2010-01-19 
10:50:05 UTC (rev 26872)
@@ -10,7 +10,7 @@
 
 require_once(dirname(__FILE__).'/../../bootstrap/unit.php');
 
-$t = new lime_test(69);
+$t = new lime_test(70);
 
 $html = <<<EOF
 <html>
@@ -89,6 +89,7 @@
 $t->is($c->matchAll('#footer')->getValues(), array('footer'), '->matchAll() 
supports searching html elements by id');
 $t->is($c->matchAll('div#footer')->getValues(), array('footer'), '->matchAll() 
supports searching html elements by id for a tag name');
 $t->is($c->matchAll('*[class="myfoo"]')->getValues(), array('myfoo', 'myfoo 
bis'), '->matchAll() can take a * to match every elements');
+$t->is($c->matchAll('*[class=myfoo]')->getValues(), array('myfoo', 'myfoo 
bis'), '->matchAll() can take a * to match every elements');
 
 $t->is($c->matchAll('.header')->getValues(), array('header'), '->matchAll() 
supports searching html elements by class name');
 $t->is($c->matchAll('p.header')->getValues(), array('header'), '->matchAll() 
supports searching html elements by class name for a tag name');

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.


Reply via email to