2023-03-28 12:32 BST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002409NetSurfLayoutpublic2016-02-02 15:50
ReporterHarriet Bazley 
Assigned To 
PlatformIyonix AriaOSRISC OSOS Version5.22
Product Version 
Target VersionFixed in Version 
Summary0002409: All text is displayed centred on fanfiction.net
DescriptionEvery chapter on www.fanfiction.net gets displayed with the main body text centred; long paragraphs of centred text are hard to read.
The same pages when viewed on the mobile site display as intended, i.e. left-aligned paragraphs.
Steps To ReproduceView any story on the site, e.g. https://www.fanfiction.net/s/9480915/1/White-Light
Compare with the mobile version: https://m.fanfiction.net/s/9480915/1/White-Light
Additional InformationI've noticed this bug over a long range of NetSurf versions going back a couple of years at least.
TagsNo tags attached.
Fixed in CI build #
Reported in CI build #3244
URL of problem pagehttps://www.fanfiction.net/s/9480915/1/White-Light
Attached Files


Dave Higton


Dave Higton (developer)

It appears that a Javascript document.write() statement is not being obeyed.
Michael Drake


Michael Drake (administrator)

Last edited: 2016-02-02 11:59

View 4 revisions

It's centred in the markup, and then JavaScript adds a STYLE element to the document which left aligns it. I have no idea why anyone would do that.

So it will never be left-aligned with JS off. With JS on, we need support for JS writing STYLE elements into the document.

Test case:

<!DOCTYPE html>
document.write('<style>p#foo { color: green; background: #dfd; }</style>');
<p id="foo">JS makes me green!


Edit: Note: Mantis swallows the P element close tag in the above.

Michael Drake


Michael Drake (administrator)

It seems that the dom_default_action_DOMSubtreeModified_cb() is not called for STYLE elements added by JavaScript, which is what prevents us from ever adding the new stylesheet data.
Michael Drake


Michael Drake (administrator)

In fact, the STYLE node is never added to the DOM.
Michael Drake


Michael Drake (administrator)

Actually, there's more to it. We do add STYLE nodes to the DOM and that works.

The problem seems to be with some XCOOKIE library that the JS uses. Due to that failing, it never manages to write out the crucial "text-align: left;".

document.write('<style> .storytext { max-height: 999999px; width: '+XCOOKIE.read_width+'%; font-size:' + XCOOKIE.read_font_size + 'em; font-family: "'+XCOOKIE.read_font+'"; line-height: '+XCOOKIE.read_line_height+'; text-align: left;} </style>');

-Issue History
Date Modified Username Field Change
2016-01-01 03:35 Harriet Bazley New Issue
2016-01-04 21:26 Dave Higton Note Added: 0001136
2016-01-04 21:27 Dave Higton Status new => acknowledged
2016-02-02 11:57 Michael Drake Note Added: 0001182
2016-02-02 11:57 Michael Drake Note Edited: 0001182 View Revisions
2016-02-02 11:58 Michael Drake Note Edited: 0001182 View Revisions
2016-02-02 11:59 Michael Drake Note Edited: 0001182 View Revisions
2016-02-02 12:09 Michael Drake Note Added: 0001183
2016-02-02 13:14 Michael Drake Note Added: 0001184
2016-02-02 15:50 Michael Drake Note Added: 0001185
+Issue History