Development

Changeset 31890

You must first sign up to be able to contribute.

Changeset 31890

Show
Ignore:
Timestamp:
01/24/11 19:03:26 (3 years ago)
Author:
fabien
Message:

fixed sfDomCssSelector on class names with hyphens (patch from richsage, closes #9411)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.3/lib/util/sfDomCssSelector.class.php

    r29521 r31890  
    161161          foreach ($founds as $found) 
    162162          { 
    163             if (preg_match('/\b'.$className.'\b/', $found->getAttribute('class'))) 
     163            if (preg_match('/(^|\s+)'.$className.'($|\s+)/', $found->getAttribute('class'))) 
    164164            { 
    165165              $nodes[] = $found; 
  • branches/1.3/test/unit/util/sfDomCssSelectorTest.php

    r29158 r31890  
    1111require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 
    1212 
    13 $t = new lime_test(71); 
     13$t = new lime_test(72); 
    1414 
    1515$html = <<<EOF 
     
    109109 
    110110$t->is($c->matchAll('#nonexistant')->getValues(), array(), '->matchAll() returns an empty array if the id does not exist'); 
     111 
     112$t->is($c->matchAll('.bar1-foo1')->getValues(), array('link', 'another link'), 'Hyphenated class names are matched correctly'); 
    111113 
    112114$t->diag('attribute selectors');