JavaScript style sheets

from Wikipedia, the free encyclopedia

JavaScript Style Sheets (JSSS) is a style sheet language for HTML documents integrated in JavaScript .

JSSS was developed by the browser provider Netscape and submitted to the World Wide Web Consortium (W3C) in a working draft in 1996 . It was a parallel development to the Cascading Style Sheets (CSS). Netscape used JavaScript-based declarations of format definitions in order to integrate them into its DHTML model from the outset.

However, the concept of JSSS clashed with that of CSS, which was favored by the W3C and finally prevailed. The Netscape browser interpreted JSSS syntax up to product version 4.x. In later versions (starting with version 6.0), which were based on the Gecko engine, support for JSSS was discontinued. Browsers other than Netscape have never interpreted JSSS. It is also interesting that Netscape 4.x internally converted all CSS declarations into JSSS declarations. It did not contain a real CSS parser , but instead a converter for CSS syntax to JSSS syntax.

JSSS example

The following example shows a source code excerpt from an HTML file:

<style type="text/javascript">
 tags.H1.color = "blue";
 tags.p.fontSize = "14pt";
 with(tags.H3)
   color = "green";
 with(tags.H2)
 {
   color = "red";
   fontSize = "16pt";
   marginTop = "2cm";
 }
</style>

It can be seen that JSSS, similar to CSS, can be declared within a "style" element. However, the MIME type of JavaScript is specified as the stylesheet type , namely "text / javascript". The example shows format definitions for various HTML elements in two different notation options.

Web links