本文整理汇总了TypeScript中aurelia-pal.DOM.injectStyles方法的典型用法代码示例。如果您正苦于以下问题:TypeScript DOM.injectStyles方法的具体用法?TypeScript DOM.injectStyles怎么用?TypeScript DOM.injectStyles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aurelia-pal.DOM
的用法示例。
在下文中一共展示了DOM.injectStyles方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
示例2: fixupCSSUrls
.then(text => {
text = fixupCSSUrls(this.address, text);
this._scoped.css = text;
if (this._global) {
this._alreadyGloballyInjected = true;
DOM.injectStyles(text);
}
});
示例3: it
it('reports "true" for non zero duration transitions set in styles', () => {
const prefixes = ['-moz-', '-webkit-', '-o-', ''];
const transitionProperty = 'transition';
const testClass = 'transition-test-class';
// tslint:disable-next-line:max-line-length
const styles = `.${testClass} {${prefixes.map(prefix => `${prefix}${transitionProperty}: opacity .2s linear;`).join('')}}`;
DOM.injectStyles(styles);
element.classList.add(testClass);
expect(hasTransition(element)).toBe(true);
});
示例4: injectAureliaHideStyleAtHead
export function injectAureliaHideStyleAtHead() {
DOM.injectStyles(aureliaHideClass);
}
示例5: injectAureliaHideStyleAtBoundary
export function injectAureliaHideStyleAtBoundary(domBoundary: any) {
if (FEATURE.shadowDOM && domBoundary && !domBoundary.hasAureliaHideStyle) {
domBoundary.hasAureliaHideStyle = true;
DOM.injectStyles(aureliaHideClass, domBoundary);
}
}