refactor(content): use css instead of js

This commit is contained in:
Manu Mtz.-Almeida
2017-10-26 22:11:46 +02:00
parent 10c77e7513
commit 094816de01
30 changed files with 510 additions and 575 deletions

View File

@ -138,6 +138,14 @@ export function getParentElement(elm: any) {
return null;
}
export function getPageElement(el: HTMLElement) {
const page = el.closest('ion-page,.ion-page,page-inner');
if (page) {
return page;
}
return getParentElement(el);
}
export function applyStyles(elm: HTMLElement, styles: {[styleProp: string]: string|number}) {
const styleProps = Object.keys(styles);
@ -148,25 +156,6 @@ export function applyStyles(elm: HTMLElement, styles: {[styleProp: string]: stri
}
}
export function getToolbarHeight(toolbarTagName: string, pageChildren: HTMLElement[], mode: string, iosHeight: string, defaultHeight: string) {
for (var i = 0; i < pageChildren.length; i++) {
if (pageChildren[i].tagName === toolbarTagName) {
var headerHeight = pageChildren[i].getAttribute(`${mode}-height`);
if (headerHeight) {
return headerHeight;
}
if (mode === 'ios') {
return iosHeight;
}
return defaultHeight;
}
}
return '';
}
/** @hidden */
export type Side = 'left' | 'right' | 'start' | 'end';
@ -216,11 +205,7 @@ export function swipeShouldReset(isResetDirection: boolean, isMovingFast: boolea
}
export function isReady(element: Element): Promise<any> {
return new Promise((resolve) => {
(element as StencilElement).componentOnReady((elm: HTMLElement) => {
resolve(elm);
});
});
return (element as StencilElement).componentOnReady();
}
export function getOrAppendElement(tagName: string): Element {