Closed Bug 5390 Opened 25 years ago Closed 25 years ago

dynamically writing style sheet information with JavaScript causes line breaks in document

Categories

(Core :: CSS Parsing and Computation, defect, P3)

defect

Tracking

()

VERIFIED WORKSFORME

People

(Reporter: lists, Assigned: peterl-retired)

Details

We wanted to include/write a style sheet dynamically for each platform/browser by using JavaScript. Looks like this <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"> <!-- if (navigator.platform) { if (navigator.platform.substring(0,3) == "Mac") { if (navigator.appName == "Microsoft Internet Explorer") { document.writeln('<LINK REL="STYLESHEET" TYPE="text/css" HREF="/styles/iemac_.css">'); } else if (navigator.appName == "Netscape") { document.writeln('<LINK REL="STYLESHEET" TYPE="text/css" HREF="/styles/navmac_.css">'); } } else if (navigator.platform.substring(0,3) == "Win") [...] //--> </SCRIPT> Same result when you write <STYLE ...> instead of <LINK ...>. Basicly, the bug has to do with dynamically writing style sheet information with JavaScript. The bug is very annoying since it produces LINE BREAKS in your HTML document when your NN 4.5+ browser displays them. Every time after a certain amount of characters (including external scripts), at the same place in the same document (a few lines earlier on Macintosh computers). The bad thing about those line breaks is, that if they happen in a JavaScript, there will be a JavaScript error. But even a tag like <IMG ...> would be read (and shown in the wysiwyg view source mode) like <IM G ...> if you are unlucky. Therefore the element will not be displayed properly and destroys your table based layout or produces weird effects, from displaying code as text or displaying images in huge sizes and strange colors, depending which tag the line break destroyed. It took us 3 months to figure out the source of this problem, in the meantime we tried to avoid it by <!--commenting--> out the lines where this happened, which took us a hell of a lot time of testing and writing. A huge economic factor. Anyway, we found a workaround for this bug by hiding the data. Now we put all style sheet data in a variable and document.write(variable); - basicly the same, but somehow Navigator doesn't freak out "arrrghhh, a style sheets, let's do some weird things", but simply does what it should do "dumdidum... oh, a nice variable, let's write it". Hopefully you can fix this problem in the NN5 release. It really was some pain... Regards, Martin Kliehm
QA Contact: 4590 → 4015
Assignee: norris → peterl
Component: JavaScript → Style System
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → WORKSFORME
This isn't a problem in Gecko
QA Contact: 4015 → 4616
Its working for viewer as well as apprunner
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.