moxml 0.5.140 → 0.5.142
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/moxml/context.rb +8 -1
- data/lib/moxml/version.rb +1 -1
- data/spec/moxml/adapter/leptris_inbody_comment_spec.rb +42 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2c55a66ba735b6d8f170ad9f83a95faeb16717520d2fd30f767e1dc56914914b
|
|
4
|
+
data.tar.gz: 74f3c07cdccc077e78fbef88d9d8e8f83310f5f9cdc1175221bf719a3a864146
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2b8a163b9601f4da9d2c9a96b1d5ef35eb0d874c27ec5d6c608283cd7ca27c9d801fa9065724a8989406423bd0844100d914cb2ee0de07a2a8f51f0212eb4ab4
|
|
7
|
+
data.tar.gz: 153852b30839c08744fbd29558af04ba07a1c7c27979fa5cfd0ab6fbf48185a1186a33b7989b4aaf07e477942a3c9c215aa6b25b9225dff5670def94a71aa563
|
data/lib/moxml/context.rb
CHANGED
|
@@ -13,9 +13,16 @@ module Moxml
|
|
|
13
13
|
# registries strong). Ruby 3.4 rewrote WeakMap and is safe.
|
|
14
14
|
# MRI < 3.4 takes the strong identity-Hash fallback (the Opal
|
|
15
15
|
# shape, with the 65,536 valve in register_wrapper).
|
|
16
|
+
# Ruby >= 4.0 joins the strong fallback (ruby#489 / #487 class):
|
|
17
|
+
# 4.0's GC rework drops the weak wrapper entries mid-hydration —
|
|
18
|
+
# orphaned Leptris documents, freed pools, segfaults in
|
|
19
|
+
# leptris_element_get_document and 'Memory allocation failed' on
|
|
20
|
+
# the adoption walk. The gate reads as a version ALLOWLIST of
|
|
21
|
+
# WeakMap semantics we have validated, not a floor.
|
|
16
22
|
WEAK_WRAPPERS = !defined?(ObjectSpace::WeakMap).nil? &&
|
|
17
23
|
!(RUBY_ENGINE == "ruby" &&
|
|
18
|
-
Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.4")
|
|
24
|
+
(Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.4") ||
|
|
25
|
+
Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("4.0")))
|
|
19
26
|
attr_reader :config
|
|
20
27
|
|
|
21
28
|
def initialize(adapter = nil)
|
data/lib/moxml/version.rb
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
|
|
5
|
+
# moxml#389: a comment token following ignored <html>/<body> start
|
|
6
|
+
# tags inserts at the current node (WHATWG 13.2.6.4.4 in-body
|
|
7
|
+
# comment insertion) — the ignored structural start tags do not
|
|
8
|
+
# change where comments land, and canon's strict-comments HTML
|
|
9
|
+
# comparisons ride the surface. Engine-side fix: leptris#1769
|
|
10
|
+
# (v1.9.370.1); the fragment path always wraps with <body>, so the
|
|
11
|
+
# in-body window gates apply.
|
|
12
|
+
RSpec.describe "parse_html_fragment comment preservation" do
|
|
13
|
+
let(:ctx) { Moxml.new(:leptris) }
|
|
14
|
+
|
|
15
|
+
before do
|
|
16
|
+
unless Gem::Version.new(Leptris::VERSION) >= Gem::Version.new("1.9.370.1")
|
|
17
|
+
skip "binding #{Leptris::VERSION} predates the in-body comment " \
|
|
18
|
+
"fix (engine 1.9.370.1)"
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it "keeps a comment after ignored html/body start tags" do
|
|
23
|
+
frag = ctx.parse_html_fragment(
|
|
24
|
+
"<html><body><!-- c --><p>Test</p></body></html>",
|
|
25
|
+
)
|
|
26
|
+
kinds = frag.children.map { |c| c.class.name.split("::").last }
|
|
27
|
+
expect(kinds).to include("Comment")
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it "keeps the top-level comment shape unchanged" do
|
|
31
|
+
frag = ctx.parse_html_fragment("<!-- c --><p>Test</p>")
|
|
32
|
+
kinds = frag.children.map { |c| c.class.name.split("::").last }
|
|
33
|
+
expect(kinds).to eq(%w[Comment Element])
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it "round-trips the comment through serialization" do
|
|
37
|
+
frag = ctx.parse_html_fragment(
|
|
38
|
+
"<html><body><!-- c --><p>Test</p></body></html>",
|
|
39
|
+
)
|
|
40
|
+
expect(frag.to_html).to include("<!-- c -->")
|
|
41
|
+
end
|
|
42
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: moxml
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.142
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: |
|
|
14
14
|
Moxml is a unified XML manipulation library that provides a common API
|
|
@@ -454,6 +454,7 @@ files:
|
|
|
454
454
|
- spec/moxml/adapter/leptris_binding_cap_spec.rb
|
|
455
455
|
- spec/moxml/adapter/leptris_doc_parts_spec.rb
|
|
456
456
|
- spec/moxml/adapter/leptris_document_declaration_spec.rb
|
|
457
|
+
- spec/moxml/adapter/leptris_inbody_comment_spec.rb
|
|
457
458
|
- spec/moxml/adapter/leptris_parse_skips_spec.rb
|
|
458
459
|
- spec/moxml/adapter/leptris_record_driver_spec.rb
|
|
459
460
|
- spec/moxml/adapter/leptris_sax_dup_attr_spec.rb
|