Loading ...
Sorry, an error occurred while loading the content.
 

Re: [svg-developers] CSS

Expand Messages
  • Jon Ferraiolo
    Steve, There was an extensive debate about whether SVG implementations must support CSS. Three significant things to note: * The W3C has two styling languages
    Message 1 of 38 , Dec 31, 2000
      Steve,
      There was an extensive debate about whether SVG implementations must
      support CSS.

      Three significant things to note:

      * The W3C has two styling languages right now: CSS and XSL. It is not
      justifiable to require the use of one W3C styling language and not the
      other, and it is too much to ask implementers to support both.

      * CSS carries a cost in terms of implementation requirements, code
      size, and processing speed. (Adobe, which has implemented most of the CSS
      features required by SVG, can attest to this.)

      * There are many uses for SVG which do not require CSS, such as data
      exchange.

      The decision by the SVG working group was that CSS support in SVG is:

      * Required when the user agent already supports CSS for other purposes.
      (For example, a Web browser that supports CSS with HTML is required to
      support CSS with SVG also.)

      * Otherwise, CSS support is optional.

      Even though CSS support in SVG is theoretically optional, right now most
      implementations are supporting at least a subset of CSS, and most likely
      this will continue into the future. I think the graphics authoring tools
      such as Adobe Illustrator and Corel Draw will tend to force support for at
      least a subset of CSS because they are exporting files that use some
      combination of the 'style' attribute and the CSS class selector. Since a
      significant percentage of content out there will be using CSS, tools will
      be forced to support CSS. Another factor is that there is an open source
      CSS library in Java, which helps out all of the Java implementations.

      Jon Ferraiolo
      SVG Editor
      jferraio@...

      At 04:15 PM 12/30/00 -0500, you wrote:
      >I am reading through the Aug 2 SVG recommendation and the section on CSS
      >states "SVG implementations that support CSS...". Is it acceptable to have
      >an SVG implentation that does not support CSS? If so, what type of use is it
      >envisioned such an implementation would be applied to?
      >
      >Thanks
      >Steve White
      >www.VirtualMechanics.com
      >
      >
      >
    • Vernari-Corami
      Ciao Serena, of course you may insert new style fragments. Just enclose the same text you ve attached below in a javascript variable (let s say frag ),
      Message 38 of 38 , May 6 9:09 PM
        Ciao Serena,
        of course you may insert new "style" fragments.
        Just enclose the same text you've attached below in a javascript variable (let's say "frag"), then:

        // Let's find the first child-element of the document root (svg)
        var first_child_elem = svgDocument.documentElement.firstChild;
        while (first_child_elem != null) {
        if (first_child_elem.nodeType == 1) break; // If the node is an element then go out the loop
        first_child_elem = first_child_elem.nextSibling; // Try with the next sibling node
        }

        // The next "if" is optional: more safe in case of a simple document like: <svg>abc</svg>
        if (first_child_elem != null) {
        var frag = "<style .... ... </style>";

        // Parses the content of the string as a XML fragment
        var svg_node = parseXML(frag, svgDocument);

        // Inserts the new fragment BEFORE the first element you have
        svgDocument.documentElement.insertBefore(svg_node.firstChild, first_child_elem);
        }
        Ciao
        Mario

        ----- Original Message -----
        From: serena
        To: svg-developers@yahoogroups.com
        Sent: Thursday, May 06, 2004 3:40 PM
        Subject: [svg-developers] CSS


        Hi to everyone! Is it possible to insert dynamically a style element???
        I can remove it with removeChild, but how can I insert It again???
        The bit of code I want to remove/append is
        <style id ="all_grey" type="text/css"><![CDATA[

        line.grigio{stroke:#DCDCDC;fill:grey}

        rect.grigio{stroke:#DCDCDC}

        rect.trasparent{stroke:none}

        polyline.grigio{stroke:#DCDCDC;fill:#DCDCDC}

        circle.grigio{stroke:#DCDCDC;fill:#DCDCDC}

        circle.empty{stroke:#DCDCDC;fill:none}

        polygon.empty{stroke:#DCDCDC;fill:#FFF}

        path.grigio{fill:none; stroke:#DCDCDC}

        text.grigio{fill:#DCDCDC;font-weight:bold;font-style:oblique}

        text.black{fill:black}

        polygon.grigio{stroke:#DCDCDC;fill:#DCDCDC}



        ]]></style>


        [Non-text portions of this message have been removed]



        -----
        To unsubscribe send a message to: svg-developers-unsubscribe@yahoogroups.com
        -or-
        visit http://groups.yahoo.com/group/svg-developers and click "edit my membership"
        ----


        Yahoo! Groups Sponsor
        ADVERTISEMENT





        ------------------------------------------------------------------------------
        Yahoo! Groups Links

        a.. To visit your group on the web, go to:
        http://groups.yahoo.com/group/svg-developers/

        b.. To unsubscribe from this group, send an email to:
        svg-developers-unsubscribe@yahoogroups.com

        c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



        [Non-text portions of this message have been removed]
      Your message has been successfully submitted and would be delivered to recipients shortly.