Changeset 2724:9e7eec5a6980 in livinglogic.python.xist

Show
Ignore:
Timestamp:
06/27/07 21:23:30 (13 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Rename selectors for CSS pseudoclasses.

Files:
1 modified

Legend:

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

    r2723 r2724  
    278278 
    279279 
    280 class FirstChildSelector(Selector): 
     280class CSSFirstChildSelector(Selector): 
    281281    def match(self, path): 
    282282        return len(path) >= 2 and _is_nth_node(path[-2][xsc.Element], path[-1], 1) 
     
    286286 
    287287 
    288 class LastChildSelector(Selector): 
     288class CSSLastChildSelector(Selector): 
    289289    def match(self, path): 
    290290        return len(path) >= 2 and _is_nth_last_node(path[-2][xsc.Element], path[-1], 1) 
     
    294294 
    295295 
    296 class FirstOfTypeSelector(Selector): 
     296class CSSFirstOfTypeSelector(Selector): 
    297297    def match(self, path): 
    298298        if len(path) < 2: 
     
    300300        node = path[-1] 
    301301        return isinstance(node, xsc.Element) and _is_nth_node(misc.Iterator(_children_of_type(path[-2], node.xmlname)), node, 1) 
    302  
    303     def __str__(self): 
     302    def __str__(self): 
     303 
    304304        return ":first-of-type" 
    305305 
    306306 
    307 class LastOfTypeSelector(Selector): 
     307class CSSLastOfTypeSelector(Selector): 
    308308    def match(self, path): 
    309309        if len(path) < 2: 
     
    316316 
    317317 
    318 class OnlyChildSelector(Selector): 
     318class CSSOnlyChildSelector(Selector): 
    319319    def match(self, path): 
    320320        if len(path) < 2: 
     
    330330 
    331331 
    332 class OnlyOfTypeSelector(Selector): 
     332class CSSOnlyOfTypeSelector(Selector): 
    333333    def match(self, path): 
    334334        if len(path) < 2: 
     
    346346 
    347347 
    348 class EmptySelector(Selector): 
     348class CSSEmptySelector(Selector): 
    349349    def match(self, path): 
    350350        if not path: 
     
    362362 
    363363 
    364 class RootSelector(Selector): 
     364class CSSRootSelector(Selector): 
    365365    def match(self, path): 
    366366        return len(path) == 1 and isinstance(path[-1], xsc.Element) 
     
    606606 
    607607_pseudoname2class = { 
    608     "first-child": FirstChildSelector, 
    609     "last-child": LastChildSelector, 
    610     "first-of-type": FirstOfTypeSelector, 
    611     "last-of-type": LastOfTypeSelector, 
    612     "only-child": OnlyChildSelector, 
    613     "only-of-type": OnlyOfTypeSelector, 
    614     "empty": EmptySelector, 
    615     "root": RootSelector, 
     608    "first-child": CSSFirstChildSelector, 
     609    "last-child": CSSLastChildSelector, 
     610    "first-of-type": CSSFirstOfTypeSelector, 
     611    "last-of-type": CSSLastOfTypeSelector, 
     612    "only-child": CSSOnlyChildSelector, 
     613    "only-of-type": CSSOnlyOfTypeSelector, 
     614    "empty": CSSEmptySelector, 
     615    "root": CSSRootSelector, 
    616616} 
    617617