Struct lol_html::errors::ParsingAmbiguityError
source · pub struct ParsingAmbiguityError { /* private fields */ }
Expand description
An error that occurs when HTML parser runs into an ambigious state in the strict
mode.
Since the rewriter operates on a token stream and doesn’t have access to a full DOM-tree, there are certain rare cases of non-conforming HTML markup which can’t be guaranteed to be parsed correctly without an ability to backtrace the tree.
Therefore, due to security considerations, sometimes it’s preferable to abort the rewriting process in case of such uncertainty.
One of the simplest examples of such markup is the following:
...
<select><xmp><script>"use strict";</script></select>
...
The <xmp>
element is not allowed inside the <select>
element, so in a browser the start
tag for <xmp>
will be ignored and following <script>
element will be parsed and executed.
On the other hand, the <select>
element itself can be also ignored depending on the
context in which it was parsed. In this case, the <xmp>
element will not be ignored
and the <script>
element along with its content will be parsed as a simple text inside
it.
So, in this case the parser needs an ability to backtrace the DOM-tree to figure out the correct parsing context.
Trait Implementations§
source§impl Debug for ParsingAmbiguityError
impl Debug for ParsingAmbiguityError
source§impl Display for ParsingAmbiguityError
impl Display for ParsingAmbiguityError
source§impl Error for ParsingAmbiguityError
impl Error for ParsingAmbiguityError
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
source§impl PartialEq<ParsingAmbiguityError> for ParsingAmbiguityError
impl PartialEq<ParsingAmbiguityError> for ParsingAmbiguityError
source§fn eq(&self, other: &ParsingAmbiguityError) -> bool
fn eq(&self, other: &ParsingAmbiguityError) -> bool
self
and other
values to be equal, and is used
by ==
.