-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cloning #96
base: main
Are you sure you want to change the base?
Conversation
834bd7a
to
be97fd2
Compare
477d42e
to
a5863dc
Compare
15ff4e8
to
c5c51ab
Compare
ad3f164
to
e2b718f
Compare
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.
Although this requires more effort, I would rather test the expected HTML instead of asserting that the output is not the same, as this could be caused by anything.
@TAINCER Please rebase. |
@TAINCER @nilmberg has found that by keeping a reference to |
7d84d39
to
34a7d97
Compare
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.
LGTM!
Now please push this on a different branch, rebased with master, and create a new PR. You're the author and @lippserd can't approve otherwise.
After cloning elements, each own attribute callback must be rebound so that the clones continue to work together.
We already have subclasses that override ensureAssembled() to execute code before assemble() is called. From now on, initAssemble() should be used for such purposes. initAssemble() is also introduced with the idea that it will be used to set the object ID used for the rebinding callbacks in BaseHtmlElement.
Currently the object ID is only set if the element has attributes. This made sense since callbacks only need to be rebound after cloning the element if attributes are set. However, with upcoming changes we will also rebind callbacks of all content elements so that the object id needs to be available in cases where the element has no attributes but content.
…ively Instead of cloning the content of each content element individually, the entire content is cloned once, also preserving the object graph.
Subclasses of HtmlDocument that need to adjust the cloned content, for example to rebind callbacks, can now use a promise resolved with an SplObjectStorage that provides each original and its cloned element.
No description provided.