Commit Graph

850 Commits

Author SHA1 Message Date
Yorick Peterse 6753d6a26d Slightly better docs for the XPath/CSS parsers. 2014-11-16 23:40:19 +01:00
Yorick Peterse 57adabc068 Ensure SAX after_element receives meaningful args
This changes the behaviour of after_element when parsing documents using the SAX
parsing API. Previously it would always receive a nil argument, which is kinda
pointless. This commit changes that by making sure it receives a namespace name
(if any) and the element name.

This fixes #54.
2014-11-16 23:32:32 +01:00
Yorick Peterse 8c8ecce447 Added README note on default namespaces.
This closes #57.
2014-11-16 23:08:32 +01:00
Yorick Peterse 67abe7731e Added CSS selectors to the list of features. 2014-11-16 22:55:44 +01:00
Yorick Peterse e02cb54fa2 Added class/ID selectors to CSS spec. 2014-11-16 22:53:30 +01:00
Yorick Peterse da36c53321 Syntax for wildcard selector in the CSS spec. 2014-11-16 00:36:02 +01:00
Yorick Peterse 3c944f77c9 Added pseudo class syntax to CSS spec. 2014-11-15 21:29:53 +01:00
Yorick Peterse 181a0c3bc8 Added docs on remaining pseudo classes. 2014-11-15 21:20:53 +01:00
Yorick Peterse 02e00019ff Overwrite installation procedure for Travis.
See https://github.com/travis-ci/travis-ci/issues/2821
and https://github.com/rubygems/rubygems/pull/1005.
2014-11-15 19:43:40 +01:00
Yorick Peterse 8b28656087 Cleaned up Travis config. 2014-11-15 19:12:58 +01:00
Yorick Peterse 7990e63678 Use rbx-2 for Travis. 2014-11-15 19:10:43 +01:00
Yorick Peterse 23b408fe4f Cleaned up CSS parser code for counting siblings. 2014-11-15 18:31:08 +01:00
Yorick Peterse 448ff56e38 Fixed CSS eval specs for nth-(first|last)-of-type. 2014-11-15 18:27:26 +01:00
Yorick Peterse b464815577 Fixed AST generation for nth-(first|last)-of-type. 2014-11-15 18:27:15 +01:00
Yorick Peterse 9eead81a7c Fixed AST for :only-of-type 2014-11-15 18:08:26 +01:00
Yorick Peterse 1c301d40e2 Properly fixed AST for first-of-type/last-of-type
This requires keeping track of the current element being processed. This in turn
allows the usage of count() + preceding-sibling/following-sibling.
2014-11-15 17:58:56 +01:00
Yorick Peterse e559b4b89b Corrected :first-of-type eval spec. 2014-11-15 17:20:17 +01:00
Yorick Peterse f1d574f342 Evaluate XPath predicates for every context node.
Instead of evaluating a predicate once for all context nodes, they should
instead be evaluated separately per context node.
2014-11-15 00:31:44 +01:00
Yorick Peterse 6daa3e7a00 Reverted AST changes for first-of-type
Functions can't be used in combination with axes, so I'll just need to fix the
position() function to work properly.
2014-11-14 23:51:46 +01:00
Yorick Peterse 2d6a2be2e8 Revert "Fixed XPath AST for :last-of-type"
Axes can't be used in combination with functions.

This reverts commit b0b572a584.
2014-11-14 23:49:49 +01:00
Yorick Peterse 8f3553f8f1 Fixed eval specs of :first-of-type & :last-of-type 2014-11-14 23:27:52 +01:00
Yorick Peterse b0b572a584 Fixed XPath AST for :last-of-type
This should count following nodes, not merely the position.
2014-11-14 23:27:15 +01:00
Yorick Peterse 0128dc50ae Fixed CSS evaluation of :first-of-type
The old XPath "position() = 1" would work in Nokogiri due to the way they
retrieve descendants. In Oga however this would simply always return the first
node.

