Open Bug 310903 Opened 19 years ago Updated 2 years ago

[meta] "Save Page As... - Web Page, complete" should alter the source as little as possible

Categories

(Firefox :: General, defect)

x86
Windows XP
defect

Tracking

()

People

(Reporter: age.bosma, Unassigned)

References

Details

(Keywords: meta)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20050914 Firefox/1.6a1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20050914 Firefox/1.6a1

When using the "Save Page As... - Web Page, complete" function, Firefox tends to
alter the original source. This should not happen imo. I'm asking it to save
that specific web page as it is, not to make it valid or whatever it tries to
achieve. That's not the purpose of a browser.

Among other things, Firefox is changing the following:
- It removes <?xml version="1.0" encoding="utf-8"?> from the start of the html
documents.
- It removes the trailing slashes of single tags like <br /> or <col /> to <br>
or <col>.
- It converts inline styles with hex value colours to rgb values like
style="color: #00BE00;" to style="color: rgb(0, 190, 0);"

Reproducible: Always
The thing about the inline styles also applies to the "View Selection Source"
function. I can file a new bug for this but this but should be sufficient to say
that Firefox should never touch the original source in any way, nowhere.
No, it shouldn't be sufficient. To save as complete requires rewriting all
references to included CSS and JS files into file:/// URLs, which could possibly
be done by writing a special-purpose parser which does just that, though nobody
capable of doing so would write one when serializing the DOM that Gecko has
built up comes for free; view selection source, which has to work on things
which didn't even exist in the source until after JS created them, could not: it
must be done by serializing the DOM that Gecko has created.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → INVALID
Although I didn't understand all that you're trying to say I disagree that it
shouldn't be fixed because of current core limitations. Of course it should
alter references to included CSS and JS files but this doesn't mean it should
alter the rest of the source as well. I'm not asking it to do so and it's
therefor unexpected behaviour. It should save the files as is except for the
references to external files like CSS, JS, images, etc. There is no reason for
it to change hex values to rgb values, remove trailing slashed, etc.
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
I'm turning this into a metabug because most of the items in your list require
separate decisions.  You might also be interested in bug 45628 for saving
XHTML-sent-as-text/html as XHTML.
Blocks: 115634
Depends on: 110762, 120556
Keywords: meta
Summary: "Save Page As... - Web Page, complete" should not alter the source. → [meta] "Save Page As... - Web Page, complete" should alter the source as little as possible
I want to second that this is unexpected behavior, and sent me around in circles the first time I ran into this. I posted the following onto http://mrmichaelwill.wordpress.com/2008/01/24/validating-html-firefox-mangles-html-when-saving/ :

I was developing a small internal webservice and being a good netcitizen wanted to validate it to be up to standards with http://validator.w3.org/ which is my favorite tool since it allows to enter a URL if the page is on the public network, and it allows uploading html for when its not. It is an excellent tool to verify that the XHTML created by your code does not just happen to look right in your browser but actually conforms to the XHTML standard.

So quickly hitting Ctrl-S to save the web-page into a file from my web browser Fedora/2.0.0.10-3.fc8 Firefox/2.0.0.10 and uploading it for validation I am running into all those validation errors - i.e. the meta tag is not closed. Double checking my code it should be closed, as I used it as a singleton? Quickly bringing up the source view window of the page within firefox shows that it is indeed closed, but the saved html looks different from what the source window shows.

One of those surprises - now I cut and paste from the source window into an editor instead of using ’save page'
Note that this comment was done in 2008, the original last comment on this bug was from 2005! Does this mean it will never be resolved?
Michael, see bug 120556.  I doubt that will change.  If you notice any problems where valid text/html becomes invalid text/html, or valid application/xhtml+xml becomes invalid application/xhtml+xml, please do file bugs blocking this one.
This bug is related to

Bug 319005 -  Save page as HTML, save page as web page complete, and view source all give different source for messed up page
Status: UNCONFIRMED → NEW
Ever confirmed: true
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.