selectors: Remove custom attribute-affecting logic and sibling-affecting logic from rust-selectors.

MozReview-Commit-ID: BjZY6TjJbcb
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
Emilio Cobos Álvarez 2017-04-07 01:37:55 +02:00
parent 63988b9103
commit 1748150497
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
4 changed files with 154 additions and 120 deletions

View file

@ -0,0 +1,35 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! Visitor traits for selectors.
#![deny(missing_docs)]
use parser::{AttrSelector, ComplexSelector, SelectorImpl, SimpleSelector};
/// A trait to visit selector properties.
///
/// All the `visit_foo` methods return a boolean indicating whether the
/// traversal should continue or not.
pub trait SelectorVisitor {
/// The selector implementation this visitor wants to visit.
type Impl: SelectorImpl;
/// Visit an attribute selector that may match (there are other selectors
/// that may never match, like those containing whitespace or the empty
/// string).
fn visit_attribute_selector(&mut self, _: &AttrSelector<Self::Impl>) -> bool {
true
}
/// Visits a complex selector.
fn visit_complex_selector(&mut self, _: &ComplexSelector<Self::Impl>) -> bool {
true
}
/// Visits a simple selector.
fn visit_simple_selector(&mut self, _: &SimpleSelector<Self::Impl>) -> bool {
true
}
}