NEW 25833
Page that performs syntax highlighting on <code> elements in JS looks wrong when loaded from web archive
https://bugs.webkit.org/show_bug.cgi?id=25833
Summary Page that performs syntax highlighting on <code> elements in JS looks wrong w...
Reiner Pittinger
Reported 2009-05-16 01:51:18 PDT
When saving a page with a <code>-element, the saved page is displayed incorrectly when viewing the saved archive. Reproduce: 1. Go to http://guides.rubyonrails.org/i18n.html 2. Look at the correctly displayed code block (below "1.2 The Public I18n API"). 3. Save the website as a webarchive. 4. Open the archive and look at the same document part again. Now you will see text like " class="comment">", which is actually a broken <span>-element.
Attachments
Mark Rowe (bdash)
Comment 1 2009-05-16 02:05:32 PDT
Looking in the web inspector, the markup for the code block on the original page looks like so: <div class="code_container"><code class="ruby"> translate <span class="comment"># Lookup text translations</span> localize <span class="comment"># Localize Date and Time objects to local formats</span> </code></div> This matches what is in the document source. When loaded from the web archive, the markup for the code block looks like so: <div class="code_container"><code class="ruby"> translate <span><span class="keywords">class</span>=<span class="string">"comment"</span>&gt;<span class="comment"># Lookup text translations</span></span> localize <span><span class="keywords">class</span>=<span class="string">"comment"</span>&gt;<span class="comment"># Localize Date and Time objects to local formats</span></span> </code></div> Looking at the source of the main resource via View -> Source shows the original, correct markup.
Mark Rowe (bdash)
Comment 2 2009-05-16 02:10:06 PDT
I was mistaken: the markup in the original page looks like: <div class="code_container"><code class="ruby"> translate # Lookup text translations localize # Localize Date and Time objects to local formats </code></div> Since the DOM being displayed contains extra elements related to syntax highlighting, I suspect there is syntax highlighting being performed via JavaScript. When saving as a web archive we serialize from the DOM at that point in time. When the document is then loaded once more the syntax highlighting is run on the already-highlighted element, which causes it to attempt to highlight the presentational markup that the earlier syntax highlighting introduced.
Mark Rowe (bdash)
Comment 3 2009-05-16 02:10:52 PDT
I知 not sure whether this is really a bug.
Mark Rowe (bdash)
Comment 4 2009-05-16 22:48:01 PDT
Brady, what do you think we should do with this?
Note You need to log in before you can comment on or make changes to this bug.