Example #1
0
def remove_links_in_declaration(href_to_name, style, predicate):
    def check_pval(v):
        if v.type == v.URI:
            name = href_to_name(v.uri)
            return predicate(name, v.uri, None)
        return False

    changed = False

    for p in tuple(style.getProperties(all=True)):
        changed = remove_property_value(p, check_pval) or changed
    return changed
Example #2
0
def remove_links_in_declaration(href_to_name, style, predicate):
    def check_pval(v):
        if v.type == v.URI:
            name = href_to_name(v.uri)
            return predicate(name, v.uri, None)
        return False

    changed = False

    for p in tuple(style.getProperties(all=True)):
        changed = remove_property_value(p, check_pval) or changed
    return changed
Example #3
0
 def test_remove_property_value(self):
     style = parseStyle(
         'background-image: url(b.png); background: black url(a.png) fixed')
     for prop in style.getProperties(all=True):
         remove_property_value(prop, lambda val: 'png' in val.cssText)
     self.assertEqual('background: black fixed', style.cssText)
Example #4
0
 def test_remove_property_value(self):
     style = parseStyle('background-image: url(b.png); background: black url(a.png) fixed')
     for prop in style.getProperties(all=True):
         remove_property_value(prop, lambda val:'png' in val.cssText)
     self.assertEqual('background: black fixed', style.cssText)