script: Allow moving back to non-quirks mode (#30898)

The code in script is written so that the document itself can move from
quirks to non-quirks mode, but this is never communicated to layout --
meaning quirky layout keeps happening. This is an issue when rewriting
the entire document with `document.write()` which is what some WPT tests
do to test quirks mode behavior.
This commit is contained in:
Martin Robinson 2023-12-21 09:14:00 +01:00 committed by GitHub
parent c8cfab2518
commit abb017b854
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -823,12 +823,12 @@ impl Document {
self.quirks_mode.get()
}
pub fn set_quirks_mode(&self, mode: QuirksMode) {
self.quirks_mode.set(mode);
pub fn set_quirks_mode(&self, new_mode: QuirksMode) {
let old_mode = self.quirks_mode.replace(new_mode);
if mode == QuirksMode::Quirks {
if old_mode != new_mode {
match self.window.layout_chan() {
Some(chan) => chan.send(Msg::SetQuirksMode(mode)).unwrap(),
Some(chan) => chan.send(Msg::SetQuirksMode(new_mode)).unwrap(),
None => warn!("Layout channel unavailable"),
}
}