Yorick Peterse
47a3c5e7f8
Use describe/it instead of context/example.
...
This keeps things consistent with the general testing guidelines in the Ruby
community. This in turn should hopefully make my life easier as I don't have to
tell people to use this rather odd stlye I was using before.
2015-01-08 23:01:53 +01:00
Yorick Peterse
746c8052dd
Remove all nodes when calling Element#inner_text=
...
This fixes #64 .
2014-12-14 23:32:43 +01:00
Dmitry Krasnoukhov
26baf89440
Add missing entities to the decode/encode lists
2014-11-21 01:53:11 +02:00
Yorick Peterse
cbb2815146
Support for inline doctype rules plus newlines.
...
This adds support for lexing/parsing XML documents that use an IO as input _and_
contain doctype rules with newlines in them.
This fixes #63 .
2014-11-18 20:02:55 +01:00
Yorick Peterse
ad4f650c5d
Fixed XML entity encoding/decoding ordering.
...
Thanks to @krasnoukhov for providing the initial patch, which this commit is
largely based on.
This fixes #49 .
2014-11-17 22:39:43 +01:00
Yorick Peterse
cd86d5d294
Allow removal of element attributes.
2014-11-17 09:00:40 +01:00
Yorick Peterse
804646cc5e
Don't modify raw namespaces.
...
When calling Element#available_namespaces the list of namespaces returned by
Element#namespaces must not be modified.
2014-11-17 00:01:16 +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
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
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
27ffa4d3d5
Added various failing following/preceding specs.
2014-11-13 01:11:13 +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
Yorick Peterse
ceed3a6046
Rewrote XPath evaluator predicates spec.
2014-11-09 18:52:04 +01:00
Yorick Peterse
3893e56ca8
Rewrote XPath evaluator paths spec.
...
This is the first spec of many that will be re-written. Eventually this will
remove the need of the shared examples as well as removing lots of code
duplication and odd context blocks.
2014-11-09 18:47:20 +01:00
Yorick Peterse
857ac517d5
Added XML::NodeSet#==
...
This method can be used to compare two NodeSet instances. By using
XML::NodeSet#equal_nodes?() the need for exposing the "nodes" instance variable
is also removed.
2014-11-09 18:33:16 +01:00
Yorick Peterse
7e38e20586
Use "include" vs "return" in CSS path spec.
2014-11-07 09:28:18 +01:00
Yorick Peterse
a586a512b8
Removed support for CSS such as "|X"
...
This expression could be used to get all elements that _don't_ have any
namespace. The problem is that this can't be expressed as just a node test,
instead the resulting XPath would have to look something like the following:
X[local-name() = name()]
However, since the XPath predicates are already created for pseudo classes and
such, also injecting the above into it would be a real big pain. As such I've
decided not to support it.
2014-11-05 00:45:40 +01:00
Yorick Peterse
661741268a
CSS parser tests for paths with namespaces.
2014-11-05 00:44:23 +01:00
Yorick Peterse
61801fe562
Allow CSS identifiers to start with an underscore.
2014-11-05 00:37:40 +01:00
Yorick Peterse
f1316c50fb
Allow XPath idents to start with an underscore.
...
This is valid in XML so XPath should support it as well.
2014-11-05 00:35:47 +01:00