Skip to content
This repository was archived by the owner on Jan 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/239.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The order in which attributes are primed in ``Node.__init__`` has been altered, so that ``.parent`` is available when a style is applied.
7 changes: 5 additions & 2 deletions src/travertino/node.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
class Node:
def __init__(self, style, applicator=None, children=None):
# Parent needs to be primed before style is (potentially) applied with
# assignment of applicator.
self._parent = None
self._root = None

# Explicitly set the internal attribute first, since the setter for style will
# access the applicator property.
self._applicator = None

self.style = style
self.applicator = applicator

self._parent = None
self._root = None
if children is None:
self._children = None
else:
Expand Down