Last modified: 2010-05-15 15:33:33 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T4186, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 2186 - document.write() breaks under application/xhtml+xml in skins/common/wikibits.js
document.write() breaks under application/xhtml+xml in skins/common/wikibits.js
Product: MediaWiki
Classification: Unclassified
Interface (Other open bugs)
PC Windows XP
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, patch-need-review
Depends on:
Blocks: html
  Show dependency treegraph
Reported: 2005-05-16 12:48 UTC by Damien
Modified: 2010-05-15 15:33 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---

Proposed patch for bug 2186 (15.83 KB, text/plain)
2005-05-16 12:52 UTC, Damien
Bug 2186 patch (17.83 KB, text/plain)
2005-05-17 15:19 UTC, Damien
Updated patch (1.21 KB, patch)
2008-06-15 15:49 UTC, Chad H.

Description Damien 2005-05-16 12:48:24 UTC
When using the 'application/xhtml+xml' content type document.write() function do not work 
in 'skins/common/wikibits.js'. You should instead use the DOM.

I use this to select the content type based on the browser's HTTP_ACCEPT:

$wgMimeType = in_array('application/xhtml+xml', array_map('trim', explode(',', 
$_SERVER['HTTP_ACCEPT']))) ? 'application/xhtml+xml' : 'text/html';

I will include a patch, but I will not work on (at least not anytime soon) addButton() or 
addInfobox() as I currently do not understand them. I first noticed this bug concerning 
the DOM with showTocToggle().

The patch has had the showTocToggle() tested on Opera 7.54u2, Mozilla Firefox 1.0.2 and 
Internet Explorer 6. The 'special stylesheet links' has not been tested.

In addition to this bug, Opera should use document.createElementNS() rather than document.
createElement(). Internet Explorer does not support document.createElementNS, so a check 
should be performed before using it. This was first discovered in tabbedprefs(), which has 
also been included in the patch and tested.
Comment 1 Damien 2005-05-16 12:52:21 UTC
Created attachment 553 [details]
Proposed patch for bug 2186

Version 1 Patch by Damien Bezborodow. Further notes included in comments.
Compare with the current file of 1.4.4 to see my changes.
Comment 2 Brion Vibber 2005-05-16 19:43:59 UTC
Please make sure you're working from CVS HEAD, *not* the 1.4 release branch.
Comment 3 Damien 2005-05-17 15:19:05 UTC
Created attachment 557 [details]
Bug 2186 patch

This has been updated to be relevent to the CVS head. There are still some
instances of document.write() that need to be removed.

The use of document.createElementNS() will solve issues in Opera, but they may
not work in HTML.

Furthermore this script will need testing. If the current version works on the
CVS version, then this should too.
Comment 4 Chad H. 2008-06-15 15:49:39 UTC
Created attachment 4978 [details]
Updated patch

Updated patch to remove the last of the document.write()'s in wikibits. These are all <link> CSS, so I made a new function called appendLinkedCss() to add new child DOM objects to the head.

Just want some review, as Javascript isn't my strongest.
Comment 5 Brion Vibber 2008-07-05 00:06:19 UTC
Shouldn't this just use importStylesheetURI() instead of creating a new function to do the same thing?
Comment 6 Chad H. 2008-07-08 14:50:25 UTC
Fixed properly in r37320

Note You need to log in before you can comment on or make changes to this bug.