Improve handling of vectors of length > 1 in logical comparison. Contributed by Garrick Aden-Buie.
Minor improvements to error message construction. Contributed by Michael Chirico.
When the R.oo package is attached, the use of class
selectors no longer worked. This is due to the use of the Class
name for R.oo's base class object, where selectr was also
using it (but not exporting) the same name of Class
for
representing a class selector. Consequently, selectr's code was
changed to rename the class to avoid any clashing. Because it was not
exported, this is purely an internal change. Thanks to
Francois Lemaire-Sicre for reporting the issue.
Large rewrite of internals to use the R6 OO system instead of Reference Classes. This does not affect any external facing code as the results should be identical to the previous implementation, which is why this change is marked as minor. Initial and crude performance testing (by running the test suite) indicates that the R6 implementation is approximately twice as fast at generating XPath as the Reference Classes implementation.
The minimum required version of R for selectr has been
increased from 2.15.2
to 3.0
as that is the minimum
required version of R6.
Minor performance enhancements have been made. Not only is
R6 faster than Reference Classes, the use of string formatting
has been replaced with string concatenation. Additionally dynamic
calling of methods via do.call()
has been replaced with direct
method calls.
The issues in previous releases where methods can sometimes be missing should now be resolved. The bug appeared to lie in core Reference Classes code. By switching to R6, this type of issue should no longer be possible.
Improved method registration for XML and xml2 objects. Avoids checks on each use and is only performed once per dependent package load/unload.
In some environments, reference class methods were missing at
runtime. This appears to be due to some internal behaviour in them
methods package where methods are registered on an objects when
the $
operator is used for a field or method. Instead, when
a method is missing, they are manually bound to the object.
Enabled partial matching on the translator argument to
css_to_xpath()
. Instead of defaulting to a generic translator,
a non-matching argument will be returned with an error.
Introduced many more unit tests via the covr package.
This enabled dead code to be trimmed and also identified areas of code
which needed improvement. Minor enhancements include: tolerate
whitespace within a :not()
, more consistent results returned
from parser methods, improvements to argument parsing.
The |=
attribute matching operator was not being parsed
correctly for the generic translator.
Handle scenario where a CSS comment is unclosed. Results in everything after the comment start to be removed (which may or may not result in a valid selector).
Added support for documents from the xml2 package.
selectr now also does not strictly depend on the XML
package. If either the XML or xml2 packages are
present (which are required for the querySelector
methods
to work) then querySelector
will begin to work for them.
This also enables selectr to be used for translation-only.
Improve support for nth-*(an+b) selectors. Ported from cssselect.
Code cleanup contributed by Kun Ren (#1).
Updated DESCRIPTION to include URL and BugReports fields. Also update email address.
Fix behaviour for nth-*(an+b) pseudo-class selectors for negative a's. Contributed to cssselect by Paul Tremberth, ported to R.
Escape delimiting characters to support new version of the stringr package. Probably should have been done in the first place. Reported by Hadley Wickham (#5).
Corrected licence to BSD 3 clause. This was the licence in use previously, but has now been made more explicit.
Removed 'Enhances' field because we import functions from XML. This choice is made because XML is a required package, rather than an optional package that can be worked with. This and the previous change have been made to keep up with recent changes in R-devel.
Added a 'CITATION' file which cites a technical report on the package.
show()
methods are now available on internal objects,
making interactive extensibility and bug-fixing easier. This is
simply wrapping the repr()
methods (mirroring the Python
source) that the same objects have.
Use the session character encoding to determine whether to run unicode tests. Tests break in non-unicode sessions otherwise.
Introduced new functions querySelectorNS()
and
querySelectorAllNS()
to ease the use of namespaces within a
document. Previously this would have required knowledge of XPath.
Fix meaning of :empty
, whitespace is not empty.
Use lang()
for XML documents with the :lang()
CSS selector.
|ident
no longer produces a parsing error, but is now
equivalent to just 'ident'.
Now testing unicode only in non-Windows platforms on package check. Output should still be consistent, just depends on the current charset being unicode.
Initial port of the Python 'cssselect' package. Code is very literally ported, including the test suite.
Wrapped translation functionality into a single function,
css_to_xpath()
.
Created two convenience functions, querySelector()
and
querySelectorAll()
. These mirror the behaviour of the same
functions present in a web browser. querySelector()
returns a
node, while querySelectorAll()
returns a list of nodes.