I want to find a fast function to get all style properties of a lxml element that take into account the css stylesheet, the style attribute element and tackle the herit issue.
For example :
html :
<body>
<p>A</p>
<p id='b'>B</p>
<p style='color:blue'>B</p>
</body>
css :
body {color:red;font-size:12px}
p.b {color:pink;}
python :
elements = document.xpath('//p')
print get_style(element[0])
>{color:red,font-size:12px}
print get_style(element[1])
>{color:pink,font-size:12px}
print get_style(element[2])
>{color:blue,font-size:12px}
Thanks