Changeset 2838:401aeb900d0e in livinglogic.python.xist

Show
Ignore:
Timestamp:
08/01/07 17:59:53 (12 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Remove obsolete function _keyrule(). Make selector sorting stable.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/ll/xist/ns/html.py

    r2837 r2838  
    14661466 
    14671467 
    1468 def _keyrule((name, (value, count))): 
    1469     return count 
    1470  
    1471  
    14721468def applycss(node, base=None, media=None): 
    14731469    rules = [] 
    1474     for rule in itercssrules(node, base=base, media=media): 
     1470    for (i, rule) in enumerate(itercssrules(node, base=base, media=media)): 
    14751471        for selector in rule.selectorList: 
    14761472            selector = xfind.css(selector) 
    1477             rules.append((selector.cssweight(), selector, rule)) 
    1478     rules.sort() 
     1473            rules.append((selector, rule)) 
     1474    rules.sort(key=lambda (selector, rule): selector.cssweight()) 
    14791475    for path in node.walk(xsc.Element): 
    14801476        if path[-1].Attrs.isallowed("style"): 
    14811477            styles = {} 
    14821478            count = 0 
    1483             for (weight, selector, rule) in rules: 
     1479            for (selector, rule) in rules: 
    14841480                if selector.match(path): 
    14851481                    for prop in rule.style.seq: