本文整理汇总了TypeScript中angular2/src/core/dom/dom_adapter.DOM.createElement方法的典型用法代码示例。如果您正苦于以下问题:TypeScript DOM.createElement方法的具体用法?TypeScript DOM.createElement怎么用?TypeScript DOM.createElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular2/src/core/dom/dom_adapter.DOM
的用法示例。
在下文中一共展示了DOM.createElement方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should be able to create text nodes and use them with the other APIs', () => {
var t = DOM.createTextNode('hello');
expect(DOM.isTextNode(t)).toBe(true);
var d = DOM.createElement('div');
DOM.appendChild(d, t);
expect(DOM.getInnerHTML(d)).toEqual('hello');
});
示例2: constructor
constructor() {
super("");
// compute the root url to pass to AppRootUrl
var a = DOM.createElement('a');
DOM.resolveAndSetHref(a, './', null);
this.value = DOM.getHref(a);
}
示例3: it
it('should bootstrap a simple app', inject([AsyncTestCompleter], (async) => {
var fakeDoc = DOM.createHtmlDocument();
var el = DOM.createElement('app-cmp', fakeDoc);
DOM.appendChild(fakeDoc.body, el);
bootstrap(AppCmp,
[
ROUTER_PROVIDERS,
provide(ROUTER_PRIMARY_COMPONENT, {useValue: AppCmp}),
provide(LocationStrategy, {useClass: MockLocationStrategy}),
provide(DOCUMENT, {useValue: fakeDoc})
])
.then((applicationRef) => {
var router = applicationRef.hostComponent.router;
router.subscribe((_) => {
expect(el).toHaveText('outer { hello }');
expect(applicationRef.hostComponent.location.path()).toEqual('');
async.done();
});
});
}));
示例4: beforeEach
beforeEach(() => {
doc = DOM.createHtmlDocument();
doc.title = '';
ssh = new DomSharedStylesHost(doc);
someHost = DOM.createElement('div');
});
示例5:
TimerWrapper.setTimeout(() => {
var finishedDiv = DOM.createElement('div');
finishedDiv.id = 'done';
DOM.setInnerHTML(finishedDiv, 'Finished');
DOM.appendChild(document.body, finishedDiv);
}, 0);