Coder Social home page Coder Social logo

jamietre / csquery Goto Github PK

View Code? Open in Web Editor NEW
1.2K 117.0 255.0 61.15 MB

CsQuery is a complete CSS selector engine, HTML parser, and jQuery port for C# and .NET 4.

License: Other

C# 21.50% ASP 0.01% JavaScript 0.01% PowerShell 0.01% Batchfile 0.01% HTML 78.47%

csquery's Introduction

DocumentUp

Not Actively Maintained

Note from the author: CsQuery is not being actively maintained. I no longer use it in my day-to-day work, and indeed don't even work in .NET much these day! Therefore it is difficult for me to spend any time addressing problems or questions. If you post issues, I may not be able to respond to them, and it's very unlikely I will be able to make bug fixes.

While the current release on NuGet (1.3.4) is stable, there are a couple known bugs (see issues) and there are many changes since the last release in the repository. However, I am not going to publish any more official releases, since I don't have time to validate the current code base and address the known issues, or support any unforseen problems that may arise from a new release.

I would welcome any community involvement in making this project active again. If you use CsQuery and are interested in being a collaborator on the project please contact me directly.

You should also consider using AngleSharp, which is a newer project that is being actively maintained. It's not a drop in replacement, but provides similar capabilities.

CsQuery - .C# jQuery Port for .NET 4

CsQuery is a jQuery port for .NET 4. It implements all CSS2 & CSS3 selectors, all the DOM manipulation methods of jQuery, and some of the utility methods. The majority of the jQuery test suite (as of 1.6.2) has been ported to C#.

Why CsQuery?

CSS selectors and jQuery make it really easy to access and manipulate HTML on the client. There's no reason it should be any more difficult to do the same thing with some arbitrary HTML on the server. It's a simple as that. Use it in web projects to do post-processing on HTML pages before they're served, for web scraping, parsing templates, and more.

Standards Compliant HTML parsing

CsQuery uses a C# port of the validator.nu HTML parser. This is the same code used in the Gecko browser engine. CsQuery will create an identical DOM from the same source as any Gecko-based browser. You should expect excellent results for handling both valid and invalid markup.

CSS3 Selectors and jQuery methods

CsQuery implements all CSS2 and CSS3 selectors and filters, and a comprehensive DOM model. You can use all the same jQuery (and DOM element) methods you're familiar with to traverse and manipulate the DOM.

Fast, indexed CSS selectors

The CSS selector engine fully indexes each document on tag name, id, class, and attribute. The index is subselect-capable, meaning that complex selectors will still be able to take advantage of the index (for any part of the selector that's indexed). Performance of selectors compared to other existing C# HTML parsing libraries is orders of magnitude faster.

What's more, the entire test suite from Sizzle (the jQuery CSS selector engine) and jQuery (1.6.2) has been ported from Javascript to C# to cover this project.

It's incredibly easy

Pretty much everything you need is in the CQ object, which is designed to work like a jQuery object. Assigning a string to a CQ object parses it. The property indexer ['...'] runs a CSS selector, and returns new CQ object, like $('...') using jQuery. Finally, the Render method writes the DOM back to a string. From a CQ object, you have access to the complete jQuery API to traverse and manipulate your document, as well as an extensive browser DOM model.

Here's a basic example of parsing HTML, selecting something, altering it, and rendering it back to a string.

CQ dom = "<div>Hello world! <b>I am feeling bold!</b> What about <b>you?</b></div>";


CQ bold = dom["b"];               /// find all "b" nodes (there are two in this example)

  > bold.ToList()
  > Count = 2
  > [0]: {<b>...</b>}
  > [1]: {<b>...</b>}

  > bold.First().RenderSelection()
  > "<b>I am feeling bold!</b>"
   
string boldText = bold.Text();        /// jQuery text method;

  > boldText
  > "I am feeling bold! you?"

bold.Remove();                        /// jQuery Remove method

string html = dom.Render();           

  > html
  > "<div>Hello world!  What about </div>"

There are other ways to create CQ objects, run selectors, and change the DOM. You can also use the property indexer like an array indexer, e.g. dom[0] returns the first element in your selection. If there is one, that is! Using the LINQ method dom.FirstOrDefault() might be a better choice for many situations. In javascript, you'd often test the Length property of a selection to see if there were any results. The CQ object exposes an IEnumerable<IDomObject> interface, so you can use LINQ to simplify many operations. But you still have all the tools that you're used to from jQuery, too.

Like in jQuery, each CQ object is made up of DOM elements. In CsQuery, the basic node is an IDomObject and is analagous to an HTML element or other node (like a text node or comment node). Most of the typical HTML element methods are available. So, using these alternatives, to obtain only the first bolded item from the example above:

use CSS to choose first node only

string bold = dom["div > b:first-child"].Text();

use jQuery CSS filter extensions to return the first item in the selection

string bold = dom["b:first"].Text();

use LINQ First to get the first item, and the DOM node "InnerText" method

string bold = dom["b"].First().InnerText;

use indexer to get the first item, and "Select" instead of the indexer to make it more readable

string bold = dom.Select("b")[0].InnerText;

Use jQuery "contents" method to return the text node children, the indexer to get the first, and the DOM node "nodeValue" method to get the contents of a text node

string bold = dom["b"].Contents()[0].NodeValue

Each of these returns the same thing: "I am feeling bold!"

Installation

Latest release: Version 1.3.4 (February 5, 2013)

To install the latest release from NuGet package manager:

PM> Install-Package CsQuery

To install manually, add a reference to CsQuery.DLL. There are no external dependencies.

Compiling from Source

This repository contains a submodule for HtmlParserSharp. This configuration has been chosen to allow the HTML parser project to be completely independent of CsQuery, while still allowing CsQuery to include it directly and compile to a single DLL.

To clone the repostory with the submodule, you need to take an extra step. First create a clone as usual:

git clone https://github.com/jamietre/CsQuery.git csquery

Next change to the repo folder, and initialize and clone the submodule.

cd csquery
git submodule update --init -f

You should be able to compile everything now. If you have any trouble initializing the submodule, just delete the submodule folder ../source/CsQuery/HtmlParserSharp and run the submodule init command again.

Release Notes

The current release is 1.3.4. This is a bug fix release:

  • Handle out-of-bounds character set changes
  • Allow changing character set via meta tag outside of HEAD
  • Allow non-alpha ID selectors

See the change log for details.

The last major release is 1.3.0. This release implements a new HTML5-compliant parser.

Documentation

Documentation is being moved from here to the documentation folder in the repository. There is detailed documentation for these topics:

  • Create: Creating a new DOM from HTML in memory, a file, a stream, or a URL
  • Render: Rendering your DOM back to HTML
  • CreateFromUrl: Creating CsQuery objects from a remote source
  • Promises: An overview of the CsQuery Promise API, which is useful for managing asynchronous events. This is useful when loading content from remote URLs without blocking execution while you're waiting for the response.
  • How CsQuery handles character set encoding: Explanation of the different ways a character set encoding can be specified in an HTML document, and how CsQuery detects and prioritizes them.

Everything else will be found here in the readme. It covers most common uses for reading HTML documents from files and URLS, and using it like jQuery.

I also post about CsQuery on my blog from time to time. Here are a few tutorials from there:

For methods ported from the jQuery API, in almost all cases it will function exactly as it does in jQuery. There are exceptions related to differences in the languages, but this should generally be obvious. You can also look through the unit tests, which cover pretty much everything at some level, for straightforward examples of use.

Also be sure to look at the example applications under CsQuery.Examples.

Contents

Roadmap

As of 6/12/2012, all CSS3 selectors that don't depend on browser state have been implemented, and all jQuery DOM selection/manipulation methods have been implemented. See shortcomings for the specific exceptions.

The priorities for the future are, in this order:

  • Writing documentation; and establishing a web site for the project.
  • Implement style sheet parser and API, which will allow complete programmatic access to styles (beyond those on the style attribute) and access to computed styles
  • Flesh out the DOM model (properties/methods of specific element types) according to HTML5 specs. (You can always access any attribute you want just as an attribute with a string value. This has to do with the actual implementation of specific DOM element interfaces, as you would access element properties in a browser DOM).
  • Implement CSS4 selectors

If you are interested in this project and want to contribute anything, let me know or just make a pull request!

Usage

Creating a new DOM

Complete documentation: Create method

Create from a string of HTML, a TextReader, a Stream, or an existing CQ object or DOM elements

var dom = CQ.Create(html);   

Create from a URL (synchronously)

var dom = CQ.CreateFromUrl("http://www.jquery.com");

There are many other methods and options for creating a DOM from local sources, and from the web asynchronously.

Create from a URL (asynchronously)

IPromise promise = CQ.CreateFromUrl("http://www.jquery.com");

CQ.CreateFromUrl("http://www.jquery.com", successDelegate, failureDelegate);

The first method is preferred and returns an IPromise object, which can be used to manage resolution of deferred events without blocking the code flow. See Promises documentation for details.

Output as HTML

Complete documentation: Render method

Render the entire DOM

string html = dom.Render();

You can render any DOM element individually

string elementHtml = dom[2].Render();

You can render just the elements that are part of the selection

string selectionHtml = dom[".just-this-class"].RenderSelection();
Manipulate the DOM with jQuery methods
dom.Select("div > span")
	.Eq(1)
	.Text("Change the text content of the 2nd span child of each div");

The default property indexer is equivalent to "Select"

var rowsWithClass = dom[".targetClass"].Closest("td");

Use Find (like in jQuery) to access only child elements of a selection:

// get all elements that are first children within 'body' (e.g. excluding 'head')

var childSpans = dom["body"].Find(":first-child");

Most methods are flexible with the kind of input they take to try to work as intutitively as they do in jQuery. Three ways to do the same thing:

rowsWithClass.AddClass("highlighted")
    .CssSet(new {
            width="100px",
            height=20
        });


rowsWithClass.CssSet("{ width: 100px; height: 20px; }");

rowsWithClass.Css("width",100).Css("height","20px");

See below "C# objects vs. jQuery objects" for an explanation of CssSet vs. Css.

Data will create "data-xxx" attributes that can be directly read by the jQuery data method

Contact contact = GetContactInfo();

var newRow = rowsWithClass
	.Clone()
	.Data("address",contact);

rowsWithClass.Before(newRow);
Accessing DOM elements directly
var sel = dom.Select("a");

The property indexer is overloaded as a simple list element indexer returning the DOM element at that position, just like $(...)[n].

IDomObject element = dom[0];
string id = element.Id;
string classes = element.ClassName;

The property indexer for IDomObject returns attributes

string href = dom[0]["href"];

Most DOM node methods are implemented too. These are equivalent.

string html = Dom["#my-link"].Html();

string html = Dom.Document.GetElementById("my-link").InnerHTML;

Some utility methods return nodes, same as jQuery

dom.Each((i,e) => {
    if (e.Id == "remove-this-id") {
        e.Parent().RemoveChild(e);
    }
});

CsQuery vs. jQuery

The primary goal of this project was to make it as familiar and portable as possible. There are some differences in usage that were necessary because of differences in strong typing and overloading in C#. This section covers what you need to know to get going with CsQuery. Everything else should work more or less the same as jQuery.

Creating a new DOM

Static methods are used to create a new DOM from an html string, a sequence of IDomObject elements, or another CQ object.

CQ.Create(..)           // Create content. Missing tags will be generated, except for BODY and HTML
CQ.CreateDocument(..)   // Create a document. Missing tags will be generated according to HTML5 specs; e.g, if there is no HTML or BODY tag, they will be created.
CQ.CreateFragment(..)   // Create a fragment. No missing tag parsing will be done.

You don't need to do this in a browser. The "document" is already there. You can, however, create new fragments in jQuery:

var frag = $('<div>This is a div</div'). 

There's not really a distinction between a true Document and a fragment in CsQuery; there's no actual browser involved, it's just a node tree.

This doesn't mean that every CQ instance referes to its own DOM. Quite the opposite, the CQ object returned from most methods will be bound to the same DOM as it's parent. For example:

CQ dom = CQ.Create(someHtml);
CQ divs = dom.Select("div");
divs.Empty();

this is about the same as:

var dom = $(document);
var divs = $("div");
divs.empty();

Just like jQuery, some methods return a new instance of CQ, typically, when that method results in a different selection set. Other methods return the same instance. But either way, they are bound to the same DOM. The rules for whether a new instance is returned, or the existing one is altered, are the same as for each method in jQuery.

C# objects vs. Javascript objects

The object in Javascript is a fundamental language construct; it's amorphous, nonstatic nature and simple syntax makes it useful for lots of purposes. Some jQuery methods accept objects as a convenient way to define data structures.

CsQuery uses reflection to allow C# objects in most of the same situations. It usually also will allow you to pass a string of JSON when an object structure would be expected, providing more syntax portability with Javascript (though you'lll have to use quotes in C#, of course). For example:

var anchor = dom["a"].Eq(0);

div.AttrSet(new {
            href="http://www.jquery.com",
            target="_blank"
        })
   .Text("Go to jQuery.com!");

Alternatively:

dynamic props = new ExpandoObject();
props.href="http://www.jquery.com";
props.target="_blank";

div.AttrSet(props).Text("Go to jQuery.com!");

Using the Quick Setter syntax (which is sort of minimally documented by jQuery):

div.AttrSet(new { 
            css = new { 
                href="http://www.jquery.com",
                target="_blank"
            },
            text = "Go to jQuery.com!"
        });

Using JSON:

 div.AttrSet("{ css: { 
                href: 'http://www.jquery.com',
                target: '_blank'
            },
            text: 'Go to jQuery.com!'
        }");

There are a couple things to note here.

  1. The method AttrSet. This is a special case where overloading didn't work out very well in C#. The basic "get attribute" method:

    public string Attr(string)

conflicts with the signature for a general-purpose set method:

public CQ Attr(object map)

I chose this convention to resolve the conflict for Css and Attr setting methods.

  1. The JSON string permits apostrophes in addition to quotes as a legal bounding character. While this makes it not legal JSON, it is much more convenient because you must use double-quotes to bound the string in C#.
Important nonstandard methods

CsQuery adds methods to return its contents (either the full DOM, or just the selection) as a string:

Render()              Output the entire DOM as an html string

RenderSelection()     Output only the selection set as an html string

CsQuery contains a number of methods that are specific to its language implementation.

Elements              Only the element results of the selection.
New()                 Create a new, empty CQ object bound to the parent's DOM
EnsureCsQuery(obj)    Return either obj, or a new CsQuery object based on obj (if a sequence of elements)

Elements is important because of strong typing in C# vs. Javascript. The default enumerator exposes interface IDomObject, an interface common to all node types. As such it has very few standard DOM node methods. Most of the time, you only care about element nodes; this method provides the results in that cast.

Another thing that you do a lot in jQuery is this:

var jqObject = $(domElement);

That is, you wrap a single DOM element in a jQuery object so you can use jQuery methods to manipulate it. The CsQuery way to do this is create a new CQ object, and pass in the element in the constructor:

var csqObject = new CQ(domElement);

There is also a shortcut:

