Changeset 3241:b87e8fa740da in livinglogic.python.xist for src/ll/xist/xfind.py

Show
Ignore:
Timestamp:
03/22/08 22:03:01 (12 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Remove CSSWeight class, methods and tests. Use csstils specificity instead.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/ll/xist/xfind.py

    r3180 r3241  
    2828 
    2929 
    30 class CSSWeight(tuple): 
    31     """ 
    32     The specificity of a CSS selector as a 3-item tuple as specified by CSS3__. 
    33      
    34     __ http://www.w3.org/TR/css3-selectors/#specificity 
    35     """ 
    36  
    37     def __new__(cls, a=0, b=0, c=0, d=0): 
    38         return tuple.__new__(cls, (a, b, c, d)) 
    39  
    40     def __add__(self, other): 
    41         return CSSWeight(self[0]+other[0], self[1]+other[1], self[2]+other[2], self[3]+other[3]) 
    42  
    43     def __repr__(self): 
    44         return "CSSWeight(%r, %r, %r, %r)" % (self[0], self[1], self[2], self[3]) 
    45  
    46  
    4730class Selector(xsc.WalkFilter): 
    4831    """ 
     
    10588        """ 
    10689        return NotCombinator(self) 
    107  
    108     def cssweight(self): 
    109         """ 
    110         Return the CSS specificity of :var:`self` as a :class:`CSSWeight` object. 
    111         """ 
    112         return CSSWeight() 
    11390 
    11491 
     
    666643        return "%s(%r)" % (self.__class__.__name__, self.id) 
    667644 
    668     def cssweight(self): 
    669         return CSSWeight(0, 1, 0, 0) 
    670  
    671645 
    672646class hasclass(Selector): 
     
    701675    def __str__(self): 
    702676        return "%s(%r)" % (self.__class__.__name__, self.classname) 
    703  
    704     def cssweight(self): 
    705         return CSSWeight(0, 0, 1, 0) 
    706677 
    707678 
     
    756727            right = "(%s)" % right 
    757728        return "%s%s%s" % (left, self.symbol, right) 
    758  
    759     def cssweight(self): 
    760         return self.left.cssweight()+self.right.cssweight() 
    761729 
    762730 
     
    925893            v.append(s) 
    926894        return self.symbol.join(v) 
    927  
    928     def cssweight(self): 
    929         raise TypeError("no weight info for chained combinator") 
    930895 
    931896