Get CSS style from PHP

后端 未结 3 1278
盖世英雄少女心
盖世英雄少女心 2021-01-19 14:59

I am parsing pages using Simple DOM parser. It is neat, but I would like to get the applied css style for each element. Not only the inline styles, but every style it applie

3条回答
  •  我在风中等你
    2021-01-19 15:35

    You might wanna check out the CSS part of QUAIL accessibility library - we needed that feature too and have been basically building a psuedo-browser that is based on DOMDocument. Because of some of the weird things with Xpaths in DOMDocument we had to hack an additional attribute to every node on the page that acts as a pointer to a central array of computed styles, but we're about 70% of the way there in terms of passing the W3C tests.

提交回复
热议问题