-
Notifications
You must be signed in to change notification settings - Fork 48
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
fix: always set percy-data attributes when serializing #1450
Conversation
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
cache[platform].$ = parseDOM(serializeDOM(), platform); | ||
// save DOM, only after serializing it | ||
// clone DOM, so that during next platform iteration, serializeDOM doesn't change current original DOM | ||
cache[platform].dom = platform === 'shadow' ? dom : dom.cloneNode(true); |
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.
why are we cloning DOM
here?
because our assertions are againts original DOM, if we clone it we're not checking against original DOM when APIs change in future and there is drift between cloned DOM and original DOM.
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.
serializeDOM()
already does that for us.
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.
Here is the test preparation workflow that is happening for Chrome -
- We create
plain
DOM, and then runserialzeDOM
on it, and store this incache['plain']
- Then we take the same DOM attach shadow components to it, and then run
serializeDOM
on it again, and store this incache['shadow']
- So here, the
plain
DOM part is getting serialized twice, and since while storing incache['plain']
we store by reference, it get's updated to be the newly serialized plain DOM, whereas the serializedDOM from first iteration is intact.
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.
understood, in this case we shouldn't be calling dom.cloneNode
rather our custom clone node traversal code, will update and merge.
This comment was marked as outdated.
This comment was marked as outdated.
This PR is stale because it has been open for more than 14 days with no activity. Remove stale label or comment or this will be closed in 14 days. |
This PR was closed because it has been stalled for 28 days with no activity. |
context-
data-percy-element-id
is already available, if yes we do not add a new one.data-percy-element-id
attribute is used to create url's for serialized canvas.data-percy-element-id
for canvas as -abcd
data-percy-element-id
therefore, we do not assign a new one.abcd
for thisabcd
which was derived fromdata-percy-element-id
which we have not updated when seriazing 500px dome.related pr's-