1.13.0 / 2022-01-06
Notes
Ruby
This release introduces native gem support for Ruby 3.1. Please note that Windows users should use the x64-mingw-ucrt
platform gem for Ruby 3.1, and x64-mingw32
for Ruby 2.6–3.0 (see RubyInstaller 3.1.0 release notes).
This release ends support for:
- Ruby 2.5, for which official support ended 2021-03-31.
- JRuby 9.2, which is a Ruby 2.5-compatible release.
Faster, more reliable installation: Native Gem for ARM64 Linux
This version of Nokogiri ships experimental native gem support for the aarch64-linux
platform, which should support AWS Graviton and other ARM Linux platforms. We don't yet have CI running for this platform, and so we're interested in hearing back from y'all whether this is working, and what problems you're seeing. Please send us feedback here: Feedback: Have you used the aarch64-linux
native gem?
Publishing
This version of Nokogiri opts-in to the "MFA required to publish" setting on Rubygems.org. This and all future Nokogiri gem files must be published to Rubygems by an account with multi-factor authentication enabled. This should provide some additional protection against supply-chain attacks.
A related discussion about Trust exists at #2357 in which I invite you to participate if you have feelings or opinions on this topic.
Dependencies
- [CRuby] Vendored libiconv is updated from 1.15 to 1.16. (Note that libiconv is only redistributed in the native windows and native darwin gems, see
LICENSE-DEPENDENCIES.md
for more information.) [#2206] - [CRuby] Upgrade mini_portile2 dependency from
~> 2.6.1
to~> 2.7.0
. ("ruby" platform gem only.)
Improved
{XML,HTML4}::DocumentFragment
constructors all now take an optional parse options parameter or block (similar to Document constructors). [#1692] (Thanks, @JackMc!)Nokogiri::CSS.xpath_for
allows anXPathVisitor
to be injected, for finer-grained control over how CSS queries are translated into XPath.- [CRuby]
XML::Reader#encoding
will return the encoding detected by the parser when it's not passed to the constructor. [#980] - [CRuby] Handle abruptly-closed HTML comments as recommended by WHATWG. (Thanks to tehryanx for reporting!)
- [CRuby]
Node#line
is no longer capped at 65535. libxml v2.9.0 and later support a new parse option, exposed asNokogiri::XML::ParseOptions::PARSE_BIG_LINES
, which is turned on by default inParseOptions::DEFAULT_{XML,XSLT,HTML,SCHEMA}
(Note that JRuby already supported large line numbers.) [#1764, #1493, #1617, #1505, #1003, #533] - [CRuby] If a cycle is introduced when reparenting a node (i.e., the node becomes its own ancestor), a
RuntimeError
is raised. libxml2 does no checking for this, which means cycles would otherwise result in infinite loops on subsequent operations. (Note that JRuby already did this.) [#1912] - [CRuby] Source builds will download zlib and libiconv via HTTPS. ("ruby" platform gem only.) [#2391] (Thanks, @jmartin-r7!)
- [JRuby]
Node#line
behavior has been modified to return the line number of the node in the final DOM structure. This behavior is different from CRuby, which returns the node's position in the input string. Ideally the two implementations would be the same, but at least is now officially documented and tested. The real-world impact of this change is that the value returned in JRuby is greater by 1 to account for the XML prolog in the output. [#2380] (Thanks, @dabdine!)
Fixed
- CSS queries on HTML5 documents now correctly match foreign elements (SVG, MathML) when namespaces are not specified in the query. [#2376]
XML::Builder
blocks restore context properly when exceptions are raised. [#2372] (Thanks, @ric2b and @rinthedev!)- The
Nokogiri::CSS::Parser
cache now uses theXPathVisitor
configuration as part of the cache key, preventing incorrect cache results from being returned when multipleXPathVisitor
options are being used. - Error recovery from in-context parsing (e.g.,
Node#parse
) now always uses the correctDocumentFragment
class. PreviouslyNokogiri::HTML4::DocumentFragment
was always used, even for XML documents. [#1158] DocumentFragment#>
now works properly, matching a CSS selector against only the fragment roots. [#1857]XML::DocumentFragment#errors
now correctly contains any parsing errors encountered. Previously this was always empty. (Note thatHTML::DocumentFragment#errors
already did this.)- [CRuby] Fix memory leak in
Document#canonicalize
when inclusive namespaces are passed in. [#2345] - [CRuby] Fix memory leak in
Document#canonicalize
when an argument type error is raised. [#2345] - [CRuby] Fix memory leak in
EncodingHandler
where iconv handlers were not being cleaned up. [#2345] - [CRuby] Fix memory leak in XPath custom handlers where string arguments were not being cleaned up. [#2345]
- [CRuby] Fix memory leak in
Reader#base_uri
where the string returned by libxml2 was not freed. [#2347] - [JRuby] Deleting a
Namespace
from aNodeSet
no longer modifies thehref
to be the default namespace URL. - [JRuby] Fix XHTML formatting of closing tags for non-container elements. [#2355]
Deprecated
- Passing a
Nokogiri::XML::Node
as the second parameter toNode.new
is deprecated and will generate a warning. This parameter should be a kind ofNokogiri::XML::Document
. This will become an error in a future version of Nokogiri. [#975] Nokogiri::CSS::Parser
,Nokogiri::CSS::Tokenizer
, andNokogiri::CSS::Node
are now internal-only APIs that are no longer documented, and should not be considered stable. With the introduction ofXPathVisitor
injection intoNokogiri::CSS.xpath_for
there should be no reason to rely on these internal APIs.- CSS-to-XPath utility classes
Nokogiri::CSS::XPathVisitorAlwaysUseBuiltins
andXPathVisitorOptimallyUseBuiltins
are deprecated. PreferNokogiri::CSS::XPathVisitor
with appropriate constructor arguments. These classes will be removed in a future version of Nokogiri.
SHA256 checksums:
d147a8feff7faa67de26b152a303a0bbad8ea77ab75e64f4ccf3614b12641dbc nokogiri-1.13.0-aarch64-linux.gem
4455dcfedeee00e1b02ddc1df5cf1fc60b72b5bae9ca53d234c85d48b169894e nokogiri-1.13.0-arm64-darwin.gem
1a0283e525c74b97cf84d60a842e978d98a00789115e4d528d7784551909ff70 nokogiri-1.13.0-java.gem
c575d5b22132c78b95279cff259aa21fbb2f185fc7e6967c886138ba2d7286c4 nokogiri-1.13.0-x64-mingw-ucrt.gem
0607ce088cac95e7bde9d05ad9c5e8b7c342628228bca8302b966c456e9f6160 nokogiri-1.13.0-x64-mingw32.gem
d313b61192a23793af5b5ca469ec80561933cf4fa958a0106df9dcf031e76077 nokogiri-1.13.0-x86-linux.gem
dc5f9ee89b297d4f7c1e53de295243b9e6d175d5042960ea5d001eb1b1df1fd7 nokogiri-1.13.0-x86-mingw32.gem
039372ceb6e5903f70cc5a960a7d141455b2480e0d268234f14bde69347c571c nokogiri-1.13.0-x86_64-darwin.gem
03b95ba61c3b7f85d79f99f30e1dd907548dd980e502cdc5eeccfa5db9aafb3b nokogiri-1.13.0-x86_64-linux.gem
8dbd691d438dc12dadc3d8b5b7ed0a6e64d84a2d65b392b52dce868fda107db3 nokogiri-1.13.0.gem