var csqObject = domElement.Cq();

For example:

bool visible = domElement.Cq().Is(":visible");

These both produce the same result: A CQ object bound to the with domElement as the selection.

Note that this is not the same as the very similar-looking Create method:

var csqObject = CQ.Create(domElement);   // probably not what you want!!

The Create methods always create a new DOM. Calling the method above would result in a brand-new DOM with a single element. It's not bound to your original DOM any more; in fact, the element it contains is a clone of your original domElement.

Utility Methods
Map(..)                You probably don't need this because you can use LINQ
Extend(..)             Return an expando object composed of properties from the source objects
ParseJSON(..)          Return an expando object from JSON string
ParseJSON<T>(..)       Return a strongly-typed object from JSON string
ToJSON(..)             Return a json string from an object

These methods' purposes are straightforward.

Extend tries to do a lot, allowing you to merge POCO and expando objects with properties of arbitrary types. It may not work in all situations, specifically, those involving deep-copying of list or enumerable types. This is a huge can of worms, and there are definitely some untested areas.

Ideally, I will just replace the implementation with some other library that does a great job of complex type mapping. For the time being, though, it works well in most common situations and is useful for dealing with abitrary objects of the sort you get from a javascript application.

The JSON handling uses the .NET framework JavaScriptSerializer along with some postprocessing to normalize object structures when returning expando objects. It also has some special treatment for dictionaries when serializing - that is, they are converted to objects (as if they were expando objects) rather than key/value arrays. This also works well enough but, again, would ideally be addressed using a more robust JSON parser.

Options

Rendering options

There are a few options that affect HTML rendering. These are set on the Document property of a CQ object. The static property

public static DomRenderingOptions CQ.DefaultDomRenderingOptions

defines default options set for each new CQ instance created. You can assign them to any object after creation. The options are all boolean flags and can be combined.

var dom = CQ.Create(html);
dom.Document.DomRenderingOptions = DomRenderingOptions.RemoveComments 
    | DomRenderingOptions.QuoteAllAttributes;

There options available are below. The default options are QuoteAllAttributes only.

RemoveMismatchedCloseTags

When the HTML parser finds closing element tags that it cannot match to an element, this option causes them to be ignored. Otherwise, they will be rendered as-is, often resulting in the display of text that looks like an HTML tag, depending on the browser. This option is generally not safe, since it will basically make a decision about how to handle bad HTML that should probably be left up to the browser. It will, however, result in only valid HTML being produced by CsQuery regardless of input.

RemoveComments

HTML comments are stripped from the output.

 QuoteAllAttributes

HTML attributes (except those that are boolean properties, such as "checked") will quoted no matter what. When this is false, CsQuery will determine if an attribute value can be safely included without quotes. If so, no quotes will be used around the attribute value.

When true, quotes are always used. Double-quotes are used by default, unless the content can be safely quoted without escaping using single-quotes but not using double-quotes. If escaping is required either way, double-quotes are also used.

HTTP request options

You can also pass options when making requests from remote servers. The global defaults are found in

public static ServerConfig DefaultServerConfig

At this point there are only two options, but this will surely expand in the future as this functionality is more fully developed.

int Timeout

A time (in milliseconds) after which the request should fail if it has not resolved. Default is 10000 (10 seconds).

string UserAgent

The user agent string that should be reported to the remote server.

The basics of the CsQuery object model

This section is still very much a work in progress, but if you are familiar with jQuery, using CsQuery should feel very familiar.

Overview

The CQ object is the jQuery object. In inherits a single interface:

public partial class CQ : IEnumerable<IDomObject>

IDomObject represents a DOM node (element or text), the same as a single item in a jQuery selection set.

The base method of CQ is Select. Given a CQ instance dom:

dom.Select("div")  <===>  $('div')

The CQ object, in addition to the familiar jQuery methods, uses the default property indexer for several purposes.

Selectors: since there's no such thing as a default method in C#, we use the indexer to provide similar functionality.

dom["div"]  <===>  $('div')

Indexed access: jQuery objects are also array-like. So we expose the property indexer on CQ objects to provide indexed access to the results of a selection:

dom["div"][0]  <===>  dom.Select("div")[0]  <===>  $('div')[0]

Remember, though, that the only interface that CQ implements is IEnumerable<IDomObject>. The indexed access is just a property on the object; it doesn't use a standard interface such as IList. The .NET 4 framework doesn't include a IReadOnlyList<T> interface, and I didn't want to use the regular IList because it permits destructive actions.

DOM Creation: Same as jQuery. If you pass what appears to be HTML to the indexer (or the Select method), it will return a new CQ object built from that HTML string:

dom["<div></div>"]  <===> $('<div></div>')

Selection set creation: Same as jQuery, you can build a selection set directly from another CsQuery object, or DOM elements.

var copyOfDom2 = dom[dom2] <===> var copyOfDom2 = $(dom2);

var firstElementOfDom2 = dom[dom2[0]] <===> var firstElementOfDom2 = $(dom2[0]);
Creating a CQ object from HTML

The Create method works like the default $ method.

// get a new jQuery/CsQuery object representing the DOM
var dom = $(document);
--
CQ dom = CQ.Create(htmlString);

// create a new div element with some attributes using quickset

var dom = $("<div />",{ 
    css: { 
        width: 500, height: 20
    },
    text: "My new div"
});
---
var dom = CQ.Create("<div />",new { 
    css: new { 
        width: 500, height: 20
    },
    text: "My new div"
});

Static methods work like utility methods in jQuery:

var obj = $.parseJSON('{ "key": "value" }');
--
dynamic obj = CQ.parseJSON("{ \"key\": \"value\" }");

There's also a CQ.toJSON method (unlike jQuery) that converst objects to JSON.

The DOM (Document Object Model)

Caveats

As I mentioned above, there are still some rough spots in the DOM model. This API may change slightly before the first formal release of CsQuery. However, any changes will almost certainly make it a more (not less) accurate representation of the true browser DOM model.

Additionally, even though I am using interfaces to represent the DOM model, you are not free to substitute something else that implements this interface, or internal indexing operations will fail. The There are probably not many reasons why you would need to substitute implementations for the DOM entites without simply replacing the whole model, though.

Finally, though it is safe to create new instances of DOM elements using new, there aren't really good reasons to do so. Rather, just use Document.CreateElement as if this were the browser DOM, or CQ.Create to create new nodes. This ensures that they are configured correctly with required data.

I intend to clean up both of these situations. The breaking use of interfaces is only designed to hide indexing methods from clients but is not necessary. The elements just need constructors to ensure that they can't be created in a broken state.

Overview

CsQuery is built around an object model that mostly mimics the browser DOM. Every element in this model implements the most basic interface, IDomNode. The basic heirarchy looks like this:

Note: As of 7/2012 this is outdated. There are derived types for specific HTML elements that inherit DomElement now.

IDomNode
    IDomObject
        IDomContainer                          	A node which has children
            IDomElement: IDomIndexedNode       	An element node
        	IDomDocument                        The root node for a DOM (the Document)
        
        IDomText								A text node
			IDomInvalidElement				    A text node which is also invalid HTML
        
		IDomInnerText*							A special text node for handling raw text
		
		IDomSpecialElement                      Node types that contain non-attribute data inside the tag itself
            IDomDocumentType                    the DOCTYPE node
		    IDomComment                         A comment node
			IDomCData                           a CDATA node

   	IDomIndexedNode                           	A node which must be indexed

INodeList                            			A list of nodes, e.g. element.Children

ICssStyleDeclaration                            Style property for an element node
  • may be deprecated

You will notice that there's no attribute node. Attributes are managed using a string dictionary. I might try to make this more consistent with the DOM model, but there will likely be a substantial performance hit to the HTML parser in order to implementing attributes as an object. I don't have a compelling reason, other than purity, to do so at this point.

Methods from CsQuery return either IDomElement sequences or IDomObject sequences. In Javascript, the distinction between text nodes and element nodes is not important for the most part when dealing with jQuery output. Most methods return only element nodes, unless you've specifically asked for text nodes. However, if we used this approach with CsQuery, you would have to deal the more general interface of IDomObject all the time, when you really want to be dealing with IDomElement most of the time.

To deal with this in a way that is the lease obtrusive, I decided to expose many methods that really only apply to IDomElement on IDomObject. This is pretty much how you think when working in javascript, anyway, since there is no type checking. This can result in exceptions if you try to operate on a text node as if it were an element. To help with this, CsQuery includs an Elements property that returns only elements. If you are unsure if a particular selector could return text nodes, use Elements to filter the results first (and cast them correctly). There

Referencing the "document" equivalent or DOM

he Document property of a CQ object represents the DOM. This is an object of type DomDocument. When you use a method that returns a new instance of CQ, its Document refers to the same actual object as the original. Using destructive methods will affect any CQ objects that are based on the same DOM.

(More to come)

Performance

Selecting "div span" from the HTML5 spec (a 6 megabyte HTML file) is about 500 hundred times faster than HtmlAgilityPack + Fizzler. Simple selectors on medium to large documents can be hundreds or thousands of times faster -- the larger the document, the bigger the difference, since HAP must scan the entire tree for each selector.

