C# Class CsQuery.Engine.SelectorEngine

Afficher le fichier Open project: prepare/HTML-Renderer Class Usage Examples

Méthodes publiques

Méthode Description
GetDescendantElements ( IDomObject element ) : IEnumerable
GetDescendantElements ( IEnumerable list ) : IEnumerable

Return all descendants of each element in the list

Select ( IEnumerable context ) : IList

Select implementation. The public method automatically remaps a selector with the knowledge that the context is external (and not part of a chain)

SelectorEngine ( IDomDocument document, CsQuery.Engine.Selector selector ) : System

Méthodes protégées

Méthode Description
GetAdjacentElements ( IEnumerable list ) : IEnumerable
GetAdjacentOrSiblings ( TraversalType traversalType, IEnumerable list ) : IEnumerable

Map a list to its siblings or adjacent elements if needed. Ignore other traversal types.

GetAllChildOrDescendants ( TraversalType traversalType, IEnumerable list ) : IEnumerable

Map a list to its children or descendants, if needed.

GetAllElements ( IEnumerable list ) : IEnumerable
GetChildElements ( IEnumerable list ) : IEnumerable

Return all children of each element in the list

GetMatches ( IEnumerable source, CsQuery.Engine.SelectorClause selector ) : IEnumerable

Return all elements matching a selector, within a list of elements. This function will traverse children, but it is expected that the source list at the current depth (e.g. from an Adjacent or Sibling selector) is already processed.

GetPseudoClassMatches ( IDomElement elm, CsQuery.Engine.SelectorClause selector ) : IEnumerable

Return all child elements matching a DOM-position type selector

GetResultPositionMatches ( IEnumerable list, CsQuery.Engine.SelectorClause selector ) : IEnumerable

Return all position-type matches. These are selectors that are keyed to the position within the selection set itself.

GetSelectionSource ( CsQuery.Engine.SelectorClause clause, IEnumerable context, IEnumerable lastResult ) : IEnumerable

Get the sequence that is the source for the current clause, based on the selector, prior results, and context.

Notes from refactoring this on 10/14/2012: At issue is selectors like ":not(.sel1 .sel2, :first) where the subselector has filters that apply to just the context, versus selectors like ":has(.sel1 .sel2, :first) where the subselector needs to apply to the results of a selection against the DOM case1: $('.sel','.context-sel') means that ".sel" is actually applied against .context-sel. it's like .find. totally different from a subselector -- but the subselector still needs a context to apply filters, even though the selectors theselves are run against the whole doc. so we need to set up selectors before running against the context so each subselector is IDd as either "context" or "root" in addition to its traversal type to eliminate ambiguity of intent. a subselector for :not should have "root+descendant" for the first part and "context+filter" for the 2nd. For regular context type filters, it should be "context+descendant" (same as find). FOr complex context/find filters chained with a comma, the stuff after the comma should also be in context though jquery seems inconsistent with this. This code here should then use the new info to select the correct sleection source. Think we should be rid of traversaltype.subselect. Think traversaltype.all should really mean "include the context items" instead of "Descendant" as it does now.

GetSiblings ( IEnumerable list ) : IEnumerable
GetTraversalTargetElements ( TraversalType traversalType, IEnumerable list ) : IEnumerable
Matches ( CsQuery.Engine.SelectorClause selector, IDomElement obj, int depth ) : bool

Return true if an object matches a specific selector. If the selector has a desecendant or child traversal type, it must also match the specificed depth.

MatchesPseudoClass ( IDomElement element, CsQuery.Engine.SelectorClause selector ) : bool

Return true if an element matches a specific filter.

Private Methods

Méthode Description
EmptyEnumerable ( ) : IEnumerable
GetFeatures ( IDomIndex index ) : DomIndexFeatures

Method Details

GetAdjacentElements() protected méthode

protected GetAdjacentElements ( IEnumerable list ) : IEnumerable
list IEnumerable
Résultat IEnumerable

GetAdjacentOrSiblings() protected méthode

Map a list to its siblings or adjacent elements if needed. Ignore other traversal types.
protected GetAdjacentOrSiblings ( TraversalType traversalType, IEnumerable list ) : IEnumerable
traversalType TraversalType /// The traversal type ///
list IEnumerable /// The source list ///
Résultat IEnumerable

GetAllChildOrDescendants() protected méthode

Map a list to its children or descendants, if needed.
protected GetAllChildOrDescendants ( TraversalType traversalType, IEnumerable list ) : IEnumerable
traversalType TraversalType
list IEnumerable
Résultat IEnumerable

GetAllElements() protected méthode

protected GetAllElements ( IEnumerable list ) : IEnumerable
list IEnumerable
Résultat IEnumerable

GetChildElements() protected méthode

Return all children of each element in the list
protected GetChildElements ( IEnumerable list ) : IEnumerable
list IEnumerable
Résultat IEnumerable

