当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript util.Option类代码示例

本文整理汇总了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);
    }
  };
}
开发者ID:jayphelps,项目名称:glimmer,代码行数:26,代码来源:inner-html-fix.ts

示例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);
    }
  };
}
开发者ID:asakusuma,项目名称:glimmer,代码行数:26,代码来源:inner-html-fix.ts

示例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);
    }
  };
}
开发者ID:asakusuma,项目名称:glimmer,代码行数:23,代码来源:svg-inner-html-fix.ts

示例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);
    }
  };
}
开发者ID:asakusuma,项目名称:glimmer,代码行数:23,代码来源:svg-inner-html-fix.ts


注:本文中的@glimmer/util.Option类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。