On 9/30/24 13:52, Leif Halvard Silli wrote:
Just a short reply, to admit an error of terminology, however my point remains:

I should not have said "style rule". I should have said (property) declaration, or something like that.

Declaration is vague. Let's call this
---
color: red
---
a property, and this
---
h1 { color: red }
---
a rule.



Of course the entire set of property rules - aka style rule - for the detail element you showcased in your reply, should not be ignored. Doing that, would be counter to the CSS specs.

But the very property

margin: 1rem 0;

should be ignored by XXE if it does not understand it.

Quoting CSS 2.1 <https://www.w3.org/TR/CSS2/syndata.html#parsing-errors <https://www.w3.org/TR/CSS2/syndata.html#parsing-errors>>  (which is not up to date, but I think this remains):

]]

Unknown properties. User agents must ignore a declaration with an unknown property. For example, if the style sheet is:

h1 { color: red; rotation: 70minutes }

the user agent will treat this as if the style sheet had been


h1 { color: red }

[[

Does this make my RFC more doable for you?

Yes. We'll review our current implementation of the CSS engine and we'll do our best to make it more consistent when an unknown property or unknown property value is parsed.





Leif Halvard Silli


Den 30. september 2024 12:42:31 CEST, skrev Hussein Shafie <huss...@xmlmind.com>:

    On 9/30/24 10:49, Leif Halvard Silli wrote:

        This relates to how XXE itself treats CSS values that it does
        not support, and it in particular relates to the Emulate Browser
        view for XHTML documents (though in principle and perhaps also
        in practise, it does also relate to the Semantic View, when one
        alter the way XXE displays elements).

        Theory:

            When a CSS parser discovers a value that it does not
        support, it should ignore the entire style rule.


    This behavior is totally counter-intuitive and would make developing
    CSS stylesheets specifically for XXE (an important goal for us) more
    difficult.

    Let's explain this.

    You want to style an XML document. For that, you write a number of
    CSS rules using your CSS knowledge. For example, something as simple as:

    detail {
    display: block;
    color: navy;
    margin: 1rem 0;
    }

    According to the behavior you describe, <detail> would not be styled
    at all just because the CSS author used the very common "rem" length
    unit (currently not supported by XXE).

    The behavior you describe makes it very difficult for a CSS author
    to pinpoint XXE limitations in terms of CSS support and work around
    them.



        Example:

             blockquote{margin-left:1mm}
             blockquote{margin-left:1km}

        In the above example, because 'km' (as much as I know) is an
        unsupported unit value in CSS, the second style rule should be
        completely ignored, and the first style rule should be used and
        applied.

        XXE does not follow this rule, it seems. In addition, XXE has
        many limitations with regard to the degree to which it supports CSS.


    Indeed.

    Good, conforming, CSS support has never been a design goal of XXE.
    XXE supports just enough CSS to make an XML document look decent on
    screen and that's it.




        So for instance, the Emulate Browser View supports the
        'margin-left' property, as long as one uses the units that XXE
        supports. Thus it supports

             margin-left:200px;

        But it does not support

             margin-left:55%;

        (If we use the built in style editor to add margin-left:55%; for
        a particular element, we are told that this value unit is not
        supported.)

        For that reason, if, inside a <style> element, one does this:

             margin-left:200px;
             margin-left:55%;

        Then, for instance, Firefox would use the last style rule, since
        it knows about both units and thus supports both rules – but the
        last rule should override the first rule. Whereas the Emulate
        View should ignore the last rule and apply the first rule, since
        it does not know about the percentage unit it margin styles.

        Currently, howver, this does not happen. What happens instead,
        is that both rules are ignored by XXE.


    This looks like a bug. We'll investigate this and if possible, try
    to fix this bug.

    With XXE:
    ------------------------------------------------------------------------
    margin-left:200px;
    margin-left:55%;
    ------------------------------------------------------------------------
    should be equivalent to:
    ------------------------------------------------------------------------
    margin-left:200px;
    ------------------------------------------------------------------------
    and not to:
    ------------------------------------------------------------------------
    margin-left:0;
    ------------------------------------------------------------------------


        This has several effects. The most important thing being that i
        makes it difficult to work around the limitations of XXE’s
        Emulate Browser view.

        It also makes Emulate Browser kind of useless, since one way to
        work around this limitation, is to make XXE spesific CSS styles
        that goes into
        'xhtml-config:css/xhtml_user_styles.css'  (for the Emulate
        Browser view) or
        'xhtml-config:css/xhtml5.css' (for the semantic view).


    The "Emulate Web Browser" CSS stylesheet has its uses, which are
    explained here:

    https://www.xmlmind.com/xmleditor/_distrib/doc/xhtml/view.html
    <https://www.xmlmind.com/xmleditor/_distrib/doc/xhtml/view.html>

    Some users like it for very modest reasons, for example, simply
    because they are used to see lists rendered by default in a compact
    way (just like in web browsers).




        But if you add the margin-left:200px; to xhtml_user_styles.css,
        and you also add marign-left:55% to the <style> element of the
        document you are editing, then XXE will in fact ignore both
        stylel rules and default to margin-left:0;

        So please make life simpler for us and make XXE ignore style
        rules entirely when it does not understand/support the unit
        value that is used inside the style rule!


    Sorry but we will not implement your RFC.



--
Hussein SHAFIE, Product Manager, huss...@xmlmind.com
XMLmind Software, 35 rue Louis Leblanc, 78120 Rambouillet, France
Phone: +33 (0)9 52 80 80 37, Fax: +33 (0)9 57 80 80 37, www.xmlmind.com


--
XMLmind XML Editor Support List
xmleditor-support@xmlmind.com
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to