On 04/26/2017 11:51 PM, Leif Halvard Silli wrote:
1.
Speaking as a former HTML Working Group member: quirks mode is a
concept that, for srcdoc documents, does not exist. That is: HTML5.x
says that the author may include or exclude the DOCTYPE, it does not
matter, the document must anyhow rendered by the parser in what
HTML5.x refers to as *no-quirks mode*. This is unique for srcdoc
documents. And browsers do implement it (verified by checking
Firefox and Safari).
However, the parser of XMLmind XML editor does not conform to this:
I have noticed that when DOCTYPE is excluded, then the document is
rendered - within XXE - in quirks-mode. (I used <div
style='width:50'> to check for quirks-mode: in no-quirks mode, that
code will not have any effect, but in quirks mode it does - in XXe -
have effect. In standard browsers, there is no such effect.)
(Tidbit: The reason @srcdoc does not have quirks mode is because it
was a fresh start - there did not exist legacy code to care about.)
@srcdoc is an attribute of element iframe. See
https://www.w3.org/TR/html5/embedded-content-0.html#the-iframe-element
Element iframe is rendered in the styled view by embedding a "Web
browser" (part of JavaFX, based on WebKit, I think). As such, we,
XMLmind, have very few control on this embedded "Web browser". See
http://docs.oracle.com/javase/8/javafx/api/javafx/scene/web/WebView.html
2.
Some might think (ahem - I am looking at myself ...) that a srcdoc
document would be a XHTML document when inside a XHTML document, and
a HTML document when inside a HTML document. But, actually (and of
course: my bad), a srcdoc document is always a 'text/html' HTML
document. This means, says the HTML5.x spec, that you are allowed to
skip the start and end tag of a lot of elements, including the root
element.
However, XMLmind XML editor does not implement this: Unless the
<html> start tag and end tag is included in the srcdoc attriute,
then XXe erroneously reports that the content is not HTML. By
contrast, the HTML5.x specification says that the @srcdoc does not
need to contain any code - it could simply simply be this:
|srcdoc="XMLmind must update its srcdoc HTML mind" |
The HTML parser will then, itself, insert all the lacking elements
when the srcdoc document is rendered.
Our implementation is based on this spec:
https://www.w3.org/TR/html5/embedded-content-0.html#attr-iframe-srcdoc
---
For iframe elements in HTML documents, the srcdoc attribute, if present,
must have a value using the HTML syntax that consists of the following
syntactic components, in the given order:
- Any number of comments and space characters.
- Optionally, a DOCTYPE.
- Any number of comments and space characters.
- The root element, in the form of an html element.
- Any number of comments and space characters.
For iframe elements in XML documents, the srcdoc attribute, if present,
must have a value that matches the production labeled document in the
XML specification. [XML]
---
Please tell us where to find a more authoritative spec and we'll have no
problem changing our implementation accordingly.
3.
Another thing: XXe escapes the code of srcdoc cod more than
necessary. E.g
|<html><head> |
becomes
|<html><head> |
whereas it would have been enough to let it become
|<html><head> |
May be it is just me, but I think that code becomes easier to read
if it is not escaped more than necesary. So would prefer that
behavior ... It also safes a few code bytes ...
--
XMLmind XML Editor Support List
xmleditor-support@xmlmind.com
http://www.xmlmind.com/mailman/listinfo/xmleditor-support