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
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.
--
XMLmind XML Editor Support List
xmleditor-support@xmlmind.com
http://www.xmlmind.com/mailman/listinfo/xmleditor-support