-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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(v2): slot tests fixes #6317
Conversation
@@ -394,6 +396,43 @@ export const vnode_ensureElementInflated = (vnode: VNode) => { | |||
} | |||
}; | |||
|
|||
export const vnode_getDOMChildVNodes = ( |
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 copy pasted code vnode_getDOMChildNodes
, but returns VNodes instead of elements
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.
Can we somehow merge the code so that it is not duplicate? I don't want to be fixing the same code twice.
Maybe have an extra argument which you can use if the VNode should be unwraped or not.
) { | ||
const parentNodeIsDefaultNamespace = vnode_isDefaultNamespace(domParentVNode); | ||
const parentIsForeignObject = !parentNodeIsDefaultNamespace | ||
? isForeignObjectElement(vnode_getElementName(domParentVNode)) |
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 same problem with element 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.
This seems like a lot of code. Why is all of this needed? Also, can we move all of the code that morphs from one namespace into a different namespace into a separate file?
@@ -394,6 +396,43 @@ export const vnode_ensureElementInflated = (vnode: VNode) => { | |||
} | |||
}; | |||
|
|||
export const vnode_getDOMChildVNodes = ( |
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.
Can we somehow merge the code so that it is not duplicate? I don't want to be fixing the same code twice.
Maybe have an extra argument which you can use if the VNode should be unwraped or not.
@@ -686,6 +725,28 @@ export const vnode_getVNodeForChildNode = ( | |||
return child as ElementVNode; | |||
}; | |||
|
|||
// this is trying to find the vnode for the element using Breadth-First Search | |||
export const vnode_getVNodeForElement = ( |
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 do you need this?
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.
I removed it. It was for finding the q:template element
@@ -931,6 +994,7 @@ export const mapArray_get = <T>( | |||
|
|||
export const vnode_insertBefore = ( | |||
journal: VNodeJournal, | |||
document: Document, |
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.
You should not have to pass document
around. Please revert this. If you need to get a hold of element you can always say node.ownerDocument
https://developer.mozilla.org/en-US/docs/Web/API/Node/ownerDocument Because that is a rare case I don't mind reading the DOM for that.
) { | ||
const parentNodeIsDefaultNamespace = vnode_isDefaultNamespace(domParentVNode); | ||
const parentIsForeignObject = !parentNodeIsDefaultNamespace | ||
? isForeignObjectElement(vnode_getElementName(domParentVNode)) |
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 seems like a lot of code. Why is all of this needed? Also, can we move all of the code that morphs from one namespace into a different namespace into a separate file?
This PR fixes slot e2e tests