[Webkit-unassigned] [Bug 278992] Entity 'commat' not defined
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Sep 10 13:48:09 PDT 2024
https://bugs.webkit.org/show_bug.cgi?id=278992
--- Comment #8 from dabl02 at free.fr ---
(In reply to Michael Catanzaro from comment #7)
> OK, problem was I didn't read your comment. The error doesn't occur on
> WebKit Bugzilla because an HTTP header sets the content type. When opened
> locally, there is no HTTP and the content type is guessed from the content
> of the file. shared-mime-info reasonably guesses XHTML because that's what
> it is:
>
> <html xmlns="http://www.w3.org/1999/xhtml">
>
> So the error is correct. You've just got an invalid XHTML file.
That's it!
So the problem is the document type being recognized wrongly.
To find an explanation, I read the HTML5 standard. I found some interesting answers:
- The parser used for the file depends on its MIME type:
https://dom.spec.whatwg.org/#html-document
```
A document is said to be an XML document if its type is "xml"; otherwise an HTML document. Whether a document is an HTML document or an XML document affects the behavior of certain APIs.
```
- The xmlns attribute has no effect on guessing the document type (HTML or XML):
https://html.spec.whatwg.org/multipage/dom.html#global-attributes
```
In HTML documents, elements in the HTML namespace may have an xmlns attribute specified, if, and only if, it has the exact value "http://www.w3.org/1999/xhtml". This does not apply to XML documents.
```
- The way to retrieve the MIME type of a resource depends on its source (network or file system). There is a MIME type detection algorithm. In the case of a local file, the MIME type is provided by the file system:
https://mimesniff.spec.whatwg.org/#interpreting-the-resource-metadata
```
If the resource is retrieved directly from the file system, set supplied-type to the MIME type provided by the file system.
```
- Finally, the association between filename extensions and MIME types exists in UNIX-type systems at `etc/mime.types` and can be seen as a way for the filesystem to provide the MIME type (https://en.wikipedia.org/wiki/Media_type#mime.types).
I confirmed with Firefox that, if I rename the file `index.html` to `index.xhtml`, the file is parsed as an XML Document and I get the **same** error.
So the way the MIME Type is guessed depends on the web browser. In the case of a local file, should Epiphany guess the MIME type based on the filename?
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240910/2554621f/attachment.htm>
More information about the webkit-unassigned
mailing list