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


TypeScript constructors.fragment方法代码示例

本文整理汇总了TypeScript中dom5.constructors.fragment方法的典型用法代码示例。如果您正苦于以下问题:TypeScript constructors.fragment方法的具体用法?TypeScript constructors.fragment怎么用?TypeScript constructors.fragment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dom5.constructors的用法示例。


在下文中一共展示了constructors.fragment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: _moveDomModuleStyleIntoTemplate

  /**
   * Old Polymer supported `<style>` tag in `<dom-module>` but outside of
   * `<template>`.  This is also where the deprecated Polymer CSS import tag
   * `<link rel="import" type="css">` would generate inline `<style>`.
   * Migrates these `<style>` tags into available `<template>` of the
   * `<dom-module>`.  Will create a `<template>` container if not present.
   *
   * TODO(usergenic): Why is this in bundler... shouldn't this be some kind of
   * polyup or pre-bundle operation?
   */
  private _moveDomModuleStyleIntoTemplate(style: ASTNode, refStyle?: ASTNode) {
    const domModule =
        dom5.nodeWalkAncestors(style, dom5.predicates.hasTagName('dom-module'));
    if (!domModule) {
      return;
    }
    let template = dom5.query(domModule, matchers.template);
    if (!template) {
      template = dom5.constructors.element('template')!;
      treeAdapters.default.setTemplateContent(
          template, dom5.constructors.fragment());
      prepend(domModule, template);
    }
    removeElementAndNewline(style);

    // Ignore the refStyle object if it is contained within a different
    // dom-module.
    if (refStyle &&
        !dom5.query(
            domModule, (n) => n === refStyle, dom5.childNodesIncludeTemplate)) {
      refStyle = undefined;
    }

    // keep ordering if previding with a reference style
    if (!refStyle) {
      prepend(treeAdapters.default.getTemplateContent(template), style);
    } else {
      insertAfter(refStyle, style);
    }
  }
开发者ID:Polymer,项目名称:vulcanize,代码行数:40,代码来源:html-bundler.ts


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