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


TypeScript aurelia-pal.DOM类代码示例

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


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

示例1: beforeCompile

 beforeCompile(content: DocumentFragment, resources: ViewResources, instruction: ViewCompileInstruction): void {
   if (instruction.targetShadowDOM) {
     DOM.injectStyles(this.css, content as any, true);
   } else if (FEATURE.scopedCSS) {
     let styleNode = DOM.injectStyles(this.css, content as any, true) as Element;
     styleNode.setAttribute('scoped', 'scoped');
   } else if (this._global && !this.owner._alreadyGloballyInjected) {
     DOM.injectStyles(this.css);
     this.owner._alreadyGloballyInjected = true;
   }
 }
开发者ID:aurelia,项目名称:templating-resources,代码行数:11,代码来源:css-resource.ts

示例2: beforeEach

    beforeEach(() => {
        container = new Container();
        container.registerInstance(Element, DOM.createElement("div"));
        templatingEngine = container.get(TemplatingEngine);

        sut = templatingEngine.createViewModelForUnitTest(ScrollSpyElement);
    });
开发者ID:eriklieben,项目名称:old-aurelia-materialize-css-before-rc1,代码行数:7,代码来源:scrollspyElement.spec.ts

示例3: exerciseBehavior

    function exerciseBehavior(callback) {
      let sourceCalls = 0;
      let source = {
        handleClick: e => {
          // console.info('source called');
          sourceCalls++;
        }
      };
      let scope = createScopeForTest(source);

      // overrides updateSource
      binding.bind(scope);
      expect(binding.callSource === originalCallSource).not.toBe(true);

      for (let i = 0, ii = 50; i < ii; i++) {
        button.dispatchEvent(DOM.createCustomEvent('click', { bubbles: true }));
      }

      // How to ensure this happen after all events without timeout?
      let testDuration = 500;
      function endTest() {
        binding.unbind();
        expect(sourceCalls).toEqual(0);
        expect(binding.callSource === originalCallSource).toBe(true);
        callback();
      }
      setTimeout(endTest, testDuration);
    }
开发者ID:aurelia,项目名称:templating-resources,代码行数:28,代码来源:self-binding-behavior.spec.ts

示例4: beforeEach

    beforeEach(() => {
        container = new Container();
        templatingEngine = container.get(TemplatingEngine);

        sut = templatingEngine.createViewModelForUnitTest(ButtonElement);
        sut.element = DOM.createElement("a");
    });
开发者ID:eriklieben,项目名称:old-aurelia-materialize-css-before-rc1,代码行数:7,代码来源:buttonElement.spec.ts

示例5: beforeEach

    beforeEach(() => {
        container = new Container();
        container.registerInstance(Element, DOM.createElement("div"));
        templatingEngine = container.get(TemplatingEngine);
        sut = templatingEngine.createViewModelForUnitTest(DropdownDividerAttribute);

    });
开发者ID:eriklieben,项目名称:old-aurelia-materialize-css-before-rc1,代码行数:7,代码来源:dropdownDividerAttribute.spec.ts

示例6: closeOnEscSpec

 async function closeOnEscSpec(done: DoneFn, settings: DialogSettings) {
   const renderer = createRenderer(settings);
   await show(done, renderer);
   DOM.dispatchEvent(new KeyboardEvent('keyup', { key: 'Enter' }));
   expect(renderer.__controller.ok).toHaveBeenCalled();
   done();
 }
开发者ID:HIRANO-Satoshi,项目名称:dialog,代码行数:7,代码来源:dialog-renderer.spec.ts

示例7: it

  it('should set focus value to true when element gets focus', () => {
    focus.attached();
    setBindedFocusValue(false);

    element.dispatchEvent(DOM.createCustomEvent('focus'));

    expect(focus.value).toBe(true);
  });
开发者ID:aurelia,项目名称:templating-resources,代码行数:8,代码来源:focus.spec.ts

示例8: fixupCSSUrls

 .then(text => {
   text = fixupCSSUrls(this.address, text);
   this._scoped.css = text;
   if (this._global) {
     this._alreadyGloballyInjected = true;
     DOM.injectStyles(text);
   }
 });
开发者ID:aurelia,项目名称:templating-resources,代码行数:8,代码来源:css-resource.ts


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