CsQuery takes a bit longer to parse the HTML in the first place (which is not unexpected, since it's building an index of everything at the same time). Without fizzler, the test case against the 6 megabyte HTML spec using a multipart XML selector with just HAP is unworkably slow so I haven't included that comparison. This blog post shows the results of some performance comparsions. You can run the performance tests yourself from the CsQuery.PerformanceTests project.

Internally, tags, class, and attribute names are indexed using a subselect-capable index, meaning that unlike jQuery, even complex selectors still benefit from the index.

Features

CsQuery is a .NET 4 library that provides an implementation of the jQuery API and a document object model that simulates the browser DOM. It includes a complete HTML5 parser.

All jQuery DOM manipulation methods have been implemented, and some utility methods like Extend and ToJSON have been implemented as well. It also includes other methods that are specific to CsQuery's server-based implementation for loading content from remote URLs and parsing HTTP POST data.

All CSS2 & CSS3 selectors have been implemented:

*       			Universal selector
TAG      			element type selector
.class   			class name selector
#id      			id selector
[attr]				Attribute selector, with all matchers:
					CSS2: = | |= | ~=
                	CSS3: ^= | $= ^ *=
                	jQuery: !=

E, F#id				Selector grouping
E F           		Descendant selector
E>F					Child selector
E+F					Adjacent sibling selector
E~F					General sibling selector

All pseudoclasses that do not depend on browser state except "lang" are implemented:

:first-child				:last-child					
:first-of-type				:last-of-type				
:only-child					:only-of-type					
:nth-child(N)				:nth-of-type(N)
:nth-last-child(N)			:nth-last-of-type(N)
:enabled					:disabled
:empty						:checked
:root						:not(S)

jQuery extensions:

:first						:last
:odd						:even
:eq(N)						:gt(N)
:lt(N)						:parent
:visible					:hidden
:radio						:button
:file						:text
:image						:reset
:submit						:password
:selected					:contains(T)
:has(S)						:input
Shortcomings

The DOM model is not perfect. Mimicing the browser DOM would sacrifice the benefits of strong typing; I opted for a compromise that exposes some nonapplicable members on all node types. This probably could use some refactoring at this point, but it's perfectly workable.

There are some minor API issues that need resolving. The DOM model has a few problem areas. Specifically, document fragments are not represented correctly, and it uses internal methods which means you can't substitute things that implement the same interface.

In the early stages of this project I had not much time to get it working "well enough" to solve a particular problem.That resulted in a bit of regrettable code that needs cleaning up and some weak areas of test coverage. On the other hand, the nice thing about porting something is that you don't need to start from scratch with unit tests. The jQuery tests have the benefit of covering a lot of edge cases discovered over the years, but have the disavantage of being a bit messy and disorganized. Not that my own are a lot better! But as time permits I have been cleaning up and adding to the tests. While I think this project has pretty good test coverage for the vast majority of its features (selectors and DOM manipulation methods) some of the more complex features like Extend -- which, in particular, is difficult to test well - are not well covered.

Missing CSS selectors

Some parts of the CSS3 specification have not been implemented; in each case it's because the selector doesn't make sense without a browser UI context. The only exception is

:lang(C)

"lang" may eventually be added, but it's unique in that it depends on environmental information in the browser. I am not planning to implement it at this time. You can still use the attribute selector to target nodes specifically identified with the "lang" attribute, e.g. [lang|='en'] which would match "en-uk" and "en-us", for example. It will only return nodes that actually have the attribute, though, and not nodes that inherit it. In the correct browser implementation of lang(C), every otherwise unmarked node would be returned for the default langauge of the document.

Complete list of other unimplemented pseudoselectors:

UI related

:link    
:hover
:active
:focus
:visited
:target

Pseudo-elements

:first-letter (pseudoelement)
:first-line (pseudoelement)
:before (pseudoelement)
:after (pseudoelement)

Everything else (both browser & jQuery extensions) has been implemented.

CSS4 will be added at some point.

Acknowledgements

CsQuery is mostly original code, but I have either been influenced by, or included directly, code written by others.

First and foremost, of course, is John Resig's jQuery, which changed the web forever.

Patrick Reisert's HtmlParserSharp, a C# port of the validator.nu HTML5 parser

Miron Abramson's fast version of Activator.CreateInstance for speeding up dynamic object instantiation

Mauricio Scheffer's HttpWebRequestAdapters to make mocking HttpWebRequest objects possible.

Roger Knapps' CombinedStream from his csharptest.net code library

The API and operation for the when object was inspired by Brian Cavalier's excellent when.js project.

csquery's People

Contributors

bigsan avatar coel avatar csainty avatar dpen2000 avatar ejsmith avatar farmfreshmeat avatar jamietre avatar joelverhagen avatar kaleb avatar rufanov avatar vitallium avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

csquery's Issues

"input:visible" selector does not work properly

In my C# program, it fails to exclude those with a type="hidden" attribute.
I do not have this problem with "select:visible" queries - it excludes them as per JQuery spec.
Running 1.1.1 through NuGet, with VS2010.

No encoding detection (meta tag is not used)

I'm writing a "mini-crawler" and using CsQuery successfully for most pages.
However there is a problem with pages not using utf-8 encoding. If the http response contains Content-Type header, I create a suitable StreamReader and all works as expected. Unfortunately some sites do not add the header and instead use an in-page meta tag, i.e.

<META HTTP-EQUIV="Content-Type" content="text/html;charset=windows-1255">

Using CQ.CreateDocument doesn't seem to use this information. HtmlParserSharp.Core.TreeBuilder class has the relevant charset detection code, but I don't know if it is mis(used).

After ReplaceWith, a CQ object which is source does not refer to its new location

In situations like this:

var content = CQ.Create("<div>some content</div>");

dom[".something"].ReplaceWith(content);

the previously unbound content element has an empty/broken selection set because it's elements were moved into a bound document. In jQuery, the existing object containing a fragment becomes bound to the DOM, This should have similar behavior.

find with ":eq" does not work on childless nodes

I have a node i (part of a larger document) as follows, stored in an IDomElement object:

<div class="header">

        Billing Address
        </div>

I run the following:

var j = i.Cq();
Console.WriteLine(j != null); // this writes "true"
var k = j.Find("> label:visible:eq(0)");

And get this error:

System.NullReferenceException : Object not set to an instance of an object.
at CsQuery.Engine.SelectorEngine.Select(IEnumerable`1 context)
at CsQuery.CQ.FindImpl(Selector selector)
at CsQuery.CQ.Find(String selector)

If I use a div that has children, or leave off :eq(0) at the end of the Find statement, it works as expected, without throwing an error. It is only the combination of the two that chokes.

extra closing tags with Render()

If you use the following in an aspx page, you will see extra </p> tags in the output (http://i.imgur.com/Pepxo.png). Not sure why, the extra tags do not appear when viewing the full page in a browser. I have noticed this happening on several pages. Is there a way to prevent this?

protected void Page_Load(object sender, System.EventArgs e) {
    CsQuery.CQ cq = CsQuery.CQ.CreateFromUrl("http://pizzaluce.com/menu/");
    Response.Write(cq.Find("#maincol-menu").RenderSelection());
}

The extra tags are rendered as:

&lt;/p&gt;

Thanks!

Razor syntax

I'm working with some Razor files (.cshtml) which are part of the MVC framework, and I'm noticing that if I have text like this:

<div class="MainContainer">
    <h2 class="Visualization">
        Concepts</h2>
    <div id="ConceptsStage">
        <img src="@Url.Content("~/Content/Images/1.gif")" style="margin: auto;" />
    </div>
</div>

or this:

@model IEnumerable<SocialMediaEntities.Concept>
@foreach (var item in Model)
{
    <a style="float: left; padding: 5px;" href="javascript:LoadPins('@item.Display')">
        @Html.DisplayFor(modelItem => item.Display)
    </a>
}
<div id="Temp" class="clear">
</div>

the documents get corrupted. Is there any way to extend Razor support?

nth-last-of-type and nth-of-type could return incorrect results

When using queries that were optimized to return all matching children such as

div > :nth-last-of-type(2n)

incorrect results would be returned. Queries that are run as filters only such as

div:nth-last-of-type

are unaffected.

(There are two different implementations for pseudo-class filters: a "test" and a "matching children" implementation. For some filters such as nth-child types, it is much more efficient to return all matching children directly, rather than iterating through each child and testing it. However this optimized version can only be used when the filter is applied following a descendent or child combinator. This bug was related to the optimized version only of nth-xxx-of-type filters)

.Value for some HTML tags not implemented

According to W3C, the following elements have a string value property:

  • option
  • input
  • select (inherited from selected option)
  • param
  • button

looking at the source in /source/CsQuery/Dom/Implementation/DomElement.cs, line 359, you're not implementing all of those. (And the lack of it for select in particular is causing problems.)

Rendering MVC views to strings

When using CsQuery in real-time with ASP.NET MVC you will probably want to render an MVC view to a string of HTML, which you can then manipulate with CsQuery.

Rick Strahl conveniently discusses this in today's blog post

From here:

string message = ViewRenderer.RenderView("~/views/template/ContactSellerEmail.cshtml",model,
    ControllerContext);

You can use CsQuery to manipulate the HTML as simply as :

CQ messageDom = CQ.Create(message);

messageDom["#content-placeholder"].ReplaceWith(...);

message = messageDom.Render();

Encoding issue

Some pages show a bunch of odd characters. For example:

        CQ mCQ = CQ.CreateFromUrl("http://api.jquery.com/jQuery.contains/");
        string render = mCQ.Render();

Will set render to a string that is mostly like: ΅�r��:��ǫi�]s-4�ë�k)�p�)��p4��8)�ga���������֍

I have not looked in to the issue yet, hopefully I am just doing something wrong and someone can offer some advice?

Thanks for any help..

Thanks To James

I would just like to thank Jamie for doing an incredible work on this project.

Thank you very much. :)

PEtter

&nbsp; removed

Hello,

First of all, great library; I love it and have been showing it to everyone.

I work for a news company and we will use CsQuery in our new CMS. We are currently using version 1.3 beta 1 to do transformations on user-written articles.
In these articles, it is important to keep special formatting, such as &nbsp; Unfortunately, when rendering the document, these are removed. I tried with options DomRenderingOptions.HtmlEncodingNone and DomRenderingOptions.HtmlEncodingMinimal.

The default (full encoding) does keep the non-breaking space (though as &#160;), but we'd prefer not having to use the default as our content is in french and all accented characters would also be encoded.

Could there be an option to keep HTML entities as-is?

Insufficient validation on tag names?

I can't reproduce this with a code snippet, but I got

TABLE
BORDER=0

for node.TagName and

<table border=0 cellspacing="2" cellpadding="2" width="100%">...</table
border=0>

for node.ElementHtml(). (Yes, with the line breaks.)

Something tells me that doesn't satisfy the HTML5 parsing rules... by then again, I've never read them. [:-)] Either way, you may want something for it in your tests.

Unhandled NullReferenceException being thrown

Issue:

A NullReferenceException is being thrown when trying to call Next that has no result.

Scenario:

Assuming document is a CQ object, I am making a call similar to:

var elem = document["#content.results > table > tbody > tr > td:nth-child(1) > a:nth-child(1)"].First();
// Do something with elem
var link = elem.Parent().Next("td").Children("a").First();
// NullReferenceException thrown.

In fact, there is no Next("td"), but as I understand it, the call should fail silently and return an empty CQ object. Instead, a NullReferenceException is thrown. Let me know if I can provide more useful diagnostic information.

Exception Details:
System.NullReferenceException was unhandled
  HResult=-2147467261
  Message=Object reference not set to an instance of an object.
  Source=CsQuery
  StackTrace:
       at CsQuery.Engine.SelectorEngine.Select(IEnumerable`1 context)
       at CsQuery.Engine.Selector.Select(IDomDocument document, IEnumerable`1 context)
       at CsQuery.Engine.Selector.<Filter>d__6.MoveNext()
       at CsQuery.CQ.AddSelection(IEnumerable`1 elements)
       at CsQuery.CQ.ConfigureNewInstance(CQ dom, IEnumerable`1 elements, CQ context)
       at CsQuery.CQ.NewInstance(IEnumerable`1 elements, CQ context)
       at CsQuery.CQ.FilterIfSelector(String selector, IEnumerable`1 list, SelectionSetOrder order)
       at CsQuery.CQ.nextPrevImpl(String selector, Boolean next)
       at CsQuery.CQ.Next(String selector)
       ...

Index was outside the bounds of the array in Cq.Create

This code gives above error :
var dom = CQ.Create(str);
Please reply ASAP.
where str is :

<head>
<style type="text/css">
    .style1 {
        height: 28px;
    }
</style>
</head>
<TABLE cellSpacing=0 cellPadding=0 width=595 border=0>
 <TBODY>
<TR>
<TD width=68 height=20>&nbsp;</TD>
<TD width=217>&nbsp;</TD>
<TD width=258>&nbsp;</TD>
<TD width=52>&nbsp;</TD></TR>
<TR>
 <TD>&nbsp;</TD>
<TD><IMG height=39 src="Images/spacer.gif" width=137></TD>
<TD class=name vAlign=top>
  <DIV align=right>{!@strTestName} - Testeinf&uuml;hrung</DIV></TD>
<TD>&nbsp;</TD></TR>
<TR>
<TD height=2><IMG height=10 src="Images/spacer.gif" width=10></TD>
<TD><IMG height=10 src="Images/spacer.gif" width=10></TD>
<TD class=text><IMG height=10 src="Images/spacer.gif" 
width=10></TD>
<TD><IMG height=10 src="Images/spacer.gif" 
 width=10></TD></TR></TBODY></TABLE>
 
  Kandidat
    <TR bgColor=#edebeb>
      <TD>&nbsp;</TD>
      <TD class=titel>Vorname:</TD>
      <TD class=text>&nbsp;</TD></TR>
      <TR bgColor=#edebeb>
      <TD>&nbsp;</TD>
      <TD class=titel>Nachname:</TD>
      <TD class=text>&nbsp;</TD></TR>
    <TR bgColor=#edebeb>
      <TD>&nbsp;</TD>
      <TD class=titel>Geburtsdatum:</TD>
      <TD class=text>&nbsp;</TD></TR></TBODY></TABLE>
  <TABLE cellSpacing=0 cellPadding=0 width=473 border=0>
    <TBODY>
    <TR bgColor=#edebeb>
      <TD width=15>&nbsp;</TD>
      <TD class=name bgColor=#edebeb height=40>Login</TD></TR></TBODY></TABLE>
  <TABLE cellSpacing=0 cellPadding=0 width=473 border=0>
    <TBODY>
    <TR bgColor=#edebeb>
      <TD width=30>&nbsp;</TD>
      <TD class=titel width=135>Login:</TD>
      <TD class=text>{!@strPupilName}</TD></TR>
    <TR bgColor=#edebeb>
      <TD>&nbsp;</TD>
      <TD class=titel>Passwort:</TD>
      <TD class=text>{!@strPassword}</TD></TR>
    <TR bgColor=#edebeb>
      <TD>&nbsp;</TD>
      <TD class=titel>Testnummer:</TD>
      <TD class=text>{!@strTokenNumber}</TD></TR>
    <TR bgColor=#edebeb>
      <TD><IMG height=10 src="Images/spacer.gif" width=10></TD>
      <TD>&nbsp;</TD>
      <TD><IMG height=10 src="Images/spacer.gif" 
    width=10></TD></TR></TBODY></TABLE></TD>
<TD width=50>&nbsp;</TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=1 width=595 border=0>
<TBODY>
<TR>
<TD width=68>&nbsp;</TD>
<TD width=479>
  <TABLE cellSpacing=0 cellPadding=0 width=479 border=0>
    <TBODY>

      <TD>&nbsp;</TD></TR>
    <TR>
      <TD class=boxgridbot><SPAN class=name>Start </SPAN></TD></TR>
    <TR>
      <TD><IMG height=10 src="Images/spacer.gif" 
    width=10></TD></TR></TBODY></TABLE>
  <TABLE cellSpacing=0 cellPadding=0 width=479 border=0>
    <TBODY>
    <TR>
      <TD width=20>&nbsp;</TD>
      <TD width=20>&nbsp;</TD>
      <TD class=text width=439>Loggen Sie sich beim Test ein.</TD></TR>
    <TR>
      <TD>&nbsp;</TD>
      <TD>&nbsp;</TD>
      <TD class=titelkursiv>&nbsp;</TD></TR></TBODY></TABLE>
  <TABLE cellSpacing=0 cellPadding=0 width=479 border=0>
    <TBODY>
    <TR>
      <TD>&nbsp;</TD></TR>
    <TR>
      <TD class=boxgridbot><SPAN class=name>Login (Anmelden) </SPAN></TD></TR>
    <TR>
      <TD><IMG height=10 src="Images/spacer.gif" 
    width=10></TD></TR></TBODY></TABLE>
  <TABLE cellSpacing=0 cellPadding=0 width=479 border=0>
    <TBODY>
    <TR>
      <TD width=20>&nbsp;</TD>
      <TD width=20>&nbsp;</TD>
      <TD class=text width=439>
        <P>Achten Sie beim Login (Anmelden) auf die Gross- und Kleinschreibung. 
        </P></TD></TR>
    <TR>
      <TD>&nbsp;</TD>
      <TD>&nbsp;</TD>
      <TD class=titelkursiv>&nbsp;</TD></TR></TBODY></TABLE>
  <TABLE cellSpacing=0 cellPadding=0 width=479 border=0>
    <TBODY>
    <TR>
      <TD>&nbsp;</TD></TR>
    <TR>
      <TD class=boxgridbot><SPAN class=name>Technische Schwierigkeiten 
        </SPAN></TD></TR>
    <TR>
      <TD><IMG height=10 src="Images/spacer.gif" 
    width=10></TD></TR></TBODY></TABLE>
  <TABLE cellSpacing=0 cellPadding=0 width=479 border=0>
    <TBODY>
    <TR>
      <TD width=20>&nbsp;</TD>
      <TD width=20>&nbsp;</TD>
      <TD class=text width=439>
        <P>Bei technischen Problemen helfen Ihnen die IT-Verantwortlichen weiter.</P></TD></TR>
    <TR>
      <TD>&nbsp;</TD>
      <TD>&nbsp;</TD>
      <TD class=titelkursiv>&nbsp;</TD></TR></TBODY></TABLE>
  <TABLE cellSpacing=0 cellPadding=0 width=479 border=0>
    <TBODY>
    <TR>
      <TD>&nbsp;</TD></TR>
    <TR>
      <TD class=titel>Viel Erfolg! </TD></TR></TBODY></TABLE></TD>
<TD width=48>&nbsp;</TD></TR></TBODY></TABLE>

[type="text"] selecting input elements with no type attribute

The default value for "type" is "text" under HTML5, however, CSS selectors act against the HTML markup and not the value of the attribute. This was overzealously implemented in the last release and resulted in all input elements of type text (regardless of whether the attribute was present) being selected. Despite this being an intuitive and useful behavior, it's wrong and is not how browsers do it. Selecting on [type="text"] now correctly ignores input elements with no type attribute.

Note that in jQuery 1.8 the :text selector has been deprecated, leaving no way in the publically supported API to select all text input elements. That is, <input /> is a valid text input according to the HTML5 spec since "text" is the default for the type attribute. The jQuery :text pseudoclass selector does include this (as well as ones that included a type=text attribute), but is now officially deprecated.

I think this is a very useful selector, especially since CsQuery will often be used against HTML which someone else marked up and you don't have the luxury of making sure all your text inputs have a type attribute, so I have no intention of removing it from CsQuery.

Generally speaking since CsQuery does not have all the same goals as jQuery (e.g., small size) I doubt I'll make a habit of ever removing deprecated features, unless there is a conflict with a more current usage.

I can't make the tests run after cloning.

This could be to my incompetence.. but trying to run the tests after cloning wil not work..

First I had to add Nunit.framework to the projects, to make it compile.
Now it throws an exception about some filepath it can't find..

Maybe you should seperate the preformance tests from the unit tests?
To my understanding UnitTests should not be dependend on external sources, of any kind.

PEtter

Issue with remove() and self closing tags.

    <Test> Sub VerifyCsQueryRemoveWithSelfClosingTag()
    Dim s As String = "<h1>This is a test</h1> <rel src=""/fishyLink"" /><div>Some more</div> And even more text"
    Dim f = CsQuery.CQ.Create(s)

    f.Remove("rel")
    Assert.AreEqual("<h1>This is a test</h1> <div>Some more</div> And even more text", f.Render())


End Sub

<Test> Sub VerifyCsQueryRemove()
    Dim s As String = "<h1>This is a test</h1> <rel src=""/fishyLink""></rel><div>Some more</div> And even more text"
    Dim f = CsQuery.CQ.Create(s)

    f.Remove("rel")
    Assert.AreEqual("<h1>This is a test</h1> <div>Some more</div> And even more text", f.Render())


End Sub

First test fails..
Second is OK
I'm running on the latest src from git

Can't select headers

User reports selectors for H1-H6 not working.

Confirmed. The function to match HTML tags in selectors was using the wrong character validation function.

InvalidOperationException when trying to call the CQ.Select method.

InvalidOperationException when trying to call the CQ.Select method.
Argument:

div[style="display:block;margin:10px auto;text-align:center;background: yellow;\a padding-top: 10px;\a border-radius: 10px;"]

Exception details:

System.InvalidOperationException occurred
Message=Invalid escape character found in quoted string: ''
Source=CsQuery
StackTrace:
at CsQuery.StringScanner.Implementation.ExpectPattern.GetOuput(Int32 startIndex, Int32 endIndex, Boolean honorQuotes, Boolean stripQuotes) in d:\projects\csharp\CsQuery\source\CsQuery\StringScanner\Implementation\ExpectPattern.cs:line 237
InnerException:

Breaks on '\a' escape character.

CsQuery version: 1.2.1.261
Release version (1.3) has this issue too.

Specification: http://www.w3.org/TR/CSS21/syndata.html#strings

Slice() does not capture all elements

According to the JQueryt API, the following should be equivalent:

$('div').length
$('div').slice(0).length

However, in CSQuery 1.1.2, they are not:

Console.WriteLine(
  doc.Children().Length + ":" + 
  doc.Children().Slice(0).Length
);
> 6:5
> 2:1
> 13:12

HTML parser not handling all auto closing tags properly

Some complex nth-child selectors against the huge HTML5 spec test document are returning different values than in Chrome + jQuery, meaning that the parser isn't handling all auto-close tags properly and changing the intended nesting of some elements.

Version 1.2 API requires a reference to System.Web

The IHtmlString interface was added to the core CsQuery object to support an HtmlHelper as part of the CsQuery.Mvc project. This is unnecessary and could break code that doesn't already reference System.Web.

1.2.1 removes the interface and implements it only in the CsQuery.Mvc project. Existing code that uses the HtmlHelper should not be affected by this change.

Bug with :not() from sizzle tests

This sizzle test is failing:

 t( "Not Nth Child", "#qunit-fixture p:not(:nth-child(1))",Arrays.String("ap","en","sap","first"));

Needs investigation.

StringBuilder should be used in CsQuery.HtmlParser.ExtensionMethods

There's other ways of achieving this but in keeping with the existing method format...
The existing result += text[i]; kills performance when parsing larger html blocks.

    public static string SubstringBetween(this char[] text, int startIndex, int endIndex)
    {
        var result = new StringBuilder();
        for (var i = startIndex; i < endIndex; i++)
        {
            result.Append(text[i]);
        }
        return result.ToString();
    }

CSS Class Names being Output in Lowercase when using AddClass

Love CsQuery so far :) hey I tested your new DLL v1.1.1.22414 and the nth-child selector now works, but I got a tiny little problem - when using AddClass my css class names are being output in lowercase - although lowercase class names are the norm - being a .NET guy I like to use camel case e.g. MyCssClass please fix. Apart from that I gotta say "GOOD JOOOB!!!" on a really easy to use and fast program!

script tags

When running .text()

We return all text within an element including items within a <Script> tag shouldnt these be avoided?

Issue with remove()

<Test()> Sub RemoveTagWithTextInFrontAndAfter()
Dim fragment As CsQuery.CQ
fragment = CsQuery.CQ.CreateFragment("Some text infront of<iframe src='/noeSkummelt'></iframe>and after")
fragment.Select("iframe").Remove()
Assert.AreEqual("Some text infront of and after", fragment.SelectionHtml)

End Sub

Dim fragment = CsQuery.CQ.Create("Some text infront of<iframe src='/noeSkummelt'></iframe>and after")
fragment.Select("iframe").Remove()
Assert.AreEqual("Some text infront of and after", fragment.SelectionHtml)

Expected string length 30 but was 31. Strings differ at index 20.
Expected: "Some text infront of and after"
But was: "Some text infront of, and after"

Somehow the iframe was replaced by a , and a space

strange behavior

Why do these two statements behave differently:

context[".hproduct:eq(3) .name .url"] - works correctly

context[".hproduct:eq(3)][.name .url"] - returns .url from all elements not just 3rd one that was defined.

Selecting Textnode?

I tried reading some text in an element, but it did not work. Or not I know it from jquery.

I have something like this:

<tr>
<td>
<div class="background_picture"></div>
<a href="my/link/to/page2">Page 2 Title</a> :second part of title</td>
<td>09/09/2011</td>
</tr>

How do I get the " :second part of title" string?
dom["tr td:first-child"].Text(); and other things I tried did not work :/

Thank you very much for this great implementation :)

Auto generate html, body tags

When creating a DOM without a body or html tag, which are technically optional, , CsQuery does not complain, nor does it create the tags. This causes discrepancies with jQuery for the same source HTML.

This is a bit tricky since the same HTML parsing code is used to create a DOM vs. fragments. The latter should have nothing generated automatically. We'll need a convention to indicate what your intent is.

Not an issue, just a question. How to execute functions stored in a string?

I need to be able to execute a string against a CQ.

For example, I have a CQ called "mCQ", and a string pulled out of a database: ".Parent().Find('a')"

I need to take the string, and convert it to function calls and parameters. Essentially taking my string and existing CQ to make:

return mCQ.Parent().Find('a');

I'm planning on parsing the string to find the functions and parameters, and then using reflection to execute.

Before I get started, is there any code that does something similar in the CsQuery project? Is there already a string to functions and parameters parser? Is there already a way to call functions based on their name? Or is there a better way to do it?

Any tips or suggestions are very much appreciated. Or if you think this feature could be useful in the CsQuery project let me know and I will work on adding to the CQ project instead of my own project...

Thanks :)

You can't set class or style attributes as a boolean property.

I receive the following error message when I try to parse a full HTML page:

You can't set class or style attributes as a boolean property. at CsQuery.Implementation.DomElement.SetAttribute(UInt16 tokenId) at CsQuery.HtmlParser.IterationData.GetTagAttribute(Char[] html) at CsQuery.HtmlParser.HtmlElementFactory.d__0.MoveNext()

[branch-mvc] MVC framework development

The examples includes an MVC application that demonstrates using CsQuery in a web framework. It allows adding methods to MVC controllers, permitting direct access to the HTML of a page before it is rendered as a result of specific actions, for an action in a controller, or for any controller.

The mvc branch separates this into a separate project CsQuery.Mvc so this framework can be used installed directly and maintained independently.

Problem with html

the below html does not find the element via htmldoc["#itm_num"];

<!DOCTYPE html><html xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://opengraphprotocol.org/schema/"><head><meta name="layout" content="main" /><!-- Use ?ForceSiteSpeedGauge=true for forcing --><script>var oGaugeInfo = {sUrl:"http://sofe.ebay.com/ws/web/SojPagePerf?cmdname=ViewItemPageRaptor&st1=1348317886817",iST:(new Date()).getTime()};</script><title> Fujifilm FinePix X100 12.3 MP Camera Bundle - Fuji Leather Case - Fuji Lens Hood 4547410151831 | eBay</title><meta name="y_key" content="acf32e2a69cbc2b0"></meta><meta name="description" content="Fujifilm FinePix X100 12.3 MP Camera Bundle - Fuji Leather Case - Fuji Lens Hood in Cameras & Photo, Digital Cameras | eBay"></meta><meta property="og:type" content="ebay-objects:item"></meta><meta property="og:site_name" content="eBay"></meta><meta name="google-site-verification" content="8kHr3jd3Z43q1ovwo0KVgo_NZKIEMjthBxti8m8fYTg"></meta><meta name="msvalidate.01" content="31154A785F516EC9842FC3BA2A70FB1A"></meta><meta property="og:url" content="http://www.ebay.com/itm/Fujifilm-FinePix-X100-12-3-MP-Camera-Bundle-Fuji-Leather-Case-Fuji-Lens-Hood-/110954043427"></meta><meta property="og:title" content="Fujifilm FinePix X100 12.3 MP Camera Bundle - Fuji Leather Case - Fuji Lens Hood"></meta><meta property="og:description" content="Fujifilm FinePix X100 12.3 MP Camera Bundle - Fuji Leather Case - Fuji Lens Hood in Cameras & Photo, Digital Cameras | eBay"></meta><meta name="keywords" content="Fujifilm FinePix X100 12.3 MP Camera Bundle - Fuji Leather Case - Fuji Lens Hood, Cameras & Photo, Digital Cameras"></meta><meta property="og:image" content="http://thumbs4.ebaystatic.com/m/mAb8Ts2wJrlPMA_IYSgDq6w/96.jpg"></meta><meta property="fb:app_id" content="102628213125203"></meta><link rel="canonical"   href="http://www.ebay.com/itm/Fujifilm-FinePix-X100-12-3-MP-Camera-Bundle-Fuji-Leather-Case-Fuji-Lens-Hood-/110954043427"> </link> <link href="http://ir.ebaystatic.com/z/2k/5cfo0hdesq5c3prtub2v1ywty.css" type="text/css" rel="stylesheet"><link rel="stylesheet" type="text/css" href="http://gh.ebaystatic.com/header/css/all.min?combo=53&app=RAPTOR&rvr=59&ds=3&siteid=0&factor=REFRESHER"/></head><body class="sz980"><div id="Body"><div id="TopPanelDF"><!--[if lt IE 9]> <link rel="stylesheet" type="text/css" href="http://gh.ebaystatic.com/header/css/glb.ielt9?combo=53&app=RAPTOR&ds=3&siteid=0&rvr=1.0.0&factor=REFRESHER"><![endif]--> <a class="gh-hdn" href="#mainContent">Skip to main content</a><div id=gh class="gh-w gh-site-0"><table class=gh-tbl><tr><td class=gh-td><a id="gh-la" _sp="m570.l2586" class="iclg" href="http://www.ebay.com">eBay<img alt="" src="http://p.ebaystatic.com/aw/pics/s.gif" id="gh-logo" class="gspr iclg" border="0"></a></td><td class=gh-td><div id=gh-shop><a id="gh-shop-a" _sp="m570.l3582" href="http://www.ebay.com/sch/allcategories/all-categories">Browse by<span id=gh-shop-e>category<i id=gh-shop-ei ></i></span></a></div></td></td><td class=gh-td-s><form action="http://www.ebay.com/sch/i.html" method=get id=gh-f class="lftd l-shad"><input type=hidden value=m570.l3201 name=_trksid><table class=gh-tbl2><tr><td class=gh-td-s><div id=gh-ac-box><div id=gh-ac-box2><label class="gh-hdn g-hdn" for="gh-ac">Enter your search keyword</label><input autocomplete=on name=_nkw id=gh-ac placeholder="I'm looking for... " title="Enter your search keyword" maxlength=300 size=50 class=gh-tb type=text ></div></div></td><td class=gh-td><div id="gh-cat-box"><select name=_sacat id=gh-cat size=1 class=gh-sb title="Select a category for search"><option value="0" selected="selected">All Categories </option></select></div></td> <td class=gh-td><input value="Search" id=gh-btn class="btn btn-prim" type=submit _sp="m570.l1313"/></td><td class=gh-td><div id=gh-as><a title="Advanced Search" id="gh-as-a" _sp="m570.l2614" class="thrd" href="http://www.ebay.com/sch/ebayadvsearch/?rt=nc">Advanced</a></div></td> </tr></table></form></td></tr></table><div id=gh-top><noscript class=gh-t id=_nkw>Welcome, (<a class="gh-a" href="https://signin.ebay.com/ws/eBayISAPI.dll?SignIn&_trksid=m570.l3348">Sign in</a> to bid or buy)</noscript><ul id=gh-topl><li id=gh-eb-u class=gh-t></li><li class=gh-t><a id="gh-p1" _sp="m570.l3188" href="http://deals.ebay.com/">Daily Deals</a></li></ul><ul id=gh-eb class=gh-clearfix><li class=gh-eb-li id=gh-eb-My><a _sp="m570.l2919" class="gh-eb-li-a" href="http://my.ebay.com/ws/eBayISAPI.dll?MyEbay&amp;gbh=1">My eBay</a></li><li class=gh-eb-li id=gh-eb-Sell><a _sp="m570.l1528" class="gh-eb-li-a" href="http://cgi5.ebay.com/ws/eBayISAPI.dll?aidZ153=&MfcISAPICommand=SellHub3">Sell</a></li><li class=gh-eb-li id=gh-eb-Comm><a _sp="m570.l1540" class="gh-eb-li-a" href="http://community.ebay.com">Community</a></li><li class=gh-eb-li id=gh-eb-Cust><a _sp="m570.l1545" class="gh-eb-li-a" href="http://ocs.ebay.com/ws/eBayISAPI.dll?CustomerSupport">Customer Support</a></li><li class=gh-eb-li id=gh-eb-Alerts><a class="gh-eb-li-a" href="http://my.ebay.com/">Notifications</a></li><li class=gh-eb-li id=gh-cart><a _sp="m570.l2633" class="gh-eb-li-a" href="http://payments.ebay.com/ws/eBayISAPI.dll?ShopCart&amp;ssPageName=CART:HDR"><i class="gspr icsc"></i>Cart</a></li></ul></div></div><a name="mainContent"></a> <!--ts:2012.09.21.19:36--><div id="Top"> <div id="TopPanel"><!--[if lt IE 8]><style>body .vi-VR-bkto-TD {min-width:inherit;}body.sz1200 .vi-VR-brumblnkLst{width:580px;}body.sz980 .vi-VR-brumblnkLst{width:370px;}body .sz1280 .vi-VR-brumblnkLst{width:500px;}body .sz1152 .vi-VR-brumblnkLst{width:450px;}.sz940 .vi-VR-brumblnkLst{width:300px;}</style><![endif]--><table width="100%" class="vi-bc-topM"><tr><td><ul id="bc"><table><tr><td style="vertical-align:top;" class="vi-VR-bkto-TD">  <li class="gspr left">&lt;</li>  <li class="bkto"><a class="vi-VR-spl-lnk" href="http://www.ebay.com"  title="Click to Go Back to home page"  id="smtBackToAnchor">Back to home page</a></li>  <!--[if lt IE 8]>  <li  style="margin:0px 5px 0px -10px"  id="vi-VR-brumb-pipeIcon">|</li>  <![endif]--></td> <td style="vertical-align:top;" id="vi-VR-brumb-pdplnkLst"><li  style="margin:0px 5px 0px -10px">|</li><li  style="margin-right:5px;width:100%; max-width: 480px;" class="vi-VR-thrd">Listed as <a title="Fujifilm FinePix X100 12.3 MP Digital Camera - Black" href="http://www.ebay.com/ctg/Fujifilm-FinePix-X100-12-3-MP-Digital-Camera-Black-/100164507?_tab=1&amp;_trksid=p2047675.l2644">Fujifilm FinePix X100 12.3 MP Digital Camera - Black</a> in category:</li><li class="gspr "> </li></td><td style="vertical-align:top;" class="vi-VR-brumblnkLst"  id="vi-VR-brumb-lnkLst"><table><tr><td style=""><li><a href="http://www.ebay.com/sch/Cameras-Photo-/625/i.html" class="thrd">Cameras & Photo</a></li><li class="gspr right">&gt;</li><li><a href="http://www.ebay.com/sch/Digital-Cameras-/31388/i.html" class="scnd">Digital Cameras</a></li></td></tr></table></td></tr></table></ul></td></tr></table></div></div></div><div id="CenterPanelDF"><div id="CenterPanel" style="background: none;"><!--[if IE 7]><style type="text/css">body #msgPanel {position:relative;z-index:100;}</style><![endif]--><!-- msgType.code eq 3 -->    <div class="tmpnl"><div id="msgPanel" class="pnl u-dspn"><div class=" sm-co  sm-in "><div class="msgPad "><i class="gspr  icmin"><!-- - --></i><p class="sm-md"><b><span id="w1-2-_msg" class="msgTextAlign" ></span> <!--[if lt IE 8]><style>.sm-co .msgTextAlign {vertical-align:middle;}.sm-co #listPanel {top: -5px; position: relative;display: inline-block;} </style><![endif]--><span id="listPanel"><!--[if IE 7]><style type="text/css">body .lPnlHdr {height: 20px; display: inline-block; margin-bottom: -25px;margin-top:-22px}body #listPanel a.u-hdn {display:none;}</style><![endif]--><span id="w1-3-_lmsgC" class="u-dspn" ><span id="w1-3-_lmsg"></span><span id="w1-3-_rmvC"><span class="addSpace">|</span><a id="w1-3-_rmv" class="vi_lst_tpm_rmv" href="javascript:;"></a></span><div id="w1-3-_lstP" class="lpnl  c-std " ><div class="scroll" ><div id="w1-3-_lstC" class="listC" ><!-- <a>list name 1 </a><a>list name 1 </a><a>list name 1 </a><a>list name 1 </a><a>list name 1 </a><a>list name 1 </a><a>list name 1 </a> --></div></div></div></span><!-- TODO: set myebay url  --></span></b></p></div></div></div><div id="listingHistory"></div><div id="otherMsg"></div></div><!-- Placement 100011 && 100012 --><!--[if lt IE 8]><style>body #BuyBoxPanel{margin-top:-10px;}body .eBp {display:block;height:20px;}.vi-VR-spcr-LI {display:none;} .sz1200 .vi-VR-scnd-LI input {position:relative;top:-7px;}</style><![endif]--><!--[if lt IE 9]><style>.sz980 .vi-VR-scnd-LI {width:130px;}.sz1200 .vi-VR-scnd-LI {width:160px;}.sz980 .vi-VR-scnd-LI, .sz1200 .vi-VR-scnd-LI  {padding-right:0px;}</style><![endif]--><!--[if IE]><style>.sz980 ul li.vi-VR-scnd-LI, .sz1200 ul li.vi-VR-scnd-LI  {text-align:left;}</style><![endif]--><div id="PicturePanel" class="pp-c"><div class="l-shad lftd  img img400"><table class="img img400"><tbody><tr><td class="img img400"><div id="picturePanelIcon"><!--[if IE 9]><style>body #PicturePanel  .prom140 span.gspr {filter:inherit;}body #PicturePanel  .prom140 i.gspr {left:1px;bottom:2px;}body #PicturePanel  div.prom140 i.folw {left:auto;}</style><![endif]--><!--[if IE 8]><style>body #PicturePanel  .prom140 i.gspr {left:1px;bottom:2px;}</style><![endif]--><!--[if IE 7]><style>body #PicturePanel  div.prom140 span.gspr {left:-21px;}body #PicturePanel  .prom140 i.gspr {left:0px;}body #PicturePanel  .prom140 {width:107px;}</style><![endif]--><!--[if lt IE 9]><style>body #PicturePanel  div.prom140 i.folw {left:auto;}body #PicturePanel div.prom span.gspr {padding-top: 0px; margin-top: 3px; top: -30px; left: -21px;line-height:20px;filter:progid:DXImageTransform.Microsoft.Matrix(M11=0.766044443118978,M12=0.6427876096865393,M21=-0.6427876096865393,M22=0.766044443118978,sizingMethod='auto expand')}</style><![endif]--><div class="prom prom140" id="freeShip" style="" title="FREE shipping"><span class="gspr" >FREE SHIPPING</span><i class="gspr"></i><i class="gspr folw"></i></div></div><div id="test"> </div><a href="javascript:;" style="display: block; cursor: default;"><div id="mainImgHldr" style="width:400px" title="Fujifilm-FinePix-X100-12-3-MP-Camera-Bundle-Fuji-Leather-Case-Fuji-Lens-Hood"><!-- <span id="mainImgHldr" style="display: inline-block;"> --><img id="icThrImg"class="img img400 vi-hide-mImgThr" src="http://p.ebaystatic.com/aw/pics/globalAssets/imgLoading_30x30.gif" imgsel="0" alt="Fujifilm-FinePix-X100-12-3-MP-Camera-Bundle-Fuji-Leather-Case-Fuji-Lens-Hood" /> <img id="icImg" class="img img400" itemprop="image" src="http://i.ebayimg.com/t/Fujifilm-FinePix-X100-12-3-MP-Camera-Bundle-Fuji-Leather-Case-Fuji-Lens-Hood-/00/s/Mzc1WDU1MA==/$T2eC16ZHJHIE9nyseyvCBQWhuHhTEg~~60_1.JPG" style="display:none;" clk="" /><!-- </span> --></div></a><span id="imgNATxt" class="imgNa">Image not available</span><span id="varImgNATxt" class="imgNa" style="display:none">Photos not available for this variation</span><noscript><style type="text/css">.vi-hide-mImgThr {display: none;}</style><img id="icImg" class="img img400" itemprop="image" src="http://i.ebayimg.com/t/Fujifilm-FinePix-X100-12-3-MP-Camera-Bundle-Fuji-Leather-Case-Fuji-Lens-Hood-/00/s/Mzc1WDU1MA==/$T2eC16ZHJHIE9nyseyvCBQWhuHhTEg~~60_1.JPG" style="" clk="" /></noscript><script type="text/javascript">function picOnLoad(){var elem = document.getElementById('icThrImg'); var pic = document.getElementById('icImg'); elem.style.display = 'none'; pic.style.display = ''; pic.setAttribute('clk', elem.getAttribute('imgsel')); document.getElementById('imgNATxt').style.display = 'none';return;}function picOnError(){var elemThr = document.getElementById('icThrImg');var pic = document.getElementById('icImg'); elemThr.src='http://pics.ebaystatic.com/aw/pics/cmp/icn/iconImgNA_96x96.gif'; elemThr.style.display = ''; pic.style.display = 'none'; pic.setAttribute('clk', elemThr.getAttribute('imgsel')); document.getElementById('imgNATxt').style.display = 'block';return;}var image = document.createElement('img');image.src= 'http://i.ebayimg.com/t/Fujifilm-FinePix-X100-12-3-MP-Camera-Bundle-Fuji-Leather-Case-Fuji-Lens-Hood-/00/s/Mzc1WDU1MA==/$T2eC16ZHJHIE9nyseyvCBQWhuHhTEg~~60_1.JPG';if(image.complete ||  image.readyState === 4){picOnLoad();}else{    image.onload = function(){     picOnLoad();    };    image.onerror = function(){ picOnError();};}image.onerror = function(){ picOnError();};</script></td></tr></tbody></table></div><div class="spr"></div><div class="u-cb" style="height:10px;"></div><div class="pt-p" style="visibility:hidden;" id="zoom_enlarge_msg_cnt"><a class="pt-i pt-tx  vi-VR-stdlblLgt vi-VR-fnt12 " id="zoom_enlarge_msg"  href="javascript:;"></a></div><div class="oly_upnl" id="vi_pic_enlarge_oly"><div id="enlarge_panel" class="vi_en_panel"><div id="enlarge_img_panel" class="vi_en_img" ><table class="en_img_tbl"><tbody><tr><td class="en_img_tbl"><div id="en_img_span" style="overflow:hidden; display:inline-block; position: relative;"><div id="en_img_span_cnt" style="top:0; left:0; position:absolute;display: inline;"><img id="en_img_id" style="display: none;" alt="" src="http://pics.ebaystatic.com/aw/pics/spacer.gif" clk=""></div><span id="en_layer_selector"></span></div></td></tr></tbody></table></div><div id="enlarge_img_fs" class="vi_en_fs"><ul id="en_fs_ul" class="lst icon"><li style="width: 80.0px; height: 76px;" index="1" imgn="0"><a id="enfsthImg1" href="Javascript:;" title="Fujifilm-FinePix-X100-12-3-MP-Camera-Bundle-Fuji-Leather-Case-Fuji-Lens-Hood" class="pic pic1"><div style="min-width:64px;height:100%"><table class="img"><tr><td class="tdThumb" style="height:64px; "><img src="http://i.ebayimg.com/t/Fujifilm-FinePix-X100-12-3-MP-Camera-Bundle-Fuji-Leather-Case-Fuji-Lens-Hood-/00/s/NTQ2WDEwMDA=/$T2eC16VHJHoE9n3Ke5,CBQWho-gj0g~~60_14.JPG" style="max-width:64px;max-height:64px" index="1"  /></td></tr></table></div> </a></li></ul></div></div></div><!--[if IE]><style type="text/css">.flmstp .lst.icon a.pic1{width: 97% !important;height: 97% !important;}</style><![endif]--><div id="slider" class="flmstp" style="width:400px"><a href="javascript:;" class="gspr flm-btn pre hide"></a><div id="imgC" style="height:76px; width:217px"><ul class="lst icon"><li><a id="thImg0" href="javascript:;" title="Fujifilm-FinePix-X100-12-3-MP-Camera-Bundle-Fuji-Leather-Case-Fuji-Lens-Hood" class="pic pic1"><table class ="img"><tr><tdclass="tdThumb" style ="height:64px; "><div><img src="http://i.ebayimg.com/t/Fujifilm-FinePix-X100-12-3-MP-Camera-Bundle-Fuji-Leather-Case-Fuji-Lens-Hood-/00/s/Mzc1WDU1MA==/$T2eC16ZHJHIE9nyseyvCBQWhuHhTEg~~60_14.JPG" style="max-width:64px;max-height:64px" index="0" onerror="try{this.src='http://pics.ebaystatic.com/aw/pics/cmp/icn/iconImgNA_96x96.gif';}catch(e){}"/></div></td></tr></table></a></li><li><a id="thImg1" href="javascript:;" title="Fujifilm-FinePix-X100-12-3-MP-Camera-Bundle-Fuji-Leather-Case-Fuji-Lens-Hood" class="pic pic1"><table class ="img"><tr><tdclass="tdThumb" style ="height:64px; "><div><img src="http://i.ebayimg.com/t/Fujifilm-FinePix-X100-12-3-MP-Camera-Bundle-Fuji-Leather-Case-Fuji-Lens-Hood-/00/s/NTQ2WDEwMDA=/$T2eC16VHJHoE9n3Ke5,CBQWho-gj0g~~60_14.JPG" style="max-width:64px;max-height:64px" index="1" onerror="try{this.src='http://pics.ebaystatic.com/aw/pics/cmp/icn/iconImgNA_96x96.gif';}catch(e){}"/></div></td></tr></table></a></li><li><a id="thImg2" href="javascript:;" title="Fujifilm-FinePix-X100-12-3-MP-Camera-Bundle-Fuji-Leather-Case-Fuji-Lens-Hood" class="pic pic1"><table class ="img"><tr><tdclass="tdThumb" style ="height:64px; "><div><img src="http://i.ebayimg.com/t/Fujifilm-FinePix-X100-12-3-MP-Camera-Bundle-Fuji-Leather-Case-Fuji-Lens-Hood-/00/s/MzAwWDMwMA==/$T2eC16JHJGwE9n)ySc7nBQWhphEIGw~~60_14.JPG" style="max-width:64px;max-height:64px" index="2" onerror="try{this.src='http://pics.ebaystatic.com/aw/pics/cmp/icn/iconImgNA_96x96.gif';}catch(e){}"/></div></td></tr></table></a></li></ul></div><a href="javascript:;" class="gspr flm-btn nxt hide"></a><div class="sel hide"></div></div></div><div id="ItemPanel"><div ><h1 class="it-ttl-VR" itemprop="name">Fujifilm FinePix X100 12.3 MP Camera Bundle - Fuji Leather Case - Fuji Lens Hood</h1><div class="sig-ht20" style="display:inline"><span id="ebay-scjs-div" ><eb:fbLikeWantOwn spid="2047675" url="http://www.ebay.com/itm/Fujifilm-FinePix-X100-12-3-MP-Camera-Bundle-Fuji-Leather-Case-Fuji-Lens-Hood-/110954043427" /></span></div><span class="watchPipe" style="position:relative;top:5px;">|</span><!-- DO NOT change linkToTagId="rwid" as the catalog response has this ID set  --><span style="position:relative;top:6px;"><span id="" class="rc" itemprop="aggregateRating" itemscope="itemscope" itemtype="http://schema.org/AggregateRating"><!-- TODO : Add SEO Tags --><a class="prodreview vi-VR-prodRev" id="_rvwlnk" href="#rwid">User reviews (22)</a><a class="prodreview vi-VR-prodRevMini" id="_rvwlnk_Mini" href="#rwid" style="display:none;">(22)</a><span class="rs rs-fr" style="position: relative; top: -2px;padding-left:2px"><u><a href="javascript:;" style="cursor:default"><b style="min-width:90%;max-width:90%;background-position:-1px -55px;"></b></a></u></span><span itemprop="ratingValue" content="4.5" ></span><span itemprop="ratingCount" content="22" ></span><span itemprop="reviewCount" content="22" ></span></span></span><!--[if lt IE 8]><style>.vi-VR-share-algn{position:relative;top:-12px;}body #Body table.vi-VR-marTop5 {margin-top:2px;}</style><![endif]--><div class="sig-ht20 vi-VR-share-algn" style="display:inline;"><table align="right" class=" "><tr><td class="vi-VR-survey-TD"><div class="vi-bc-svySpn"><link href="http://ir.ebaystatic.com/z/mf/duovypg5ae2rldwccbldg1thl.css" type="text/css" rel="stylesheet"><input type="hidden" id="linkcontent" name="linkcontent" value=" Tell us what you think"><iframe id="domSubmit" style="display:none;"></iframe><div id="surveyDiv"><form id="surveyForm" action="http://qu.ebay.com/survey?srvName=" method="post" target="eBaySurvey"><input type="hidden" id="sid" name="sid" value=""><input type="hidden" id="coid" name="coid" value=""><input type="hidden" id="cid" name="cid" value=""><input type="hidden" id="positionId" name="positionId" value=""><input type="hidden" id="variantId" name="variantId" value=""><input type="hidden" id="yesquestion" name="yesquestion" value="null"><input type="hidden" id="noquestion" name="noquestion" value="null"><input type="hidden" id="guid" name="guid" value=""><input type="hidden" id="srvName" name="srvName" value="VIP (view-item-2)"><input type="hidden" id="extParam" name="extParam" value=""><input type="hidden" id="domContent" name="domContent" value=""><input type="hidden" id="epInfo" name="epInfo" value="7891%7C11576%7C10898%7C10192%7C11719%7C10121%7C"></form></div><a rel="nofollow" id="surveylink" href="javascript:void(0)"></a></div><span class="watchPipe"></span></td><td><div style="float:right"><div id="ebay-scShare-div" data-imageUrl="http://i.ebayimg.com/t/Fujifilm-FinePix-X100-12-3-MP-Camera-Bundle-Fuji-Leather-Case-Fuji-Lens-Hood-/00/s/Mzc1WDU1MA==/$T2eC16ZHJHIE9nyseyvCBQWhuHhTEg~~60_1.JPG"  data-share=" " data-url="http://www.ebay.com/itm/Fujifilm-FinePix-X100-12-3-MP-Camera-Bundle-Fuji-Leather-Case-Fuji-Lens-Hood-/110954043427" data-language="en_US" data-spid="2047675" data-destinations="email,facebook,twitter,pinterest"  class="eb:share" ></div></div></td></tr></table></div></div><div id="BuyBoxPanel" class="c-std"><div id="BuyOptionsWrapper"><div id="BuyingOptionsPanel"><!--[if lt IE 8]><style>body .topinfo ul.quantity{width:100%;}body .vi-VR-wdt100 {width:100%;} </style><![endif]--><div class="topinfo actPanel "><ul class="vi-ul-tl"><li></li><li id="bb_tlft" class="vi-tl-left vi-VR-scnd-LI  "><span class="tml tmlHt"><span id="">4</span><span id="">h</span> <span id="">50</span><span id="">m</span> </span><span style="font-size:12px;color:#666;">left</span></li></ul><!-- //TODO : remove hardcoded ID for Shipping cost --><ul class="vi-VR-wdt100"><li class="vir-pr-mmd"><div class="w29 vi-price"><span id="bb_bdp"><span id="prcIsum" class="">US $875.00</span></span></div></li><li  class="vi-VR-scnd-LI" style="clear:right;"><!--[if lt IE 9]><style type="text/css">.vib .bt {line-height: 1;}</style><![endif]--><span   ><input    style=""   id="binBtn_btn" class="btn btn-prim btn-m vi-VR-btnWdth-L" type="submit"  onclick="javascript:return false;"  value="Buy it now" title="" /></span><div style="padding-top: 10px;"><span><!--[if lt IE 9]><style type="text/css">.vib .bt {line-height: 1;}</style><![endif]--><span   ><a   style=""  id="isCartBtn_btn" class="btn btn-scnd btn-m vi-VR-btnWdth-L" title="" href="http://payments.ebay.com/ws/eBayISAPI.dll?ShopCartProcessor&_trksid=p2047675.l1473&atc=true&item=110954043427&ssPageName=CART:ATC&quantity=1" >Add to cart</a></span></span></div></li></ul><ul><li class="warrantyDiv"><div class="ew-cnt"><a id="e0" style="float:right;padding-left: 4px;" ><div class="ew-lnk"><span id="e1">Add warranty from <b>$114.99</b></span><span class="ew-si ew-id"></span></div></a><div id="e2" class="u-dspn" style="float:right;padding-left: 4px;"><div id="e3" class="ew-ad-txt u-flL"></div></div><div class="oly_upnl" id="e4"><div class="ew-ad-olp"><div class="ew-olp-ttl">Get additional coverage</div><div class="ew-ad-cnt"><div id="e5" class="ew-ad-cont u-cb"><div id="e6" chk="f" v="270826536918" class="ew-lbl u-flL"></div><div id="e7" class="ew-desc u-flL">1 Year Warranty</div><div class="ew-prc u-flR">$114.99</div></div><div id="e9" class="ew-ad-cont u-cb"><div id="e10" chk="f" v="270826537260" class="ew-lbl u-flL"></div><div id="e11" class="ew-desc u-flL">2 Year Warranty</div><div class="ew-prc u-flR">$174.99</div></div><div class="ew-ad-cfm u-flR"><!--[if lt IE 9]><style type="text/css">.vib .bt {line-height: 1;}</style><![endif]--><span   ><a   style=""  id="_btn" class="btn btn-prim btn-s vi-VR-padRT20" title="" href="javascript:;" >Confirm</a></span></div><div class="u-cb"><div id="e13" class="ew-ad-lnk u-flL"><a href="javascript:;">Learn More</a></div><div id="e14" class="ew-ad-lnk u-flL u-dspn"><a href="javascript:;">Hide details</a></div><div class="ew-ad-nte u-flR">SquareTrade Warranties on eBay</div></div></div><div id="e15" class="ew-lst ew-ad-lst u-dspn"><ul><li><b>Optional coverage offered by SquareTrade</b></li><li><b>Supplements any existing manufacturer or seller warranty</b></li><li><b>Covers mechanical and electrical failures, including normal wear and tear</b></li><li><b>Full item price reimbursement if it can't be fixed</b></li><li><b><a href="http://pages.ebay.com/warranty/squaretrade.html" target="_blank">5 day service guarantee</a></b></li><li><b>Available for new, refurbished, and used items</b></li><li><b>Award-winning customer service with over 100,000 fans on Facebook</b></li><li><b>Additional <a href="http://pages.ebay.com/warranty/squaretrade.html" target="_blank">accidents</a> coverage, if selected, includes <a href="http://pages.ebay.com/warranty/squaretrade.html" target="_blank">drops and spills</a></b></li></ul></div><div id="e16" class="ew-ad-dtl u-cb u-dspn"><a href="http://pages.ebay.com/warranty/squaretrade.html" target="_blank">See warranty details</a></div><div class="ew-ftr ew-ad-ftr">Warranty available only to US or Canadian residents</div></div></div><div class="oly_upnl" id="e17"><div class="ew-bin-olp"><div id="e18" class="ew-trbr"><div class="ew-trbr-txt">Loading...</div></div><div id="e19"><div class="ew-olp-ttl">Thanks for selecting a SquareTrade Warranty on eBay.</div><div class="ew-bin-cnt">The item &amp; warranty have been added to your cart and you'll be able to pay through a single checkout.</div><div class="ew-bin-ftr"><span class="u-flL"><a id="e20">Cancel</a></span><span class="u-flR"><!--[if lt IE 9]><style type="text/css">.vib .bt {line-height: 1;}</style><![endif]--><span   ><a   style=""  id="cfmBtn_btn" class="btn btn-prim btn-s vi-VR-padRT20" title="" href="http://payments.ebay.com/ws/eBayISAPI.dll?ShopCart&ssPageName=VIFS:ATC" >Continue to Cart</a></span></span></div></div></div></div><div class="oly_upnl" id="e21"><div class="ew-atc-olp"><div id="e22" class="ew-trbr"><div class="ew-trbr-txt">Loading...</div></div><div>Please wait while your item and warranty are being added to your cart</div></div></div></div></li></ul><hr style="clear:both;margin-bottom:7px;" class="fdhr vi-VR-fdhrlgt"/><ul><li></li><li  class="vi-VR-scnd-LI"><!--[if lt IE 9]><style type="text/css">.vib .bt {line-height: 1;}</style><![endif]--><span   ><a   style=""  id="boBtn_btn" class="btn btn-prim btn-m vi-VR-btnWdth-L" title="" href="http://offer.ebay.com/ws/eBayISAPI.dll?MakeBestOffer&rev=1&itemId=110954043427" >Make offer</a></span><div class="oly_upnl" id="e23"><div class="bo-olp"><div id="_BO_CNT_ID"></div><div id="_BO_TRBR_ID" class="bo-trbr"><div>Loading... </div><div class="bo-trbr-txt"><a href="http://offer.ebay.com/ws/eBayISAPI.dll?MakeBestOffer&amp;rev=1&amp;itemId=110954043427&amp;_trksid=p2047675.l3239">Resume making your offer</a>, if the page does not update immediately. </div></div></div></div></li></ul></div><hr style="clear:both;" class="fdhr vi-VR-fdhrlgt"/><div class="" style="float:right;clear:both;padding-top:10px;"><span class="ap-numWatcher ap-watchCount"> 5 watchers</span><div class="watchListCmp"><div class="u-flL lable"></div><div class="u-flL w29"></div><div class="u-flL"><style type="text/css">body #Body .btn, body #Body c-std {filter:none;}</style><div class="drpdwnCmp"><span id="atl_btn" class="btn btn-ter btn-split  vi-VR-lst-L" ><a id="atl_btn_lnk" i="-99" n="Watch list" href="javascript:;">Add to watch list</a></span><span id="atl_arr" class="btn btn-ter dropdown-toggle  btn-split-m vi-VR-lstIcon-L" ><a href="javascript:;" class="caret-dn"></a></span></div><div id="addToListDropdown"><div id="atl_drpdwnLayerId" class="drpdwnLayer  c-std" style="display:none; min-width:150px;"><div id="atl_drpdwnListId"><ul class="addToList"><li><a  i="-99" n="Watch list" id="atl_-99" href="javascript:;">Add to Watch list</a></li><li><a t='wish' i="-97" n="Wish list" id="atl_-97" href="javascript:;">Add to Wish list</a></li></ul></div><div class="drpdwnBrk"></div><div id="atl_atnId" class="vi_list_atn"><a n="addtolist" id="atl_addtolist" href="https://signin.ebay.com/ws/eBayISAPI.dll?SignIn&ru=http%3A%2F%2Fcgi.ebay.com%2Fws%2FeBayISAPI.dll%3FViewItem%26actionType%3Dsinginformore%26item%3D110954043427">Sign in for more lists</a></div></div> </div></div><div class="u-cb spcr"></div><div id="atl_status_msg" class="atlstatusMsg"><div class="atlStatusMasgSpr"></div><span id="atl_status_msg_content" ></span></div></div></div><div style="float:right;clear:both;padding-top:10px;"><a class="vi-slt" rel="nofollow" href="http://cgi5.ebay.com/ws/eBayISAPI.dll?SellLikeItem&_trksid=p2047675.l2567&rt=nc&item=110954043427">Sell one like this</a></div><div></div></div><div id="ItemInfoPanel"><div class="leftinfo "><ul class="glance"><li><strong><a id="itC_Anch" href="#desc_cr">Used</a></strong></li><div id="shSummaryOneLine" style="float:left;"><!--[if lt IE 8]><style type="text/css">.sz1200 .leftinfo .glance li.ie7ListStyle {list-style-type: none; width: 290px; margin-left: -16px}.sz980 .leftinfo .glance li.ie7ListStyle {list-style-type: none; width: 280px; margin-left: -16px}</style><![endif]--><li class="vi-sh-summ ie7ListStyle"><a id="ship_Anch" href="#sp_cr"><span id="fshippingCost"><span>Free</span></span><span id="fShippingSvc"> standard shipping </span></a></li> <!-- Add all the conditions needed to suppress the delivery section. --><li class="vi-sh-summ ie7ListStyle" ><a id="del_Anch" href="#sp_cr"><div role="alert" class="sh-del-frst"> Est. delivery between <span><b>Tue. Sep. 25 - <span>Mon. Oct. 1</span></b></span> </div></a></li></div><li style="clear:both;"><a id="returnPolicy_Anch" href="#spr_cr">No returns or exchanges.</a></li><li class="eBp" style="clear:both;"> <a id="eBP_Anch" href="http://pages.ebay.com/coverage/index.html" target="_blank"><div class="eBpImg"><span>  Covered by <b>eBay Buyer Protection</b></span></div></a> </li></ul></div></div><div id="SellerInfoPanel"><div id="SellerPanel"><div class="si-content si-mini-sinfo"><div></div>Sold by <!--[if lt IE 8]><style>body .vi-mbgds3-bkImg {position: relative; padding-right: 2px;top:-2px;}body #Body .vi-mbgds3-bigStar {top:2px;}body #Body .vi-VR-margBtm3 {margin-bottom:0px !important}</style><![endif]--><div class="mbg vi-VR-margBtm3"><a href="http://myworld.ebay.com/nschmidt7?_trksid=p2047675.l2559" title="nschmidt7"> <span class="mbg-nw">nschmidt7</span></a><span class="mbg-l">(<a href="http://feedback.ebay.com/ws/eBayISAPI.dll?ViewFeedback&userid=nschmidt7&iid=110954043427&ssPageName=VIP:feedback&ftab=FeedbackAsSeller&rt=nc&_trksid=p2047675.l2560" title="Feedback Score: 72 ">72</a><span class="vi-mbgds3-bkImg vi-mbgds3-fb50-99" alt="Feedback Score: 72 "title="Feedback Score: 72 "></span>)</span> <span class="mbg-l"></span> </div><div><span >100%Positive feedback</span><span class="simini-sep980" style="padding:0px 5px 0px 5px">|</span><div style="display:inline;"><span class="si-caret-txt" style="white-space: nowrap;"> <a href="http://www.ebay.com/sch/nschmidt7/m.html?item=110954043427&ssPageName=STRK:MESELX:IT&rt=nc&_trksid=p2047675.l2562"> Seller's other items</a> </span></div></div><div style="">Ships from United States</div></div></div></div></div><div style="clear:both;"></div></div><div id="SecondaryInfoPanel"><div id="AdPanel" style=""><div id="rtm_html_1527"></div></div><div id="AdditionalInfo"><div id="Incentives"><div id="incentiveDiv" class=""><div class="incContDiv"><div id="bmlDiv">  <div style=""><table><tbody><tr><td valign="top"  class="vi-VR-firstcol"><img width="77" height="18" alt="BillMeLater" src="http://pics.ebaystatic.com/aw/pics/payments/bml/logoBML_77x18.gif"></td><td style="padding-left:5px;padding-top:4px;"  class="vi-VR-scndcol"><span class="bmlDispMsg"><span style=" font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#333333"> <strong>Spend $899+ & get 18 months financing</strong></span><br><span style=" font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#333333">Subject to credit approval.</span></span><span style="padding-left:5px"><a target="_blank" class="bmlDispLink" href="https://www.billmelater.com/cm/paypal/landers/12ebaybmlappNBj.html">See terms</a></span></td></tr></tbody></table></div></div>  </div></div></div><div id="ItemSpecifics"><div id="itemAttrCntr" class="itemAttr"><div><table width="100%" cellspacing="0" cellpadding="0"><tr><th> Item number</th> <td ><div id="itm_num">110954043427</div> </td></tr><tr><th> Brand</th> <td >Fujifilm </td></tr><tr><th> Megapixels</th> <td >12.3 MP </td></tr><tr><th> Model</th> <td >X100 </td></tr><tr><th> Optical Zoom</th> <td >1x </td></tr><tr><th> MPN</th> <td >16128244 </td></tr><tr><th> Screen Size</th> <td >2.8" </td></tr><tr><th> Type</th> <td >Mirrorless Interchangeable Lens </td></tr><tr><th> Color</th> <td >Black </td></tr><tr><th> UPC</th> <td >4547410151831 </td></tr></table></div></div><div id="see_all_spec"><a href="javascript:;" id="toggleIS">See all specifics</a></div></div></div></div></div>  <div style="clear:both"></div></div></div><div id="vi_zoomEnl_plc_hldr" class="rd-zoom"></div><div id="BottomPanelDF"><div id="BottomPanel" class="rd-btm"><!-- <h2> Bottom panel for Description </h2> --><!--[if IE]><style type="text/css">.rd-sep {border-bottom: 1px solid #D8D8D8;}</style><![endif]--><div style="height:20px; width:100%; clear:both; "></div> <!-- TODO:remove this line --><div id="pwbar" class="pwbar" ><ul><li goto="desc_cr" trklnkid="l2617"><a href="javascript:;">Description</a></li><li goto="sp_cr" trklnkid="l2608"><a href="javascript:;">Shipping and payments</a></li><li goto="si_cr" trklnkid="l2609"><a href="javascript:;">Seller information</a></li><li goto="qa_cr" trklnkid="l2610"><a href="javascript:;">Q&amp;A</a></li></ul></div><div id="dii_cr" class="c-std vi-cntnr " ><div class="prodDetailDesc"><div class="prodDetailSec"><div class="section-ttl"><h3 class="p_det_title">Detailed item info</h3><div class="rd-sep"></div></div><table width="100%"><tr><td><?xml version="1.0" encoding="utf-8"?><table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td colspan="2"><font face="Arial, Helvetica, sans-serif" size="2"><b>Product Information</b></font></td></tr><tr><td colspan="2"><font face="Arial, Helvetica, sans-serif" size="2">The FinePix X100 features a custom 12.3 megapixel APS-C CMOS high-performance sensor, internally optimized and developed exclusively for this model. Optimization of the angle-of-incidence in conjunction with the specially developed lens maximizes light gathering efficiency extending to the perimeter of the sensor for a sharper image with exceptional clarity. When shooting HD movies, the combination of the large-sized sensor and the large aperture F2 lens, lets users create a soft out-of-focus image - a capability not available in conventional compact cameras. The ideal combination of a fixed focal length lens, high-sensitivity sensor (approximately 10 times the sensitivity of a conventional compact) and a high-performance image processor captures extremely high quality images from low sensitivity to high sensitivity. In standard form, the planned ISO range is from 200 to 6400, but this can be expanded to include 100 and 12800.The FinePix X100 is a high precision digital compact camera that combines modern technology with a traditional camera design to deliver the ultimate in image quality. Featuring an APS-C CMOS sensor (12.3 megapixel), a FUJINON 23mm Single Focal Length Fixed F2 lens, a 2.8" LCD 460K, and the world's first Hybrid Viewfinder, the FinePix X100 captures exceptionally high quality images.</font><br class="br"/><br class="br"/></td></tr><tr><td colspan="2"><font face="Arial, Helvetica, sans-serif" size="2"><b>Product Identifiers</b></font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Brand</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Fujifilm</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Model</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">X100</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">MPN</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">16128244</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">UPC</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">4547410151831, 74101008357</font></td></tr><tr><td colspan="2"><br class="br"/></td></tr><tr><td colspan="2"><font face="Arial, Helvetica, sans-serif" size="2"><b>Key Features</b></font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Camera Type</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Mirrorless Interchangeable Lens</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Optical Zoom</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">1x</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Sensor Resolution</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">12.3 MP</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Screen Size</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">2.8"</font></td></tr><tr><td colspan="2"><br class="br"/></td></tr><tr><td colspan="2"><font face="Arial, Helvetica, sans-serif" size="2"><b>Optical Sensor</b></font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Sensor Size</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">15.8 x 23.6mm</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Sensor Type</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">CMOS</font></td></tr><tr><td colspan="2"><br class="br"/></td></tr><tr><td colspan="2"><font face="Arial, Helvetica, sans-serif" size="2"><b>Lens System </b></font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Focal Length Range</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">23mm</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Macro Focus Range</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">0.1-2.0m</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Focus Adjustment</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Automatic, Manual</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Lens System Features</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Aspherical Lens, Built-in Neutral Density Filter</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Auto Focus type</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">TTL contrast detection</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Lens Construction</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">6 group(s) / 8 element(s)</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Lens Manufacturer</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Fujinon</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Focal Length Equivalent to 35mm Camera</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">35mm</font></td></tr><tr><td colspan="2"><br class="br"/></td></tr><tr><td colspan="2"><font face="Arial, Helvetica, sans-serif" size="2"><b>Exposure </b></font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Max Shutter Speed</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">1/4000 sec</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Min Shutter Speed</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">3600 sec</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Exposure compensation</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">±2 EV range, in 1/3 EV steps</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Exposure Metering</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Center-Weighted, Multi-Segment, Spot</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Exposure Modes</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Aperture-Priority, Automatic, Bulb, Manual, Program, Shutter-Priority</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Light Sensitivity</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">ISO 100, ISO 12800, ISO 200-6400, ISO auto</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Light Sensitivity Max</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">12800</font></td></tr><tr><td colspan="2"><br class="br"/></td></tr><tr><td colspan="2"><font face="Arial, Helvetica, sans-serif" size="2"><b>Camera Flash</b></font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Flash Type</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Built-in flash</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Red Eye Reduction</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Yes</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Effective Flash Range</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">0.5 m - 9 m</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Camera Flash Features</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">AF Illuminator</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Flash Modes</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Auto Mode, Fill-in Mode, OFF mode, Red-eye Reduction, Slow Synchro</font></td></tr><tr><td colspan="2"><br class="br"/></td></tr><tr><td colspan="2"><font face="Arial, Helvetica, sans-serif" size="2"><b>Memory / Storage</b></font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Integrated Memory size</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">20 MB</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Supported Flash Memory</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">SD Memory Card, SDHC Memory Card, SDXC Memory Card</font></td></tr><tr><td colspan="2"><br class="br"/></td></tr><tr><td colspan="2"><font face="Arial, Helvetica, sans-serif" size="2"><b>Viewfinder</b></font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Viewfinder Type</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Hybrid (optical/electronic), Optical</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Optical Viewfinder Type</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Real-image</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Viewfinder - Field Coverage</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">90%</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Viewfinder Magnification</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">0.5x</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Viewfinder Diagonal Size</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">0.47</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Dioptric Correction Range</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">-2 to +1</font></td></tr><tr><td colspan="2"><br class="br"/></td></tr><tr><td colspan="2"><font face="Arial, Helvetica, sans-serif" size="2"><b>Dimensions</b></font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Depth</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">2.1 in.</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Height</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">2.9 in.</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Width</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">5 in.</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Weight</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">14.3 Oz.</font></td></tr><tr><td colspan="2"><br class="br"/></td></tr><tr><td colspan="2"><font face="Arial, Helvetica, sans-serif" size="2"><b>Display</b></font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Display Type</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">LCD</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Display Rotation</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Built-in</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Screen Details</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">LCD display - TFT active matrix - 2.8" - color</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Display Size</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">2.8"</font></td></tr><tr><td colspan="2"><br class="br"/></td></tr><tr><td colspan="2"><font face="Arial, Helvetica, sans-serif" size="2"><b>Microphone</b></font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Microphone Type</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Microphone - built-in - stereo</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Microphone Operation Mode</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Stereo</font></td></tr><tr><td colspan="2"><br class="br"/></td></tr><tr><td colspan="2"><font face="Arial, Helvetica, sans-serif" size="2"><b>Connections</b></font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Connector Types</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">1 x HDMI output, 1 x Hi-Speed USB</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Expansion Slot</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">1 x SD Memory Card</font></td></tr><tr><td colspan="2"><br class="br"/></td></tr><tr><td colspan="2"><font face="Arial, Helvetica, sans-serif" size="2"><b>System Requirements for PC Connection</b></font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Operating System Supported</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">MS Windows 7, MS Windows Vista, MS Windows XP</font></td></tr><tr><td colspan="2"><br class="br"/></td></tr><tr><td colspan="2"><font face="Arial, Helvetica, sans-serif" size="2"><b>Battery</b></font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Battery Form Factor</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Manufacturer specific</font></td></tr><tr><td colspan="2"><br class="br"/></td></tr><tr><td colspan="2"><font face="Arial, Helvetica, sans-serif" size="2"><b>File Format</b></font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Digital Video Format</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">H.264, MOV</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Still Image Format</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">JPEG, RAW, RAW + JPEG</font></td></tr><tr><td colspan="2"><br class="br"/></td></tr><tr><td colspan="2"><font face="Arial, Helvetica, sans-serif" size="2"><b>Resolution</b></font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Max Video Resolution</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">1280 x 720</font></td></tr><tr><td colspan="2"><br class="br"/></td></tr><tr><td colspan="2"><font face="Arial, Helvetica, sans-serif" size="2"><b>Environmental Parameters</b></font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Min Operating Temperature</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">0 °C</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Max Operating Temperature</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">40 °C</font></td></tr><tr><td colspan="2"><br class="br"/></td></tr><tr><td colspan="2"><font face="Arial, Helvetica, sans-serif" size="2"><b>Other Features</b></font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Additional Features</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">720p HD Movie Recording, AE/FE Lock, AF Lock, Auto Power Save, Built-In Speaker, Color Control, DPOF Support, Digital Noise Reduction, Diopter Adjustment, Direct Print, Dynamic Range Bracketing, Exif Print Support, Film Simulation Bracketing, Histogram Display, LCD Live View Mode, Motion Panorama, Not Interchangeable Lenses, Orientation Detection, PictBridge Support, RAW Processing, Red eye Fix, Saturation Control, Sharpness Control, Tone Compensation, USB 2.0 Compatibility</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Shooting Modes</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Frame Movie Mode</font></td></tr><tr><td colspan="2"><br class="br"/></td></tr><tr><td colspan="2"><font face="Arial, Helvetica, sans-serif" size="2"><b>Miscellaneous</b></font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Color </font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Black</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Special Effects</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Black & White, Color Filter, Film Simulation</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Continuous Shooting Speed</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">3 frames per second, 5 frames per second</font></td></tr><tr><td width="35%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">Video Capture</font></td><td width="65%" valign="top"><font face="Arial, Helvetica, sans-serif" size="2">H.264 - 1280 x 720 - 24 fps - 600 sec - max clip duration</font></td></tr><tr><td colspan="2"><br class="br"/></td></tr></table></td></tr></table></div></div></div><div id="desc_cr" class="c-std vi-cntnr " ><div class="section-ttl rd-desc-ttl"><div class="desc-ttl"><h2>Description</h2></div><div class="rd-sep"></div></div><div id="desc_div"><table align="center" style="border-spacing: 0px; width: 100%;"><tr><td><div><font face="Arial" size="2">Heres whats included:</font><div><font face="Arial" size="2"><br></font></div><div><font face="Arial" size="2">-Perfect Condition Fuji X100 - Like new used once</font></div><div><font face="Arial" size="2">-All original boxing, documentation and accessories</font></div><div><font face="Arial" size="2">-</font><span style="background-color: rgb(255, 255, 255); font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 17px; text-align: left; ">LH-X100 - Fuji Lens Hood with Adapter Ring for the X100 Camera</span></div><div style="text-align: left;"><font face="Arial, Helvetica, sans-serif"><span style="font-size: 12px; line-height: 17px;">-LC-X100 - Fuji Brown Leather Case</span></font></div></div></td></tr></table></div><div class="legal-txt fit-lyt"><span>Seller assumes all responsibility for this listing.</span><span class="vi-desc-revHistory-lbl">Last updated on</span><span class="rev-date">Sep 19, 2012 12:23:11 PDT.</span><span><a class="all-rev" href="http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItemRevisionDetails&_trksid=p2047675.l2569&rt=nc&item=110954043427">View all revisions</a></span></div><div class="fit-lyt"><div><br/><center><span class=""></span></center></div></div></div><div id="sp_cr" class="c-std vi-cntnr " ><div id="sps_cr"><div class="section-ttl"><h2>Shipping and payments</h2><div class="rd-sep"></div></div>  <div class="sh-tab-bdr"><div id="shipNHadling" class="shippingSection_BottomVI vi-shp"><div id="shId" class="sh-shid section-sttl"><h3 class="sh-title">Shipping and handling</h3></div><div id="shCost-err" class="sh-err-costNotCalculable sh-err-hide"><span title="icon"></span>Shipping cannot be calculated for your area. You can <a href="http://contact.ebay.com/ws/eBayISAPI.dll?ShowCoreAskSellerQuestion&amp;redirect=0&amp;requested=nschmidt7&amp;iid=110954043427" target="_blank">contact the seller</a> for additional shipping costs and services.</div><div id="shCost-err2" class="sh-err-costNotCalculable sh-err-hide"><span title="icon"></span>Shipping cost cannot be calculated. Please enter a valid ZIP Code.</div><div><div id="discounts" class="vi-dm" style="padding-left:15px"></div> <div class="sh-loc"> Item location: Chicago, Illinois, United States</div> <div class="sh-sLoc">Shipping to: Worldwide</div><div style="padding:5px 0px 0px 0px" ></div> <!--[if IE]><style>body #Body #shipNHadling #medium .btn-s {height:28px;}</style><![endif]--><!--[if  IE 7]><style>body #Body  #shipNHadling #medium .btn-s {margin-top:1px;padding-left:0px;padding-right:0px;}</style><![endif]--><!--[if IE 8]><style>body #Body  #shipNHadling #medium .btn-s {margin-top:0px;}</style><![endif]--><!--[if IE 9]><style>body #Body  #shipNHadling #medium .btn-s {margin-top:0px;}</style><![endif]--><div class="sh_calcShipPad" id="medium"><table width="100%" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td width="53%" nowrap="nowrap"><div id="shCountryDiv" class="sh-InlCnt "><div id="shCountry-errIcn" class="sh-err-icon sh-err-hide"></div><label class="sh-ShipDtl" for="shCountry">Change country:</label><select name="country" id="shCountry" class="sh-TxtCnt sh-InlCnt"  ><option value="-99" selected>-Select-</option><optionvalue="4" >Afghanistan</option><optionvalue="5" >Albania</option><optionvalue="6" >Algeria</option><optionvalue="7" >American Samoa</option><optionvalue="8" >Andorra</option><optionvalue="9" >Angola</option><optionvalue="10" >Anguilla</option><optionvalue="11" >Antigua and Barbuda</option><optionvalue="12" >Argentina</option><optionvalue="13" >Armenia</option><optionvalue="14" >Aruba</option><optionvalue="15" >Australia</option><optionvalue="16" >Austria</option><optionvalue="17" >Azerbaijan Republic</option><optionvalue="18" >Bahamas</option><optionvalue="19" >Bahrain</option><optionvalue="20" >Bangladesh</option><optionvalue="21" >Barbados</option><optionvalue="22" >Belarus</option><optionvalue="23" >Belgium</option><optionvalue="24" >Belize</option><optionvalue="25" >Benin</option><optionvalue="26" >Bermuda</option><optionvalue="27" >Bhutan</option><optionvalue="28" >Bolivia</option><optionvalue="29" >Bosnia and Herzegovina</option><optionvalue="30" >Botswana</option><optionvalue="31" >Brazil</option><optionvalue="32" >British Virgin Islands</option><optionvalue="33" >Brunei Darussalam</option><optionvalue="34" >Bulgaria</option><optionvalue="35" >Burkina Faso</option><optionvalue="37" >Burundi</option><optionvalue="38" >Cambodia</option><optionvalue="39" >Cameroon</option><optionvalue="2" >Canada</option><optionvalue="40" >Cape Verde Islands</option><optionvalue="41" >Cayman Islands</option><optionvalue="42" >Central African Republic</option><optionvalue="43" >Chad</option><optionvalue="44" >Chile</option><optionvalue="45" >China</option><optionvalue="46" >Colombia</option><optionvalue="47" >Comoros</option><optionvalue="48" >Congo, Democratic Republic of the</option><optionvalue="49" >Congo, Republic of the</option><optionvalue="50" >Cook Islands</option><optionvalue="51" >Costa Rica</option><optionvalue="52" >Cote d Ivoire (Ivory Coast)</option><optionvalue="53" >Croatia, Republic of</option><optionvalue="55" >Cyprus</option><optionvalue="56" >Czech Republic</option><optionvalue="57" >Denmark</option><optionvalue="58" >Djibouti</option><optionvalue="59" >Dominica</option><optionvalue="60" >Dominican Republic</option><optionvalue="61" >Ecuador</option><optionvalue="62" >Egypt</option><optionvalue="63" >El Salvador</option><optionvalue="64" >Equatorial Guinea</option><optionvalue="65" >Eritrea</option><optionvalue="66" >Estonia</option><optionvalue="67" >Ethiopia</option><optionvalue="68" >Falkland Islands (Islas Malvinas)</option><optionvalue="69" >Fiji</option><optionvalue="70" >Finland</option><optionvalue="71" >France</option><optionvalue="72" >French Guiana</option><optionvalue="73" >French Polynesia</option><optionvalue="74" >Gabon Republic</option><optionvalue="75" >Gambia</option><optionvalue="76" >Georgia</option><optionvalue="77" >Germany</option><optionvalue="78" >Ghana</option><optionvalue="79" >Gibraltar</option><optionvalue="80" >Greece</option><optionvalue="81" >Greenland</option><optionvalue="82" >Grenada</option><optionvalue="83" >Guadeloupe</option><optionvalue="84" >Guam</option><optionvalue="85" >Guatemala</option><optionvalue="86" >Guernsey</option><optionvalue="87" >Guinea</option><optionvalue="88" >Guinea-Bissau</option><optionvalue="89" >Guyana</option><optionvalue="90" >Haiti</option><optionvalue="91" >Honduras</option><optionvalue="92" >Hong Kong</option><optionvalue="93" >Hungary</option><optionvalue="94" >Iceland</option><optionvalue="95" >India</option><optionvalue="96" >Indonesia</option><optionvalue="98" >Iraq</option><optionvalue="99" >Ireland</option><optionvalue="100" >Israel</option><optionvalue="101" >Italy</option><optionvalue="102" >Jamaica</option><optionvalue="104" >Japan</option><optionvalue="105" >Jersey</option><optionvalue="106" >Jordan</option><optionvalue="107" >Kazakhstan</option><optionvalue="108" >Kenya</option><optionvalue="109" >Kiribati</option><optionvalue="111" >Korea, South</option><optionvalue="112" >Kuwait</option><optionvalue="113" >Kyrgyzstan</option><optionvalue="114" >Laos</option><optionvalue="115" >Latvia</option><optionvalue="116" >Lebanon</option><optionvalue="117" >Lesotho</option><optionvalue="118" >Liberia</option><optionvalue="119" >Libya</option><optionvalue="120" >Liechtenstein</option><optionvalue="121" >Lithuania</option><optionvalue="122" >Luxembourg</option><optionvalue="123" >Macau</option><optionvalue="124" >Macedonia</option><optionvalue="125" >Madagascar</option><optionvalue="126" >Malawi</option><optionvalue="127" >Malaysia</option><optionvalue="128" >Maldives</option><optionvalue="129" >Mali</option><optionvalue="130" >Malta</option><optionvalue="131" >Marshall Islands</option><optionvalue="132" >Martinique</option><optionvalue="133" >Mauritania</option><optionvalue="134" >Mauritius</option><optionvalue="135" >Mayotte</option><optionvalue="136" >Mexico</option><optionvalue="226" >Micronesia</option><optionvalue="137" >Moldova</option><optionvalue="138" >Monaco</option><optionvalue="139" >Mongolia</option><optionvalue="228" >Montenegro</option><optionvalue="140" >Montserrat</option><optionvalue="141" >Morocco</option><optionvalue="142" >Mozambique</option><optionvalue="143" >Namibia</option><optionvalue="144" >Nauru</option><optionvalue="145" >Nepal</option><optionvalue="146" >Netherlands</option><optionvalue="147" >Netherlands Antilles</option><optionvalue="148" >New Caledonia</option><optionvalue="149" >New Zealand</option><optionvalue="150" >Nicaragua</option><optionvalue="151" >Niger</option><optionvalue="152" >Nigeria</option><optionvalue="153" >Niue</option><optionvalue="154" >Norway</option><optionvalue="155" >Oman</option><optionvalue="156" >Pakistan</option><optionvalue="157" >Palau</option><optionvalue="158" >Panama</option><optionvalue="159" >Papua New Guinea</option><optionvalue="160" >Paraguay</option><optionvalue="161" >Peru</option><optionvalue="162" >Philippines</option><optionvalue="163" >Poland</option><optionvalue="164" >Portugal</option><optionvalue="165" >Puerto Rico</option><optionvalue="166" >Qatar</option><optionvalue="227" >Reunion</option><optionvalue="167" >Romania</option><optionvalue="168" >Russian Federation</option><optionvalue="169" >Rwanda</option><optionvalue="170" >Saint Helena</option><optionvalue="171" >Saint Kitts-Nevis</option><optionvalue="172" >Saint Lucia</option><optionvalue="173" >Saint Pierre and Miquelon</option><optionvalue="174" >Saint Vincent and the Grenadines</option><optionvalue="175" >San Marino</option><optionvalue="176" >Saudi Arabia</option><optionvalue="177" >Senegal</option><optionvalue="229" >Serbia</option><optionvalue="178" >Seychelles</option><optionvalue="179" >Sierra Leone</option><optionvalue="180" >Singapore</option><optionvalue="181" >Slovakia</option><optionvalue="182" >Slovenia</option><optionvalue="183" >Solomon Islands</option><optionvalue="184" >Somalia</option><optionvalue="185" >South Africa</option><optionvalue="186" >Spain</option><optionvalue="187" >Sri Lanka</option><optionvalue="189" >Suriname</option><optionvalue="191" >Swaziland</option><optionvalue="192" >Sweden</option><optionvalue="193" >Switzerland</option><optionvalue="196" >Taiwan</option><optionvalue="197" >Tajikistan</option><optionvalue="198" >Tanzania</option><optionvalue="199" >Thailand</option><optionvalue="200" >Togo</option><optionvalue="201" >Tonga</option><optionvalue="202" >Trinidad and Tobago</option><optionvalue="203" >Tunisia</option><optionvalue="204" >Turkey</option><optionvalue="205" >Turkmenistan</option><optionvalue="206" >Turks and Caicos Islands</option><optionvalue="207" >Tuvalu</option><optionvalue="208" >Uganda</option><optionvalue="209" >Ukraine</option><optionvalue="210" >United Arab Emirates</option><optionvalue="3" >United Kingdom</option><optionvalue="1" selected>United States</option><optionvalue="211" >Uruguay</option><optionvalue="212" >Uzbekistan</option><optionvalue="213" >Vanuatu</option><optionvalue="214" >Vatican City State</option><optionvalue="215" >Venezuela</option><optionvalue="216" >Vietnam</option><optionvalue="217" >Virgin Islands (U.S.)</option><optionvalue="218" >Wallis and Futuna</option><optionvalue="219" >Western Sahara</option><optionvalue="220" >Western Samoa</option><optionvalue="221" >Yemen</option><optionvalue="223" >Zambia</option><optionvalue="224" >Zimbabwe</option></select></div><div id="shQuantity-errTxt" class="sh-err-text sh-err-hide">There are 1 items available. Please enter a number less than or equal to 1.</div><div id="shCountry-errTxt" class="sh-err-text sh-err-hide">Select a valid country.</div></td><td width="47%"><div class="sh-InlCnt sh-float-l " id="shZipCodeDiv"><div id="shZipCode-errIcn" class="sh-err-icon sh-err-hide"></div> <label class="sh-ShipDtl" for="shZipCode" id="shZipCodeTextDiv">ZIP Code:</label><div class="sh-ZipAln sh-InlCnt"><input type="text" class="sh-TxtCnt" name="zipCode"size="12" id="shZipCode" value="" /></div><div id="shZipCode-errTxt" class="sh-err-text sh-err-hide">Please enter a valid ZIP Code.</div><div id="shZipCode-errTxt2" class="sh-err-text sh-err-hide">Please enter 5 or 9 numbers for the ZIP Code.</div></div><div id="shGetRatesDiv" class="sh-InlCnt "><input type="button" class="sh-BtnTxt btn btn-s btn-ter" name="getRates"id="shGetRates" value="Get rates" /></div></td></tr></tbody></table></div> <div id="shippingSection" aria-live="assertive" style="padding:10px;"><table class="sh-tbl"><thead><tr><th><div>Shipping and handling</div></th><th><div>To</div></th><th><div>Service</div></th><th><div>Delivery*</div></th></tr></thead><tbody><tr><td> <div style="font-weight:bold;">Free shipping</div></td> <td>  <div>United States</div></td><td> <div>Standard Shipping<sup></sup></div><div></div></td> <td><div role="alert" class="sh-del-frst "> Estimated between <span><b>Tue. Sep. 25 and Mon. Oct. 1</b></span></div></td>  </tr><tr><td> <div>Free Local Pickup</div></td> <td>  <div>United States</div></td><td> <div>Local Pickup<sup></sup></div></td> <td><div role="alert" class="sh-del-frst "> </div></td>  </tr> </tbody></table> <div id="instrTextTable" style="border-top:1px solid #c4c4c4; padding:5px 10px 15px 18px;font-family:Verdana; font-size:x-small; font-weight:normal; color:#999; margin-left:10px; margin-right:10px"> * <a href="http://pages.ebay.com/help/buy/contextual/estimated-delivery.html" target="_blank">Estimated delivery dates</a> include seller's handli

Problem with / character in html

If html code sets an attribute to a string with a / and is not quoted properly then csquery fails to work as shown below. Code in browser works fine.

Sample 1:

          CQ doc = new CQ("<div custattribute=10/23/2012 id=\"tableSample\"><span>sample text</span></div>");
            IDomElement obj = doc["#tableSample"].FirstElement();
        obj equals null, because invalid html was loaded.

Sample 2:

            doc = new CQ("<div custattribute=\"10/23/2012\" id=\"tableSample\"><span>sample text</span></div>");
            obj = doc["#tableSample"].FirstElement();
        obj keeps div element

slow .text()

.text() works very slow sometimes freezing indefinitely:

example

Url:

http://www.ebay.com/itm/Samsung-Galaxy-S-Captivate-SGH-I897-16GB-Black-Unlocked-Smartphone-/271090276288?pt=Cell_Phones&hash=item3f1e3d57c0

code:

htmlDOC[".prodDetailSec table"].Text();

'input' and ':hidden' don't play nice

Example:
$("<input name='domContent' />").is(":hidden") works in Javascript (== false)
CQ.Create(@"<span name='domContent' value='' />").Is(":hidden"); works in CsQuery (== false)
CQ.Create(@"<input name='domContent' value='' />").Is(":hidden");, on the other hand...

System.NullReferenceException : Object reference not set to an instance of an object.
   at CsQuery.Implementation.DomElement.get_Type()
   at CsQuery.Engine.PseudoSelectors.ElementIsItselfHidden(IDomElement el)
   at CsQuery.Engine.PseudoSelectors.IsVisible(IDomObject obj)
   at CsQuery.Engine.CssSelectionEngine.MatchesPseudoClass(IDomElement elm, SelectorClause clause)
   at CsQuery.Engine.CssSelectionEngine.Matches(SelectorClause selector, IDomObject obj, Int32 depth)
   at CsQuery.Engine.CssSelectionEngine.<GetMatches>d__11.MoveNext()
   at CsQuery.ExtensionMethods.ExtensionMethods.AddRange[T](ICollection`1 baseList, IEnumerable`1 list)
   at CsQuery.Engine.CssSelectionEngine.<Select>d__2.MoveNext()
   at System.Collections.Generic.HashSet`1.UnionWith(IEnumerable`1 other)
   at System.Collections.Generic.HashSet`1..ctor(IEnumerable`1 collection, IEqualityComparer`1 comparer)
   at CsQuery.Engine.Selector.<Filter>d__6.MoveNext()
   at CsQuery.CQ..ctor(IEnumerable`1 elements)
   at CsQuery.CQ.Filter(String selector)
   at CsQuery.CQ.Is(String selector)

CSQuery Exception when ID of HTML Element contains space

CSQuery causes an exception when an ID of an html element contains a space Ex. <img id="image test" src="url"/>. I know that spaces in the ID are not allowed in valid IDs but it would be nice if CSQuery gracefully recovered from it. Not sure what the optimal behavior should be whether it should be just not found if searched on or behind the scenes setting a delimter and translating between the two automatically Ex: query for ('img test') converted to ('img_test') when parsed and when also searched on. The only downfall I see is this may create a duplicate ID in the DOM.

fragment.render encodes norwegian(possibley others as well) characters

Dim fragment = CsQuery.CQ.Create(value)
Dim res As String = fragment.Render(CsQuery.DomRenderingOptions.QuoteAllAttributes Or CsQuery.DomRenderingOptions.RemoveComments)

The Norwegian charcters æøå gets HTMLEncoded to &# xxx; format

Maybe add an option to CsQuery.DomRenderingOptions to keep such characters

Problem with :not( selector )

I reckon there is a little bug in :not( selector ).

For example,
----csQuery----:
CQ dom = CQ.CreateFromUrl("http://www.franchisebusiness.com.au/c/ABS-Auto-Brake-Service");
CQ items = dom.Select(".items:not(.relatedListingsContainer .items)");
int itemLength = items.Length; // itemLength = 2

----jQuery----: (I directly tested from Google Chrome's console panel):
var items = $(".items:not(.relatedListingsContainer .items)");
var itemLength = items.length; // itemLength = 0

How come "itemLength" is different on jQuery and csQuery? or How am I gonna get similar result using csQuery?

Corner case for fragments

    Dim s As String = "a < b"
    Dim cs = CsQuery.CQ.Create(s)
    Assert.AreEqual("a &lt; b", cs.Render())

Do not work..

cs.Render returns "a "

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.