本文整理汇总了TypeScript中@angular/platform-browser/src/browser/browser_adapter.BrowserDomAdapter类的典型用法代码示例。如果您正苦于以下问题:TypeScript BrowserDomAdapter类的具体用法?TypeScript BrowserDomAdapter怎么用?TypeScript BrowserDomAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BrowserDomAdapter类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(elementRef:ElementRef, private dom:BrowserDomAdapter) {
this.$element = elementRef.nativeElement;
// initial styling
this.dom.setStyle(this.$element, 'position', 'absolute');
this.dom.setStyle(this.$element, 'top', '0');
this.dom.setStyle(this.$element, 'bottom', '0');
this.dom.setStyle(this.$element, 'max-height', '100%');
}
示例2: init
function init() {
BrowserDomAdapter.makeCurrent();
const tree = document.createElement('tree');
document.querySelector('baseline').appendChild(tree);
app = new BaseLineTreeComponent(tree);
bindAction('#destroyDom', destroyDom);
bindAction('#createDom', createDom);
bindAction('#updateDomProfile', profile(createDom, noop, 'baseline-update'));
bindAction('#createDomProfile', profile(createDom, destroyDom, 'baseline-create'));
}
示例3: main
export function main() {
BrowserDomAdapter.makeCurrent();
var count = getIntParameter('selectors');
var fixedMatcher;
var fixedSelectorStrings = [];
var fixedSelectors = [];
for (var i = 0; i < count; i++) {
fixedSelectorStrings.push(randomSelector());
}
for (var i = 0; i < count; i++) {
fixedSelectors.push(CssSelector.parse(fixedSelectorStrings[i]));
}
fixedMatcher = new SelectorMatcher();
for (var i = 0; i < count; i++) {
fixedMatcher.addSelectables(fixedSelectors[i], i);
}
function parse() {
var result = [];
for (var i = 0; i < count; i++) {
result.push(CssSelector.parse(fixedSelectorStrings[i]));
}
return result;
}
function addSelectable() {
var matcher = new SelectorMatcher();
for (var i = 0; i < count; i++) {
matcher.addSelectables(fixedSelectors[i], i);
}
return matcher;
}
function match() {
var matchCount = 0;
for (var i = 0; i < count; i++) {
fixedMatcher.match(fixedSelectors[i][0], (selector, selected) => { matchCount += selected; });
}
return matchCount;
}
bindAction('#parse', parse);
bindAction('#addSelectable', addSelectable);
bindAction('#match', match);
}
示例4: autoInit
static autoInit() {
const specUrlAttributeName = 'spec-url';
let redocEl = dom.query('redoc');
if (!redocEl) return;
if (dom.hasAttribute(redocEl, specUrlAttributeName)) {
let url = dom.getAttribute(redocEl, specUrlAttributeName);
Redoc.init(url);
}
}
示例5: hideLoadingAnimation
static hideLoadingAnimation() {
let redocEl = dom.query('redoc');
if (!redocEl) return;
dom.addClass(redocEl, 'loading-remove');
setTimeout(() => {
dom.removeClass(redocEl, 'loading-remove');
dom.removeClass(redocEl, 'loading');
}, 400);
}
示例6: init
init() {
this.categories = this.menuService.categories;
this.$mobileNav = this.dom.querySelector(this.$element, '.mobile-nav');
this.$resourcesNav = this.dom.querySelector(this.$element, '#resources-nav');
//decorate scrollYOffset to account mobile nav
this.scrollService.scrollYOffset = () => {
let mobileNavOffset = this.$mobileNav.clientHeight;
return this.options.scrollYOffset() + mobileNavOffset;
};
}
示例7: setupToggleAria
setupToggleAria() {
let toggleTypes = ['md-switch', 'md-checkbox'];
let toggle;
let el = this._element.nativeElement;
for (var i = 0, toggleType; toggleType = toggleTypes[i]; ++i) {
if (toggle = this.dom.querySelector(el, toggleType)) {
if (!toggle.hasAttribute('aria-label')) {
var p = this.dom.querySelector(el, 'p');
if (!p) return;
toggle.setAttribute('aria-label', 'Toggle ' + p.textContent);
}
}
}
}
示例8: displayError
static displayError(err) {
let redocEl = dom.query('redoc');
if (!redocEl) return;
let heading = 'Oops... ReDoc failed to render this spec';
let details = err.message;
let erroHtml = `<div class="redoc-error">
<h1>${heading}</h1>
<div class='redoc-error-details'>${details}</div>`;
redocEl.innerHTML = erroHtml;
}
示例9: parseOptions
parseOptions(el) {
let parsedOpts;
let attributesMap = this.dom.attributeMap(el);
parsedOpts = {};
Array.from(attributesMap.keys())
//camelCasify
.map(k => ({
attrName: k,
name: k.replace(/-(.)/g, (m, $1) => $1.toUpperCase())
})
)
.filter(option => OPTION_NAMES.has(option.name))
.forEach(option => {
parsedOpts[option.name] = attributesMap.get(option.attrName);
});
this.options = parsedOpts;
this._normalizeOptions();
}
示例10: toggleMobileNav
toggleMobileNav() {
let dom = this.dom;
let $overflowParent = (this.options.$scrollParent === global) ? dom.defaultDoc().body
: this.$scrollParent;
if (dom.hasStyle(this.$resourcesNav, 'height')) {
dom.removeStyle(this.$resourcesNav, 'height');
dom.removeStyle($overflowParent, 'overflow-y');
} else {
let viewportHeight = this.options.$scrollParent.innerHeight
|| this.options.$scrollParent.clientHeight;
let height = viewportHeight - this.$mobileNav.getBoundingClientRect().bottom;
dom.setStyle($overflowParent, 'overflow-y', 'hidden');
dom.setStyle(this.$resourcesNav, 'height', height + 'px');
}
}