开发者

Saving the manipulated DOM/HTML after editing it with Firebug

开发者 https://www.devze.com 2022-12-18 15:54 出处:网络
Assume that I\'ve fired up Firefox with Firebug enabled on a random site (say slashdot.org). After loading the site I sta开发者_StackOverflow社区rt editing the page using the Firebug > HTML panel.

Assume that I've fired up Firefox with Firebug enabled on a random site (say slashdot.org). After loading the site I sta开发者_StackOverflow社区rt editing the page using the Firebug > HTML panel. So far so good: my changes are immediately visible in Firefox.

My questions:

  • How do I save the edited DOM tree (represented as HTML)?
  • How do I load a previously manipulated DOM tree/HTML file into the "original context" of the page (slashdot.org in the example)? I want the original context so that all references entities (CSS, images, etc.) will load correctly.


You can't save the tree per se, only the HTML. Select the root tag, right-click, and select Copy HTML, then paste into a text editor and save to a HTML file.


How do I save the edited DOM tree (represented as HTML)?

Firebug does not contain any method that can be used to save current DOM to file. However, you can use Firebug in conjunction with the Web Developer extension to save the DOM to file (represented as HTML).

After you're done manipulating the DOM in Firebug, choose Web Developer (toolbar at the top) > View Source > View Generated Source > Archive > Save Page As....

How do I load a previously manipulated DOM tree/HTML file into the "original context" of the page (slashdot.org in the example)? I want the original context so that all references entities (CSS, images, etc.) will load correctly.

Firebug does not contain any method to re-read a previously saved DOM tree into the "current context" of the page. However, if we use Firebug together with the Web Developer extension we can achieve the requested functionality. Simply open the previously saved HTML in an editor such as Notepad and copy the HTML to the clip board. Then choose Web Developer > Miscellaneous > Edit HTML and paste the HTML. Done!


I'm not sure what you mean by "original context" but you could try to add the following to the head of the saved HTML.

<base href="http://slashdot.org/" />


When you're in the HTML section of firebug, there's an "Edit" button on the bar just below firebug's main toolbar. Clicking this button gives you a plain text view of the HTML (with any edits you've made) that you can copy to a text editor.


I think this is a good question, in short, firebug is not made to 'keep' your edits, so I would suggest finding a work flow where you are never too 'deep' into a page. One thing is to save the HTML but saving your edited CSS is even harder. Here are my solutions to your questions:

  1. Click on HTML tag, click Edit. Copy and paste into another text file.

  2. You cannot 'reload' firebug manipulated HTML. You can however copy the manipulated HTML after you are happy with your results (or unhappy). Either keep it on your clip board to copy it to a text file and then when you want to use it again you need to copy it back into the firebug edit console.


Try cssUpdater, it consists of a FireFox add on that listens to your FireBug css changes over a socket server and let you sync your original css source files. You need to install the Desktop application as well.

So a workflow would be:

  1. Edit in FireBug
  2. Click sync in cssUpdater
  3. Reload your site and see that your changes is saved

You can test and use it here, http://www.cssupdater.com


File → Save Page As... will save your edited markup as HTML, but it seems you may save some Firebu-generated content as well (I guess exactly what depends on your version of Firebug).


One thing you can try is to select the web page (right click, select all from the popup menu) and then pick View Selection Source. This should show you the modified HTML in a source window that you can then copy and save in an editor. You may get some additional stuff added by Firebug you can delete in your text editor.


You can configure an external editor. Open firebug, on the left you have firebug icon, press it and click open in editor and then configure editors. It works with Gedit and Bluefish.

To configure gedit: open FireBug's configure editor and click add, name it gedit and then browse for the executable within 'usr/bin' and select or type in gedit. You can test the configura before saving.

0

精彩评论

暂无评论...
验证码 换一张
取 消