Skip to content

Commit

Permalink
Deprecate adding child nodes to attributes.
Browse files Browse the repository at this point in the history
This test was ported from Perl. The behaviour has changed in libxml 2.13.0,
but we're pushing the boundaries of valid tree-structure anyway.
  • Loading branch information
dwarring committed Jun 1, 2024
1 parent 266f3bf commit c81dd29
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/LibXML/Attr.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ method is-valid($elem) { self.ownerDocument.is-valid($elem, self) }
parse time).
=end pod

# Adding child nodes to an attribute node is technically allowed,
# but makes no sense
method addChild(|) is DEPRECATED("LibXML::Element for node parenting") { nextsame }

#| DOM level-2 method NYI
method specified { die X::NYI.new }

Expand Down
3 changes: 3 additions & 0 deletions t/20extras.t
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ subtest 'cloneNode', {
is $doc.Str, $clone.Str, "unbind of document element";
}

skip "attribute child nodes is deprecated";
#`( # depreacted
subtest 'attribute child nodes' => {
plan 3;
my LibXML::Document:D $doc .= parse: :file<samples/dtd.xml>;
Expand All @@ -53,3 +55,4 @@ subtest 'attribute child nodes' => {
$elem.setAttributeNode($att);
is $elem.Str, '<Test att="xxx&foo;"/>';
}
)

0 comments on commit c81dd29

Please sign in to comment.