mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 20:33:32 +08:00
refactor(content): use css instead of js
This commit is contained in:
@ -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 {
|
||||
|
Reference in New Issue
Block a user