An annoying gotcha when viewing page source in Firefox

For most of my web page reconnoitering, Firebug fits the bill quite nicely. There are occasions, however, when I simply need to view larger swaths of HTML code, without all of Firebug’s features in the way. The well-used View Source can work well:

But when the structure of a page is fairly complicated, seeking to the section of code desired can be time-consuming.

And so we can do better by selecting the part of the page that is of interest, right-clicking, and selecting “View Selection Source”:

This brings up the entire page’s source, but centered on the selected part, with that part of the code highlighted. Perfect!

Except for a small oversight: The code browser used with View Selection Source detects and corrects malformed HTML! When one is trying to correct bugs on a web page, this behavior can wreak havoc. I’ll provide a real example. I needed to scrape a table from a webpage. I then needed to pull certain rows from this table for recording, ignoring others. This was created and worked well, until one day it suddenly broke. I suspected the structure of the page holding the table had changed, causing issues for parsing. So I went to the page, selected the end of the desired part of the table, and chose View Selection Source. Strangely, there was no malformedness to be found! After a lot more debugging, I happened to do the same check again, but by using View Source and looking for the section of interest. Lo, and behold! A malformed tag. Now I knew what I needed to fix, way after I needed to.

Post to Twitter Post to Delicious Post to Digg Post to Reddit

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

This entry was posted in Desktop, Programming and tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>