Conversation
Alright, I think it's settled down now, should be ready for review. |
.common | ||
.ptr_eq(&Arc::downgrade(&button.common))); | ||
|
||
match &button.common.node_graph.node.contents { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just asserts that the weak pointers do in fact point back up to the correct structures and not to some second cloned version of the underlying data.
HtmlBodyStore, | ||
))), | ||
); | ||
let button = ElementNodeArc::new_cyclic(sbox.clone(), |node_weak| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to update these instantiations because of the cyclic nature of the ElementStore now.
node_store: ElementKind, | ||
|
||
/// Reference back up to the DOM node | ||
pub(crate) node: AnyNodeWeak, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the cause for all the complexity. We will need to be able to have references to the node for things like Attr.ownerElement
(which is not only readable by the user but also used when updating the NamedNodeMap).
packages/rdom/src/node/contents.rs
Outdated
impl AttributeStore { | ||
pub(crate) fn new(name: String) -> AttributeStore { | ||
AttributeStore { | ||
name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to lower-case this
Going to merge this since it's been open for a week. |
Introduces a layer to elements to store common functionality like NamedNodeMap. In this we store a reference back up to the Node which owns the Element (Elements are always inside of Nodes because of our composition system which replaces the C++ inheritance model). Note that in order to do this we needed a new ConcreteNode constructor which can handle the cyclic nature. Fortunately, with the builders, this isn't so much an issue.
Also fleshes out NamedNodeMap to lay foundations for support for attributes.