-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The processing model for text files seems to mandate quirks mode #5939
Comments
I agree this should not be very risky, and generally seems like a good idea. I hope other browsers think similarly. I don't think we should leave this up to UAs; although it's not a big interop risk, it's an unnecessary one. Note also that the corresponding sections for media and plugins use no-quirks, since instead of using the parser, they create elements directly. So for consistency with those sections it'd be ideal if text documents were also no-quirks. (I don't know what browsers actually do, though... maybe they use quirks for everything?) As an aside: it's not obvious to me whether
will hit the "initial" insertion mode, or bypass it and go straight into the PLAINTEXT state. Maybe it is obvious to people who are more familiar with the parser. But in whatever state we end up, it might be worth adding a note about the intention. |
I think this is a duplicate of #3113 though note that it reaches a different conclusion of the end result here. It's also not clear to me this is worth changing given that I doubt we can ever change initial about:blank and I would expect that to be more prominent. |
Thanks - I agree on both counts.
I didn't check other browsers, but Chromium has used quirks mode for both media and plugins. I'm trying to get that changed right now. Along with image preview documents.
Given the comment below from @annevk, it does seem like this needs clarification, at least.
Thanks for the pointer to #3113 - I didn't find that one when I looked. Interesting that the "different conclusion" is that the current spec points to text file documents being in no-quirks mode. So it would seem that we should at least clarify the spec, if not change it. Your point about about:blank is a good one. However, I think that spec is separate from the text file spec, if I am looking at the right place. The create a new browsing context section says:
So I would think the proposed change here, to text documents, wouldn't affect that. Right? |
Quirks mode layout is slower, so change to no-quirks. Note that this goes against the spec [1], which mandates quirks mode for text documents. An issue [2] has been raised to change that, but in the meantime, this seems like a very low (compat) risk change. For now, however, the WPT test will not be changed, and a broken expectation will be committed. [1] https://html.spec.whatwg.org/multipage/browsing-the-web.html#read-text [2] whatwg/html#5939 Bug: 1131185 Change-Id: If7ac8cbe8b4ec277f2cb288d120698b9bacf773c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2425109 Commit-Queue: Mason Freed <masonfreed@chromium.org> Reviewed-by: Kent Tamura <tkent@chromium.org> Auto-Submit: Mason Freed <masonfreed@chromium.org> Cr-Commit-Position: refs/heads/master@{#810357}
Yeah, it wouldn't affect that. I'm a little hesitant to change such long-standing behavior however. Quirks mode is fairly established, the couple quirks it creates are standardized in https://quirks.spec.whatwg.org/. What's the upside of changing this? |
For Chromium, at least, the implementation of quirks mode can be slower than standards mode, and in many cases switching to no-quirks makes rendering faster. So I'm going through the various documents and attempting to make them no-quirks where possible. The text file change was one of those, and was one of the few (other than about:blank) where quirks-mode seemed to be according to spec. Aside from that, having some standard documents be specified in "quirks" mode just seems odd, given that quirks-mode is a backwards-compatibility layer and is discouraged for new features:
This was also alluded to above by @domenic - other similar documents (e.g. media and plugins) are specified to be in no-quirks mode. Do you foresee compat issues from this change? If so, any pointers for where to look for such issues? +@rniwa, any thoughts? |
For text/plain docs, at least, switching to standards mode has a rendering difference because of Something that could break is if the parent page or opener page mutates the DOM to add styles or other stuff, and expect quirks mode. But I would guess that this is extremely rare. |
So per https://bugs.chromium.org/p/chromium/issues/detail?id=1131185 looks like this was changed in Chromium Sep 25, 2020. @mfreed7 has there been any fallout? |
So as mentioned, this change went into Chromium as of 87.0.4275.0. We're two stable releases past that, and so far I've seen zero fallout. I'd say this is safe change to make. |
Quirks mode layout is slower, so change to no-quirks. Note that this goes against the spec [1], which mandates quirks mode for text documents. An issue [2] has been raised to change that, but in the meantime, this seems like a very low (compat) risk change. For now, however, the WPT test will not be changed, and a broken expectation will be committed. [1] https://html.spec.whatwg.org/multipage/browsing-the-web.html#read-text [2] whatwg/html#5939 Bug: 1131185 Change-Id: If7ac8cbe8b4ec277f2cb288d120698b9bacf773c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2425109 Commit-Queue: Mason Freed <masonfreed@chromium.org> Reviewed-by: Kent Tamura <tkent@chromium.org> Auto-Submit: Mason Freed <masonfreed@chromium.org> Cr-Commit-Position: refs/heads/master@{#810357} GitOrigin-RevId: 61de461c7a4f6395bf433d56d1ca7b2c0226e058
It seems that the Page load processing model for text files mandates quirks mode presentation of the text document. That section says:
If I'm reading that correctly, it says that the parser should receive
<pre>
, a line feed, and then go into PLAINTEXT state to parse the content of the text file. Based on the "initial" insertion mode spec, since this isn't an iframe, the document will be set to quirks mode, due to lack of a DOCTYPE.I doubt this is intentional. Would it make sense to either:
a) explicitly specify it to be no-quirks mode, or
b) explicitly allow UAs to decide on quirks vs no-quirks mode
Chromium is working on removing built-in quirks mode documents, such as the view-source document. In doing so, this spec issue was pointed out (by @tkent-google, here).
Currently, Chromium, WebKit, and Gecko all produce a quirks-mode document here. But Chromium would like to change that. There seems to be little compat risk to making this change, but perhaps I'm missing something.
The text was updated successfully, but these errors were encountered: