Giter VIP home page Giter VIP logo

fizzler's Introduction

Fizzler: .NET CSS Selector Engine

A .NET library to select items from a node tree based on a CSS selector. The default implementation is based on HTMLAgilityPack and selects from HTML documents. There over 140 unit tests - see below for more information. The tests are based on the jQuery selector engine tests.

Fizzler supports .NET 2.0, 3.0, 3.5 and Mono.

Contributions are welcome in forms of:

  • Increased selector support
  • Implementation over an HTML-like hierarchical document model
  • Re-factorings
  • Improved tests

Examples

// Load the document using HTMLAgilityPack as normal
var html = new HtmlDocument();
html.LoadHtml(@"
  <html>
      <head></head>
      <body>
        <div>
          <p class='content'>Fizzler</p>
          <p>CSS Selector Engine</p></div>
      </body>
  </html>");

// Fizzler for HtmlAgilityPack is implemented as the 
// QuerySelectorAll extension method on HtmlNode

var document = html.DocumentNode;

// yields: [<p class="content">Fizzler</p>]
document.QuerySelectorAll(".content"); 

// yields: [<p class="content">Fizzler</p>,<p>CSS Selector Engine</p>]
document.QuerySelectorAll("p");

// yields empty sequence
document.QuerySelectorAll("body>p");

// yields [<p class="content">Fizzler</p>,<p>CSS Selector Engine</p>]
document.QuerySelectorAll("body p");

// yields [<p class="content">Fizzler</p>]
document.QuerySelectorAll("p:first-child");

Test Overview

View them here (Fizzler.Tests):

  • With_Non_Existant_ID_Descendant
  • With_Non_Existant_ID_Ancestor
  • With_Existing_ID_Descendant
  • With_Element
  • With_Element
  • Star_Prefix_With_Digit
  • Star_NthChild
  • Star
  • Single_Tag_Name_Matching_Multiple_Elements
  • Single_Tag_Name
  • Single
  • Parent_Class_Selector
  • Only_Child
  • NthChild_No_Prefix
  • Not_A_Child_ID
  • No_Prefix_With_Digit
  • Last_Child
  • First_Child
  • Empty
  • Element_Prefix_With_Digit
  • Element_NthChild
  • Element_Attr_Space_Separated_With_Double_Quotes
  • Element_Attr_Space_Separated
  • Element_Attr_Hyphen_Separated_With_Double_Quotes
  • Element_Attr_Hyphen_Separated
  • Element_Attr_Exists
  • Element_Attr_Exists
  • Element_Attr_Equals_With_Double_Quotes
  • Element_Attr_Equals
  • Descendant
  • CommaSupport_With_Pre_Post_Pended_Space
  • CommaSupport_With_Pre_Pended_Space
  • CommaSupport_With_Post_Pended_Space
  • CommaSupport_With_No_Space
  • Comma_Child_And_Adjacent
  • Child_With_Spaces
  • Child_With_Pre_Space
  • Child_With_Pre_And_Post_Space
  • Child_With_Post_Space
  • Child_With_No_Space
  • Child_With_Class
  • Child_No_Spaces
  • Child_ID
  • Chained
  • Basic_Selector
  • Basic_Positive_Precedence_With_Same_Tags
  • Basic_Positive_Precedence_Two_Tags
  • Basic_Positive_Precedence_Three_Tags
  • Basic_Negative_Precedence
  • Basic
  • All_GrandChildren
  • All_Descendants_Of_ID
  • All_Children_of_ID_with_no_children
  • All_Children_Of_ID
  • All_Children
  • Adjacent_With_Pre_Space
  • Adjacent_With_Pre_And_Post_Space
  • Adjacent_With_Post_Space
  • Adjacent_With_No_Space
  • Adj_Spaces
  • Adj_No_Spaces

fizzler's People

Contributors

atifaziz avatar colinramsay avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.