mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
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:
parent
63988b9103
commit
1748150497
4 changed files with 154 additions and 120 deletions
35
components/selectors/visitor.rs
Normal file
35
components/selectors/visitor.rs
Normal 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
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue