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


TypeScript virtualdom.VirtualDOM类代码示例

本文整理汇总了TypeScript中@phosphor/virtualdom.VirtualDOM的典型用法代码示例。如果您正苦于以下问题:TypeScript VirtualDOM类的具体用法?TypeScript VirtualDOM怎么用?TypeScript VirtualDOM使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: it

 it('should clear the rendering if `null` content is provided', () => {
   let host = document.createElement('div');
   VirtualDOM.render(h('div', ['bar', 'foo']), host);
   expect(host.children[0].childNodes.length).to.equal(2);
   VirtualDOM.render(null, host);
   expect(host.children.length).to.equal(0);
 });
开发者ID:afshin,项目名称:phosphor,代码行数:7,代码来源:index.spec.ts

示例2: it

      it('should connect a node to a command', () => {
        let called = false;
        const command = 'commandlinker:connect-node';
        const commands = new CommandRegistry();
        const linker = new CommandLinker({ commands });
        let node: HTMLElement;
        let vnode: VirtualNode;
        const disposable = commands.addCommand(command, {
          execute: () => {
            called = true;
          }
        });

        vnode = h.div({ dataset: linker.populateVNodeDataset(command, null) });
        node = VirtualDOM.realize(vnode);
        document.body.appendChild(node);

        expect(called).to.equal(false);
        simulate(node, 'click');
        expect(called).to.equal(true);

        document.body.removeChild(node);
        linker.dispose();
        disposable.dispose();
      });
开发者ID:AlbertHilb,项目名称:jupyterlab,代码行数:25,代码来源:commandlinker.spec.ts

示例3: createButtonNode

 /**
  * Create a button node for the dialog.
  *
  * @param button - The button data.
  *
  * @returns A node for the button.
  */
 createButtonNode(button: IButton): HTMLElement {
   let className = this.createItemClass(button);
   // We use realize here instead of creating
   // nodes with document.createElement as a
   // shorthand, and only because this is not
   // called often.
   return VirtualDOM.realize(
     h.button({ className },
           this.renderIcon(button),
           this.renderLabel(button))
   );
 }
开发者ID:cameronoelsen,项目名称:jupyterlab,代码行数:19,代码来源:dialog.ts

示例4: createHeader

 /**
  * Create the header of the dialog.
  *
  * @param title - The title of the dialog.
  *
  * @returns A widget for the dialog header.
  */
 createHeader(title: HeaderType): Widget {
   let header: Widget;
   if (typeof title === 'string') {
     header = new Widget({ node: document.createElement('span') });
     header.node.textContent = title;
   } else {
     header = new Widget({ node: VirtualDOM.realize(title) });
   }
   header.addClass('jp-Dialog-header');
   Styling.styleNode(header.node);
   return header;
 }
开发者ID:cameronoelsen,项目名称:jupyterlab,代码行数:19,代码来源:dialog.ts


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