""" Handle CSS stylesheets. """ import cssselect2 import tinycss2 from .url import parse_url def find_stylesheets(tree): """Find the stylesheets included in ``tree``.""" # TODO: support contentStyleType on default_type = 'text/css' for element in tree.xml_tree.iter(): # http://www.w3.org/TR/SVG/styling.html#StyleElement if (element.tag == '{http://www.w3.org/2000/svg}style' and element.get('type', default_type) == 'text/css' and element.text): # TODO: pass href for relative URLs # TODO: support media types # TODO: what if