style: Add a Document::elements_with_id API.

MozReview-Commit-ID: BNtbJp0RI68
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
Emilio Cobos Álvarez 2017-10-27 11:45:34 +02:00
parent 3b0940342c
commit 2783297fa9
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
2 changed files with 31 additions and 0 deletions

View file

@ -146,6 +146,17 @@ pub trait TDocument : Sized + Copy + Clone {
/// Returns the quirks mode of this document.
fn quirks_mode(&self) -> QuirksMode;
/// Get a list of elements with a given ID in this document.
///
/// Can return an error to signal that this list is not available, or also
/// return an empty slice.
fn elements_with_id(
&self,
_id: &Atom,
) -> Result<&[<Self::ConcreteNode as TNode>::ConcreteElement], ()> {
Err(())
}
}
/// The `TNode` trait. This is the main generic trait over which the style