To fix this Oga now counts the amount of preceding siblings that match the same
full name.
2014-11-14 01:25:03 +01:00
Yorick Peterse e3a26c5d15 Allow querying of nodes using CSS. 2014-11-14 01:05:29 +01:00
Yorick Peterse 913eb6a15a Added various extra pseudos to the CSS spec. 2014-11-14 01:02:58 +01:00
Yorick Peterse d47ca19ffa Remaining CSS evaluation specs. 2014-11-14 00:24:54 +01:00
Yorick Peterse 518bedc3a1 CSS evaluator specs for :nth-of-type 2014-11-14 00:16:35 +01:00
Yorick Peterse abfe6e3d61 CSS evaluator specs for nth-last-of-type 2014-11-14 00:13:11 +01:00
Yorick Peterse c874ceabb9 CSS evaluator specs for :nth-last-child 2014-11-13 23:54:47 +01:00
Yorick Peterse 5964a2cda4 CSS evaluator specs for :nth-child(n) 2014-11-13 22:50:04 +01:00
Yorick Peterse 3237617bf5 CSS eval specs for various pseudo classes.
This includes the following pseudos:

* :empty
* :first-child
* :first-of-type
* :last-child
* :last-of-type
2014-11-13 10:10:31 +01:00
Yorick Peterse 19e9834583 Compare XPath benchmark blocks. 2014-11-13 01:18:16 +01:00
Yorick Peterse 01b88d8c68 Use correct root for preceding/following(-sibling)
This ensures these axes work correctly when scoped to a node instead of a
document.
2014-11-13 01:11:29 +01:00
Yorick Peterse 27ffa4d3d5 Added various failing following/preceding specs. 2014-11-13 01:11:13 +01:00
Yorick Peterse b0f6409d1e Wrap predicate nodes around others in CSS ASTs. 2014-11-13 00:47:26 +01:00
Yorick Peterse 97a9a11db1 Failing CSS evaluation specs for the axes.
These currently fail due to the ~ and + axes not being evaluated properly.
2014-11-12 23:38:17 +01:00
Yorick Peterse 817a5e075b Wrap predicate AST nodes _around_ other nodes.
This means that "foo[1]" uses this AST:

    (predicate (test nil "foo") (int 1))

Instead of this AST:

    (test nil "foo" (int 1))

This makes it easier for the XPath evaluator to process predicates correctly.
2014-11-12 22:59:38 +01:00
Yorick Peterse 24350fa457 Added various predicate specs for XPath axes. 2014-11-12 09:40:22 +01:00
Yorick Peterse c15604a86f CSS evaluator specs for IDs. 2014-11-11 00:21:28 +01:00
Yorick Peterse b9e1b51270 CSS evaluator specs for classes. 2014-11-11 00:18:44 +01:00
Yorick Peterse 43200238c5 CSS evaluator specs for predicates and operators. 2014-11-10 23:21:00 +01:00
Yorick Peterse d5002010fe Removed RSpec shared examples. 2014-11-10 00:06:26 +01:00
Yorick Peterse 1f855dc982 Rewrote CSS evaluator paths spec. 2014-11-09 23:51:23 +01:00
Yorick Peterse fb1927a7c7 Removed use of shared examples in Element specs. 2014-11-09 23:44:14 +01:00
Yorick Peterse ccbb19a42d Rewrote all XPath evaluator type specs. 2014-11-09 23:43:01 +01:00
Yorick Peterse c5c3c5dbc3 Rewrote all XPath evaluator type test specs. 2014-11-09 23:39:47 +01:00
Yorick Peterse ca5da3f9c9 Rewrote all XPath evaluator operator tests. 2014-11-09 23:31:05 +01:00
Yorick Peterse 28a1f1b8a9 Rewrote all XPath evaluator call specs. 2014-11-09 23:23:52 +01:00
Yorick Peterse 58209cbad0 Rewrote all XPath axis specs. 2014-11-09 22:53:47 +01:00
Yorick Peterse 5f13cc9d73 Rewrote XPath evaluator wildcards spec. 2014-11-09 18:56:49 +01:00