本文整理汇总了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();
});
示例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) => {
示例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]),
示例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();
});
示例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();
});
示例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;
}
示例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;
}
示例8: expect
.then((view) => {
view.detectChanges();
var span = DOM.querySelector(view.rootNodes[0], '#child');
expect(DOM.hasClass(span, 'compiled')).toBeTruthy();
async.done();
});
示例9: _locateFinishedMarker
_locateFinishedMarker() { return DOM.querySelector(document.body, '#done'); }