Page MenuHomePhabricator

When viewing diffs, syntax highlight is not being applyed anymore on preview
Closed, ResolvedPublic

Description

In the diff above, the sections which contains source code in <source lang="php"> tags are not being properly formated (GeSHi). The code is displayed as if it were in <pre> tags.

I believe this is another consequence of the page content being loaded via AJAX (bug 25289). See also another similar bug:
https://secure.wikimedia.org/wikipedia/mediawiki/w/index.php/?diff=386071&oldid=367003


Version: unspecified
Severity: minor
URL: https://secure.wikimedia.org/wikipedia/mediawiki/w/index.php/?diff=prev&oldid=386858

Details

Reference
bz27756

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:26 PM
bzimport set Reference to bz27756.

That is right, some javascript previews has the same problem (bug 24134, bug 24162).

That are the "headitems" of action=parse (bug 22061).

Created attachment 8271
Best guess at bug

attachment bug 27756.patch ignored as obsolete

using innerHTML += causes the html to be re-entered, dom elements re-created etc. could cause unexpected behaviour + would break any events to elements in there (although that's probably rare in the <head>).

use appendChild instead ( or $('head').append( htmlcodehere ) ).

And, although not specific to this patch, using JSON instead of XML from the API is probably a good idea.

Created attachment 8272
v2

Attached: