C# Класс CsQuery.Engine.SelectorEngine

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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

Защищенные методы

Метод Описание
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.

Приватные методы

Метод Описание
EmptyEnumerable ( ) : IEnumerable
GetFeatures ( IDomIndex index ) : DomIndexFeatures

Описание методов

GetAdjacentElements() защищенный Метод

protected GetAdjacentElements ( IEnumerable list ) : IEnumerable
list IEnumerable
Результат IEnumerable

GetAdjacentOrSiblings() защищенный Метод

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 ///
Результат IEnumerable

GetAllChildOrDescendants() защищенный Метод

Map a list to its children or descendants, if needed.
protected GetAllChildOrDescendants ( TraversalType traversalType, IEnumerable list ) : IEnumerable
traversalType TraversalType
list IEnumerable
Результат IEnumerable

GetAllElements() защищенный Метод

protected GetAllElements ( IEnumerable list ) : IEnumerable
list IEnumerable
Результат IEnumerable

GetChildElements() защищенный Метод

Return all children of each element in the list
protected GetChildElements ( IEnumerable list ) : IEnumerable
list IEnumerable
Результат IEnumerable

GetDescendantElements() публичный статический Метод

public static GetDescendantElements ( IDomObject element ) : IEnumerable
element IDomObject
Результат IEnumerable

GetDescendantElements() публичный статический Метод

Return all descendants of each element in the list
public static GetDescendantElements ( IEnumerable list ) : IEnumerable
list IEnumerable
Результат IEnumerable

GetMatches() защищенный Метод

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. ///
Результат IEnumerable

GetPseudoClassMatches() защищенный Метод

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
Результат IEnumerable

GetResultPositionMatches() защищенный Метод

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 ///
Результат IEnumerable

GetSelectionSource() защищенный Метод

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. ///
Результат IEnumerable

GetSiblings() защищенный Метод

protected GetSiblings ( IEnumerable list ) : IEnumerable
list IEnumerable
Результат IEnumerable

GetTraversalTargetElements() защищенный Метод

protected GetTraversalTargetElements ( TraversalType traversalType, IEnumerable list ) : IEnumerable
traversalType TraversalType
list IEnumerable
Результат IEnumerable

Matches() защищенный Метод

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
Результат bool

MatchesPseudoClass() защищенный Метод

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 ///
Результат bool

Select() публичный Метод

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. ///
Результат IList

SelectorEngine() публичный Метод

public SelectorEngine ( IDomDocument document, CsQuery.Engine.Selector selector ) : System
document IDomDocument
selector CsQuery.Engine.Selector
Результат System