JavaScript Style Sheets

JavaScript Style Sheets (JSSS) ist eine in JavaScript integrierte Stylesheet-Sprache für HTML-Dokumente.

JSSS wurde vom Browser-Anbieter Netscape entwickelt und 1996 dem World Wide Web Consortium (W3C) in einer Working Draft vorgelegt. Es handelte sich um eine Parallel-Entwicklung zu den Cascading Style Sheets (CSS). Netscape setzte auf JavaScript-basierte Deklarationen von Formatdefinitionen, um diese von vorneherein in sein DHTML-Modell zu integrieren.

Das Konzept von JSSS kollidierte jedoch mit dem von CSS, welches vom W3C favorisiert wurde und sich schließlich auch durchsetzte. Der Netscape-Browser interpretierte JSSS-Syntax bis zur Produktversion 4.x. In späteren Versionen (beginnend mit Version 6.0), die auf der Gecko-Engine basierten, wurde die Unterstützung für JSSS aufgegeben. Andere Browser als der von Netscape haben JSSS nie interpretiert. Interessant ist auch, dass Netscape 4.x intern alle CSS-Deklarationen in JSSS-Deklarationen konvertierte. Er enthielt also gar keinen echten CSS-Parser, sondern stattdessen einen Konverter für CSS-Syntax zu JSSS-Syntax.

JSSS-Beispiel

Das nachfolgende Beispiel zeigt einen Quelltext-Ausschnitt aus einer HTML-Datei:

<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>

Zu erkennen ist, dass JSSS ähnlich wie CSS innerhalb eines "style"-Elements deklariert werden kann. Als Stylesheet-Typ wird jedoch der MIME-Type von JavaScript angegeben, nämlich "text/javascript". Das Beispiel zeigt Formatdefinitionen für verschiedene HTML-Elemente in zwei verschiedenen Notationsmöglichkeiten.

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.