Extract the current DOM and print it as a string, with styles intact

前端 未结 8 1641
执笔经年
执笔经年 2020-12-07 08:19

I\'d like to be able to take my DOM, as is, and convert it to a string. Let\'s say I open up the inspector and make a change to the margin-left property of a particular ele

8条回答
  •  粉色の甜心
    2020-12-07 09:09

    Based on Luc125's answer, I've created a developer tools extension for Chrome that incorporates that code for capturing styles and markup for a page fragment. The extension is in the Chrome Web Store and is on Github. The "Computed Styles" output option uses that method.

    Extension Screenshot

提交回复
热议问题