GetDescendantElements() public static méthode

public static GetDescendantElements ( IDomObject element ) : IEnumerable
element IDomObject
Résultat IEnumerable

GetDescendantElements() public static méthode

Return all descendants of each element in the list
public static GetDescendantElements ( IEnumerable list ) : IEnumerable
list IEnumerable
Résultat IEnumerable

GetMatches() protected méthode

Return all elements matching a selector, within a list of elements. This function will traverse children, but it is expected that the source list at the current depth (e.g. from an Adjacent or Sibling selector) is already processed.
protected GetMatches ( IEnumerable source, CsQuery.Engine.SelectorClause selector ) : IEnumerable
source IEnumerable /// The sequence of elements to filter. ///
selector CsQuery.Engine.SelectorClause /// The selector. ///
Résultat IEnumerable

GetPseudoClassMatches() protected méthode

Return all child elements matching a DOM-position type selector
protected GetPseudoClassMatches ( IDomElement elm, CsQuery.Engine.SelectorClause selector ) : IEnumerable
elm IDomElement
selector CsQuery.Engine.SelectorClause
Résultat IEnumerable

GetResultPositionMatches() protected méthode

Return all position-type matches. These are selectors that are keyed to the position within the selection set itself.
protected GetResultPositionMatches ( IEnumerable list, CsQuery.Engine.SelectorClause selector ) : IEnumerable
list IEnumerable /// The list of elements to filter ///
selector CsQuery.Engine.SelectorClause /// The selector ///
Résultat IEnumerable

GetSelectionSource() protected méthode

Get the sequence that is the source for the current clause, based on the selector, prior results, and context.
Notes from refactoring this on 10/14/2012: At issue is selectors like ":not(.sel1 .sel2, :first) where the subselector has filters that apply to just the context, versus selectors like ":has(.sel1 .sel2, :first) where the subselector needs to apply to the results of a selection against the DOM case1: $('.sel','.context-sel') means that ".sel" is actually applied against .context-sel. it's like .find. totally different from a subselector -- but the subselector still needs a context to apply filters, even though the selectors theselves are run against the whole doc. so we need to set up selectors before running against the context so each subselector is IDd as either "context" or "root" in addition to its traversal type to eliminate ambiguity of intent. a subselector for :not should have "root+descendant" for the first part and "context+filter" for the 2nd. For regular context type filters, it should be "context+descendant" (same as find). FOr complex context/find filters chained with a comma, the stuff after the comma should also be in context though jquery seems inconsistent with this. This code here should then use the new info to select the correct sleection source. Think we should be rid of traversaltype.subselect. Think traversaltype.all should really mean "include the context items" instead of "Descendant" as it does now.
protected GetSelectionSource ( CsQuery.Engine.SelectorClause clause, IEnumerable context, IEnumerable lastResult ) : IEnumerable
clause CsQuery.Engine.SelectorClause /// The current selector clause. ///
context IEnumerable /// The context passed initially to this Select operation. ///
lastResult IEnumerable /// The result of the prior clause. Can be null. ///
Résultat IEnumerable

GetSiblings() protected méthode

protected GetSiblings ( IEnumerable list ) : IEnumerable
list IEnumerable
Résultat IEnumerable

GetTraversalTargetElements() protected méthode

protected GetTraversalTargetElements ( TraversalType traversalType, IEnumerable list ) : IEnumerable
traversalType TraversalType
list IEnumerable
Résultat IEnumerable

Matches() protected méthode

Return true if an object matches a specific selector. If the selector has a desecendant or child traversal type, it must also match the specificed depth.
protected Matches ( CsQuery.Engine.SelectorClause selector, IDomElement obj, int depth ) : bool
selector CsQuery.Engine.SelectorClause The jQuery/CSS selector
obj IDomElement The target object
depth int The depth at which the target must appear for descendant or child selectors
Résultat bool

MatchesPseudoClass() protected méthode

Return true if an element matches a specific filter.
protected MatchesPseudoClass ( IDomElement element, CsQuery.Engine.SelectorClause selector ) : bool
element IDomElement /// The element to test ///
selector CsQuery.Engine.SelectorClause /// A selector clause ///
Résultat bool

Select() public méthode

Select implementation. The public method automatically remaps a selector with the knowledge that the context is external (and not part of a chain)
/// Thrown when one or more required arguments are null. ///
public Select ( IEnumerable context ) : IList
context IEnumerable /// The context in which the selector applies. If null, the selector is run against the entire /// Document. If not, the selector is run against this sequence of elements. ///
Résultat IList

SelectorEngine() public méthode

public SelectorEngine ( IDomDocument document, CsQuery.Engine.Selector selector ) : System
document IDomDocument
selector CsQuery.Engine.Selector
Résultat System