# Nokogiri Changelog Archive These are the release notes for older versions. For current releases, see [CHANGELOG.md](../CHANGELOG.md). ## 1.15.7 / 2024-12-02 ### Fixed * [CRuby] When serializing HTML5 documents, properly escape foreign content "style" elements. Normally, a "style" tag contains raw text that does not need entity-escaping, but when it appears in either SVG or MathML foreign content, the "style" tag is now correctly escaped when serialized. @flavorjones ## 1.15.6 / 2024-03-16 ### Security * [CRuby] Vendored libxml2 is updated to address CVE-2024-25062. See [GHSA-xc9x-jj77-9p9j](https://github.com/sparklemotion/nokogiri/security/advisories/GHSA-xc9x-jj77-9p9j) for more information. ### Dependencies * [CRuby] Vendored libxml2 is updated to v2.11.7 from v2.11.6. For details please see https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.11.7 ## 1.15.5 / 2023-11-17 ### Dependencies * [CRuby] Vendored libxml2 is updated to v2.11.6 from v2.11.5. For details please see https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.11.6 * [CRuby] Vendored libxslt is updated to v1.1.39 from v1.1.38. For details please see https://gitlab.gnome.org/GNOME/libxslt/-/releases/v1.1.39 ## 1.15.4 / 2023-08-11 ### Dependencies * [CRuby] Vendored libxml2 is updated to v2.11.5 from v2.11.4. For details please see https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.11.5 ### Fixed * Fixed a typo in a HTML5 parser error message. [#2927] (@anishathalye) * [CRuby] `ObjectSpace.memsize_of` is now safe to call on `Document`s with complex DTDs. In previous versions, this debugging method could result in a segfault. [#2923, #2924] ## 1.15.3 / 2023-07-05 ### Fixed * Passing an object that is not a kind of `XML::Node` as the first parameter to `CDATA.new` now raises a `TypeError`. Previously this would result in either a segfault (CRuby) or a Java exception (JRuby). [#2920] * Passing an object that is not a kind of `XML::Node` as the first parameter to `Schema.from_document` now raises a `TypeError`. Previously this would result in either a segfault (CRuby) or a Java exception (JRuby). [#2920] * [CRuby] Passing an object that is not a kind of `XML::Node` as the second parameter to `Text.new` now raises a `TypeError`. Previously this would result in a segfault. [#2920] * [CRuby] Replacing a node's children via methods like `Node#inner_html=`, `#children=`, and `#replace` no longer defensively dups the node's next sibling if it is a Text node. This behavior was originally adopted to work around libxml2's memory management (see #283 and #595) but should not have included operations involving `xmlAddChild()`. [#2916] * [JRuby] Fixed NPE when serializing an unparented HTML node. [#2559, #2895] (@cbasguti) ## 1.15.2 / 2023-05-24 ### Dependencies * [JRuby] Vendored org.nokogiri:nekodtd is updated to v0.1.11.noko2. This is functionally equivalent to v0.1.11.noko1 but restores support for Java 8. ### Fixed * [JRuby] Java 8 support is restored, fixing a regression present in v1.14.0..v1.14.4 and v1.15.0..v1.15.1. [#2887] ## 1.15.1 / 2023-05-19 ### Dependencies * [CRuby] Vendored libxml2 is updated to v2.11.4 from v2.11.3. For details please see https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.11.4 ### Fixed * [CRuby] The libxml2 update fixes an encoding regression when push-parsing UTF-8 sequences. [#2882, upstream [issue](https://gitlab.gnome.org/GNOME/libxml2/-/issues/542) and [commit](https://gitlab.gnome.org/GNOME/libxml2/-/commit/e0f3016f71297314502a3620a301d7e064cbb612)] ## 1.15.0 / 2023-05-15 ### Notes #### Ability to opt into system `malloc` and `free` Since 2009, Nokogiri has configured libxml2 to use `ruby_xmalloc` et al for memory management. This has provided benefits for memory management, but comes with a performance penalty. Users can now opt into using system `malloc` for libxml2 memory management by setting an environment variable: ``` sh # "default" here means "libxml2's default" which is system malloc NOKOGIRI_LIBXML_MEMORY_MANAGEMENT=default ``` Benchmarks show that this setting will significantly improve performance, but be aware that the tradeoff may involve poorer memory management including bloated heap sizes and/or OOM conditions. You can read more about this in the decision record at [`adr/2023-04-libxml-memory-management.md`](adr/2023-04-libxml-memory-management.md). ### Dependencies * [CRuby] Vendored libxml2 is updated to v2.11.3 from v2.10.4. For details please see: * https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.11.0 * https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.11.1 * https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.11.2 * https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.11.3 * [CRuby] Vendored libxslt is updated to v1.1.38 from v1.1.37. For details please see: * https://gitlab.gnome.org/GNOME/libxslt/-/releases/v1.1.38 ### Added * `Encoding` objects may now be passed to serialization methods like `#to_xml`, `#to_html`, `#serialize`, and `#write_to` to specify the output encoding. Previously only encoding names (strings) were accepted. [#2774, #2798] (@ellaklara) * [CRuby] Users may opt into using system `malloc` for libxml2 memory management. For more detail, see note above or [`adr/2023-04-libxml-memory-management.md`](adr/2023-04-libxml-memory-management.md). ### Changed * [CRuby] `Schema.from_document` now makes a defensive copy of the document if it has blank text nodes with Ruby objects instantiated for them. This prevents unsafe behavior in libxml2 from causing a segfault. There is a small performance cost, but we think this has the virtue of being "what the user meant" since modifying the original is surprising behavior for most users. Previously this was addressed in v1.10.9 by raising an exception. ### Fixed * [CRuby] `XSLT.transform` now makes a defensive copy of the document if it has blank text nodes with Ruby objects instantiated for them _and_ the template uses `xsl:strip-spaces`. This prevents unsafe behavior in libxslt from causing a segfault. There is a small performance cost, but we think this has the virtue of being "what the user meant" since modifying the original is surprising behavior for most users. Previously this would allow unsafe memory access and potentially segfault. [#2800] ### Improved * `Nokogiri::XML::Node::SaveOptions#inspect` now shows the names of the options set in the bitmask, similar to `ParseOptions`. [#2767] * `#inspect` and pretty-printing are improved for `AttributeDecl`, `ElementContent`, `ElementDecl`, and `EntityDecl`. * [CRuby] The C extension now uses Ruby's [TypedData API](https://docs.ruby-lang.org/en/3.0/extension_rdoc.html#label-Encapsulate+C+Data+into+a+Ruby+Object) for managing all the libxml2 structs. Write barriers may improve GC performance in some extreme cases. [#2808] (@etiennebarrie and @byroot) * [CRuby] `ObjectSpace.memsize_of` reports a pretty good guess of memory usage when called on `Nokogiri::XML::Document` objects. [#2807] (@etiennebarrie and @byroot) * [CRuby] Users installing the "ruby" platform gem and compiling libxml2 and libxslt from source will now be using a modern `config.guess` and `config.sub` that supports new architectures like `loongarch64`. [#2831] (@zhangwenlong8911) * [CRuby] HTML5 parser: * adjusts the specified attributes, adding `xlink:arcrole` and removing `xml:base` [#2841, #2842] * allows `
` in `