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


TypeScript DOM.querySelector方法代码示例

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


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

示例1: expect

               .then((rootTC) => {
                 rootTC.detectChanges();
                 DOM.addClass(DOM.querySelector(rootTC.nativeElement, 'copy-me'), "foo");

                 rootTC.componentInstance.numberCondition = 2;
                 rootTC.detectChanges();
                 expect(DOM.hasClass(DOM.querySelector(rootTC.nativeElement, 'copy-me'), "foo"))
                     .toBe(true);

                 async.done();
               });
开发者ID:cedriclam,项目名称:angular,代码行数:11,代码来源:ng_if_spec.ts

示例2: bind

 }, [DirectiveMetadataReader]), bind(appElementToken).toFactory((appComponentAnnotatedType, appDocument) => {
   var selector = appComponentAnnotatedType.annotation.selector;
   var element = DOM.querySelector(appDocument, selector);
   if (isBlank(element)) {
     throw new BaseException(`The app selector "${selector}" did not match any elements`);
   }
   return element;
 }, [appComponentAnnotatedTypeToken, appDocumentToken]), bind(appViewToken).toAsyncFactory((changeDetection, compiler, injector, appElement, appComponentAnnotatedType, strategy, eventManager, testability, registry) => {
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:8,代码来源:application.ts

示例3: bind

 bind(appElementToken).toFactory((appComponentAnnotatedType, appDocument) => {
   var selector = appComponentAnnotatedType.annotation.selector;
   var element = DOM.querySelector(appDocument, selector);
   if (isBlank(element)) {
     throw new BaseException(`The app selector "${selector}" did not match any elements`);
   }
   return element;
 }, [appComponentAnnotatedTypeToken, appDocumentToken]),
开发者ID:tavwizard,项目名称:angular,代码行数:8,代码来源:application.ts

示例4:

				.then((rootTC) => {
					rootTC.detectChanges();
					let logo: Element = DOM.querySelector(rootTC.nativeElement, '.logo');
					let prefixSelector = isNativeShadowDOMSupported ? '* /deep/ ' : ''; // soon use '>>>' https://www.chromestatus.com/features/6750456638341120
					// console.log(logo.firstChild, prefixSelector);
					// expect(logo.querySelector(prefixSelector + 'svg')).not.toBe(null);
					async.done();
				});
开发者ID:Luphia,项目名称:Laria,代码行数:8,代码来源:logo.spec.ts

示例5: expect

             .then((rootTC) => {
               rootTC.detectChanges();

               // We must use DOM.querySelector instead of rootTC.query here
               // since the elements inside are not compiled.
               var span = DOM.querySelector(rootTC.nativeElement, '#child');
               expect(DOM.hasClass(span, 'compiled')).toBeFalsy();
               async.done();
             });
开发者ID:cedriclam,项目名称:angular,代码行数:9,代码来源:non_bindable_spec.ts

示例6: queryView

export function queryView(view, selector) {
  for (var i = 0; i < view.nodes.length; ++i) {
    var res = DOM.querySelector(view.nodes[i], selector);
    if (isPresent(res)) {
      return res;
    }
  }
  return null;
}
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:9,代码来源:utils.ts

示例7: queryView

export function queryView(view, selector: string) {
  var rootNodes = viewRootNodes(view);
  for (var i = 0; i < rootNodes.length; ++i) {
    var res = DOM.querySelector(rootNodes[i], selector);
    if (isPresent(res)) {
      return res;
    }
  }
  return null;
}
开发者ID:Bogatinov,项目名称:angular,代码行数:10,代码来源:utils.ts

示例8: expect

 .then((view) => {
   view.detectChanges();
   var span = DOM.querySelector(view.rootNodes[0], '#child');
   expect(DOM.hasClass(span, 'compiled')).toBeTruthy();
   async.done();
 });
开发者ID:AsherBarak,项目名称:angular,代码行数:6,代码来源:non_bindable_spec.ts

示例9: _locateFinishedMarker

 _locateFinishedMarker() { return DOM.querySelector(document.body, '#done'); }
开发者ID:B-Thapa,项目名称:angular,代码行数:1,代码来源:app.ts


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