本文整理汇总了TypeScript中@glimmer/util.Option类的典型用法代码示例。如果您正苦于以下问题:TypeScript Option类的具体用法?TypeScript Option怎么用?TypeScript Option使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Option类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: applyInnerHTMFix
export function applyInnerHTMFix(document: Option<Document>, DOMClass: typeof DOMOperations): typeof DOMOperations {
if (!document) return DOMClass;
if (!shouldApplyFix(document)) {
return DOMClass;
}
let div = document.createElement('div');
return class DOMChangesWithInnerHTMLFix extends DOMClass {
insertHTMLBefore(parent: HTMLElement, nextSibling: Node, html: string): Bounds {
if (html === null || html === '') {
return super.insertHTMLBefore(parent, nextSibling, html);
}
let parentTag = parent.tagName.toLowerCase();
let wrapper = innerHTMLWrapper[parentTag];
if(wrapper === undefined) {
return super.insertHTMLBefore(parent, nextSibling, html);
}
return fixInnerHTML(parent, wrapper, div, html, nextSibling);
}
};
}
示例2: treeConstruction
export function treeConstruction(document: Option<Document>, DOMTreeConstructionClass: typeof DOMTreeConstruction): typeof DOMTreeConstruction {
if (!document) return DOMTreeConstructionClass;
if (!shouldApplyFix(document)) {
return DOMTreeConstructionClass;
}
let div = document.createElement('div');
return class DOMTreeConstructionWithInnerHTMLFix extends DOMTreeConstructionClass {
insertHTMLBefore(parent: HTMLElement, html: string, reference: Node): Bounds {
if (html === null || html === '') {
return super.insertHTMLBefore(parent, html, reference);
}
let parentTag = parent.tagName.toLowerCase();
let wrapper = innerHTMLWrapper[parentTag];
if(wrapper === undefined) {
return super.insertHTMLBefore(parent, html, reference);
}
return fixInnerHTML(parent, wrapper, div, html, reference);
}
};
}
示例3: treeConstruction
export function treeConstruction(document: Option<Document>, TreeConstructionClass: typeof DOMTreeConstruction, svgNamespace: SVG_NAMESPACE): typeof DOMTreeConstruction {
if (!document) return TreeConstructionClass;
if (!shouldApplyFix(document, svgNamespace)) {
return TreeConstructionClass;
}
let div = document.createElement('div');
return class TreeConstructionWithSVGInnerHTMLFix extends TreeConstructionClass {
insertHTMLBefore(parent: HTMLElement, html: string, reference: Node,): Bounds {
if (html === null || html === '') {
return super.insertHTMLBefore(parent, html, reference);
}
if (parent.namespaceURI !== svgNamespace) {
return super.insertHTMLBefore(parent, html, reference);
}
return fixSVG(parent, div, html, reference);
}
};
}
示例4: domChanges
export function domChanges(document: Option<Document>, DOMChangesClass: typeof DOMChanges, svgNamespace: SVG_NAMESPACE): typeof DOMChanges {
if (!document) return DOMChangesClass;
if (!shouldApplyFix(document, svgNamespace)) {
return DOMChangesClass;
}
let div = document.createElement('div');
return class DOMChangesWithSVGInnerHTMLFix extends DOMChangesClass {
insertHTMLBefore(parent: HTMLElement, nextSibling: Node, html: string): Bounds {
if (html === null || html === '') {
return super.insertHTMLBefore(parent, nextSibling, html);
}
if (parent.namespaceURI !== svgNamespace) {
return super.insertHTMLBefore(parent, nextSibling, html);
}
return fixSVG(parent, div, html, nextSibling);
}
};
}