Update to VS Code 1.52.1
This commit is contained in:
@ -661,6 +661,48 @@ export function isAncestor(testChild: Node | null, testAncestor: Node | null): b
|
||||
return false;
|
||||
}
|
||||
|
||||
const parentFlowToDataKey = 'parentFlowToElementId';
|
||||
|
||||
/**
|
||||
* Set an explicit parent to use for nodes that are not part of the
|
||||
* regular dom structure.
|
||||
*/
|
||||
export function setParentFlowTo(fromChildElement: HTMLElement, toParentElement: Element): void {
|
||||
fromChildElement.dataset[parentFlowToDataKey] = toParentElement.id;
|
||||
}
|
||||
|
||||
function getParentFlowToElement(node: HTMLElement): HTMLElement | null {
|
||||
const flowToParentId = node.dataset[parentFlowToDataKey];
|
||||
if (typeof flowToParentId === 'string') {
|
||||
return document.getElementById(flowToParentId);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if `testAncestor` is an ancessor of `testChild`, observing the explicit
|
||||
* parents set by `setParentFlowTo`.
|
||||
*/
|
||||
export function isAncestorUsingFlowTo(testChild: Node, testAncestor: Node): boolean {
|
||||
let node: Node | null = testChild;
|
||||
while (node) {
|
||||
if (node === testAncestor) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (node instanceof HTMLElement) {
|
||||
const flowToParentElement = getParentFlowToElement(node);
|
||||
if (flowToParentElement) {
|
||||
node = flowToParentElement;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
node = node.parentNode;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function findParentWithClass(node: HTMLElement, clazz: string, stopAtClazzOrNode?: string | HTMLElement): HTMLElement | null {
|
||||
while (node && node.nodeType === node.ELEMENT_NODE) {
|
||||
if (node.classList.contains(clazz)) {
|
||||
@ -1331,8 +1373,8 @@ export function safeInnerHtml(node: HTMLElement, value: string): void {
|
||||
const options = _extInsaneOptions({
|
||||
allowedTags: ['a', 'button', 'blockquote', 'code', 'div', 'h1', 'h2', 'h3', 'input', 'label', 'li', 'p', 'pre', 'select', 'small', 'span', 'strong', 'textarea', 'ul', 'ol'],
|
||||
allowedAttributes: {
|
||||
'a': ['href'],
|
||||
'button': ['data-href'],
|
||||
'a': ['href', 'x-dispatch'],
|
||||
'button': ['data-href', 'x-dispatch'],
|
||||
'input': ['type', 'placeholder', 'checked', 'required'],
|
||||
'label': ['for'],
|
||||
'select': ['required'],
|
||||
|
Reference in New Issue
Block a user