David Wendt
c7e1f34a5d
Print empty nodes as empty tags rather than start/end
2020-01-04 19:00:35 -05:00
David Wendt
c76e5ce447
appendChild also refuses to orphan nodes already part of another XML tree.
2020-01-04 19:00:35 -05:00
David Wendt
bff851e6a4
Add test for insertBefore
2020-01-04 19:00:34 -05:00
David Wendt
34cbe2e04b
insertNode rejects child nodes that already have a parent
2020-01-04 19:00:34 -05:00
David Wendt
7b4a509ebc
Avoid double-borrows when moving a child within it's parent
2020-01-04 19:00:33 -05:00
David Wendt
7753e20fe3
Add a test for XML.removeNode().
2020-01-04 19:00:33 -05:00
David Wendt
30266b2ce7
remove_child should also ensure the child disowns the parent.
2020-01-04 19:00:33 -05:00
David Wendt
8c5dcfe662
Swap in newly constructed nodes *before* filling them with content.
...
Fixes a bug where new XML("<node />").childNode[0].parentNode did NOT refer to the overall document object, but to a phantom text node.
This is because the swap operation used to construct an XMLObject's node in-place was happening AFTER parsing, which means that referents already existed to the temporary XMLNode created by XMLObject::new. swap is not to be called after tree structure has been created; it does not update referents to the swapped nodes.
In the future I should examine the implications of explicitly reconstructing already existing nodes, e.g. through XML.apply(some_xml). Right now, the existing node will be swapped with a new one, and two nodes will exist pointing to the same script object, which is a huge problem with our overall design. We should, at the very least, disassociate swapped nodes from their script object, just in case they still have referents.
Ideally, we wouldn't have to swap nodes, but to avoid a swap, I'd have to instead have a second layer of indirection just to hold a rewritable pointer that every XMLObject points to. This isn't really worth it unless I HAVE to do it, so I'm not going to do it.
2020-01-04 19:00:32 -05:00
David Wendt
568d90f4dc
Warn if XML.removeNode fails for whatever reason
2020-01-04 19:00:32 -05:00
David Wendt
1577f51730
Expose elided objects as pointers when debugging XML nodes
2020-01-04 19:00:32 -05:00
David Wendt
19ca11b08c
Impl `toString`
2020-01-04 19:00:31 -05:00
David Wendt
513460e4e0
Implement `insertBefore`
2020-01-04 19:00:31 -05:00
David Wendt
b0dce445b0
Impl `removeNode`
2020-01-04 19:00:29 -05:00
David Wendt
00319f14a8
Implement `namespaceURI`
2020-01-04 19:00:29 -05:00
David Wendt
73da72db98
Add a test for `appendChild`.
2020-01-04 19:00:28 -05:00
David Wendt
7c95eff048
Flag an error if we accidentally introduce a second script object by accident.
2020-01-04 19:00:28 -05:00
David Wendt
abb2690367
When constructing new XML nodes or documents, always ensure that the new node we swap in is properly linked to the same script object so that we don't accidentally recreate them.
2020-01-04 19:00:28 -05:00
David Wendt
8939dae90c
Implement `XMLNode.attributes` w/ read tests
2020-01-04 19:00:27 -05:00
David Wendt
6f48f3436f
Expose `previousSibling` and `nextSibling` to ActionScript.
...
This commit also fixes a bug caused by excessive use of copypaste, which was detected by the included test.
2020-01-04 19:00:25 -05:00
David Wendt
223320c98c
Expose `parentNode` to ActionScript
2020-01-04 19:00:24 -05:00
David Wendt
807725d7aa
Expose `firstChild` and `lastChild` to ActionScript w/ tests
2020-01-04 19:00:24 -05:00
David Wendt
1d1e493e0e
Refactor the child adoption process to ensure the child also adopts it's siblings.
2020-01-04 19:00:23 -05:00
David Wendt
48d68bebc4
Implement `hasChildNodes()` and add test
2020-01-04 19:00:23 -05:00
David Wendt
c58e866236
Add test for `cloneNode`
2020-01-04 19:00:22 -05:00
David Wendt
881dcb76ab
`cloneNode` without arguments is morally equivalent to `false`
2020-01-04 19:00:21 -05:00
David Wendt
8e33566d07
Add namespacing test
2020-01-04 19:00:21 -05:00
David Wendt
69a1ab1649
Expose namespace prefix and URI lookups to ActionScript.
...
Also, fix the previous commit's half-assed impl.
2020-01-04 19:00:20 -05:00
David Wendt
fe7d2b5173
Extremely WIP impl of `lookup_uri_for_namespace`
2020-01-04 19:00:20 -05:00
David Wendt
55fa6ef09b
Add node cloning support
2020-01-04 19:00:19 -05:00
David Wendt
37f6efb753
Expose `appendChild` to ActionScript
2020-01-04 19:00:19 -05:00
David Wendt
08c0f273a6
Add sibling links to nodes.
2020-01-04 19:00:18 -05:00
David Wendt
7e45dee8cf
Clippy said so.
2020-01-04 19:00:18 -05:00
David Wendt
eec449422b
`XMLDocument.roots` is not necessary since you can just get the children of it's node form anyway...
2020-01-04 19:00:18 -05:00
David Wendt
f8f569440f
Add very basic XML test
2020-01-04 19:00:17 -05:00
David Wendt
cfacd397cf
Most XML properties return `null`, not `undefined`.
...
Furthermore, `prefix` does not distinguish between `<test>` and `<:test>` - they both have a `prefix` of `""`.
2020-01-04 19:00:17 -05:00
David Wendt
b491dd034e
Don't overflow stack when debug-printing an entire document, either.
2020-01-04 19:00:16 -05:00
David Wendt
e47a1d1e38
Fix newly constructed XML trees not actually containing the XML they just parsed.
2020-01-04 19:00:16 -05:00
David Wendt
960e4dad90
Don't cause stack overflow when debug-printing XML nodes.
2020-01-04 19:00:16 -05:00
David Wendt
bec60acc1e
`XML.prototype` should be an `XMLObject` so that instances of `XML` can hold a node
2020-01-04 19:00:15 -05:00
David Wendt
d058c83ac0
Document roots should accept children.
2020-01-04 19:00:15 -05:00
David Wendt
571c4bbd52
Cargo fmt compliance
2020-01-04 19:00:15 -05:00
David Wendt
0af248d81f
Expose `childNodes` to ActionScript
2020-01-04 19:00:14 -05:00
David Wendt
e7768d0802
Add methods to allow storing XML objects on the accompanying tree nodes, so that expando properties on child nodes will work.
2020-01-04 19:00:13 -05:00
David Wendt
b06dd5d15e
Add a special node to represent the document root in the node tree, and get rid of the explicit document reference type in `XMLObject`.
2020-01-04 19:00:12 -05:00
David Wendt
0fe0e4fe90
Separate `XMLName` into another module
2020-01-04 19:00:11 -05:00
David Wendt
3928c7cc51
Reject empty text nodes
2020-01-04 19:00:11 -05:00
David Wendt
7a9a16e598
Don't repeat yourself.
2020-01-04 19:00:11 -05:00
David Wendt
bd1ea56cc3
Implement `XMLNode` properties that don't require child or attribute iteration.
2020-01-04 19:00:10 -05:00
David Wendt
e2eb3d0bde
Add a test of XMLDocument::from_str.
...
This test technically works, but the results were slightly surprising. If it turns out Flash works differently from `quick_xml`, we'll change this test to match Flash.
2020-01-04 19:00:10 -05:00
David Wendt
6ae5ae3038
Add Comment parsing support
2020-01-04 19:00:10 -05:00