Skip to content

Commit d6048a3

Browse files
committed
Temporarily comment out var-outside checking
1 parent f593a55 commit d6048a3

File tree

1 file changed

+35
-30
lines changed

1 file changed

+35
-30
lines changed

src/variables.rs

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
//! Converts custom attributes `algorithm=""` and `var-scope=""` to `data-`
2-
//! equivalents, to preserve validity of the output document. Errors on
3-
//! `<var>`s outside of those scopes, unless the `<var>` has an `ignore=""`
4-
//! attribute.
5-
//!
6-
//! TODO: check for `<var>`s inside of these scopes that are only used once, and
7-
//! error when such lone `<var>`s are encountered.
2+
//! equivalents, to preserve validity of the output document.
3+
//
4+
// TODO: error on `<var>`s outside of those scopes, unless the `<var>` has an
5+
// `ignore=""` attribute. (This code is present but disabled until
6+
// https://github.com/whatwg/html/pull/11392 is merged.)
7+
//
8+
// TODO: check for `<var>`s inside of these scopes that are only used once, and
9+
// error when such lone `<var>`s are encountered.
810

911
use std::fmt::Write as _;
1012
use std::io;
@@ -180,12 +182,14 @@ impl<'a> Processor<'a> {
180182
}
181183
return Err(io::Error::new(io::ErrorKind::InvalidData, msgs.join("\n")));
182184
}
183-
if !self.var_out_of_scope_msgs.is_empty() {
184-
return Err(io::Error::new(
185-
io::ErrorKind::InvalidData,
186-
self.var_out_of_scope_msgs.join("\n"),
187-
));
188-
}
185+
186+
// Disabled until https://github.com/whatwg/html/pull/11392 is merged.
187+
// if !self.var_out_of_scope_msgs.is_empty() {
188+
// return Err(io::Error::new(
189+
// io::ErrorKind::InvalidData,
190+
// self.var_out_of_scope_msgs.join("\n"),
191+
// ));
192+
// }
189193

190194
let old_algorithm = QualName::new(None, ns!(), LocalName::from("algorithm"));
191195
let new_algorithm = QualName::new(None, ns!(), LocalName::from("data-algorithm"));
@@ -325,24 +329,25 @@ mod tests {
325329
);
326330
}
327331

328-
#[tokio::test]
329-
async fn test_var_outside_scope_errors() {
330-
let parsed = parse_document_async(
331-
r##"<!DOCTYPE html>
332-
<p>Outside scope <var>bar</var></p>
333-
"##
334-
.as_bytes(),
335-
)
336-
.await
337-
.unwrap();
338-
let document = parsed.document().clone();
339-
340-
let mut proc = Processor::new(&parsed);
341-
dom_utils::scan_dom(&document, &mut |h| proc.visit(h));
342-
let result = proc.apply();
343-
let err = result.unwrap_err();
344-
assert!(err.to_string().contains("Line 2: "));
345-
}
332+
// Disabled until https://github.com/whatwg/html/pull/11392 is merged.
333+
// #[tokio::test]
334+
// async fn test_var_outside_scope_errors() {
335+
// let parsed = parse_document_async(
336+
// r##"<!DOCTYPE html>
337+
// <p>Outside scope <var>bar</var></p>
338+
// "##
339+
// .as_bytes(),
340+
// )
341+
// .await
342+
// .unwrap();
343+
// let document = parsed.document().clone();
344+
345+
// let mut proc = Processor::new(&parsed);
346+
// dom_utils::scan_dom(&document, &mut |h| proc.visit(h));
347+
// let result = proc.apply();
348+
// let err = result.unwrap_err();
349+
// assert!(err.to_string().contains("Line 2: "));
350+
// }
346351

347352
#[tokio::test]
348353
async fn test_var_inside_algorithm_ok() {

0 commit comments

Comments
 (0)