@ng1005/chrome-extension-common
Version:
chrome扩展通用库--消息与storage
36 lines (35 loc) • 838 B
TypeScript
/**
* 获取标签css selector
* @param res
* @ignoreId 是否忽略id选择器
* @returns
*/
export declare function getSelector(res: HTMLElement, ignoreId?: boolean): string;
/**
* 获取上级selector
* @param element
* @returns
*/
export declare function parentSelector(element: HTMLElement, ignoreId?: boolean): string;
/**
* 获取所有上级节点的selector
* @param {*} element
* @returns
*/
export declare function parentsSelector(element: HTMLElement, ignoreId?: boolean): string[];
export type Options = {
ignoreId: boolean;
};
/**
* 获取xpath
* @param el
* @param customOptions
* @returns
*/
export declare function getXPath(el: any, customOptions?: Partial<Options>): string;
/**
* 将xpath转成css selector
* @param expr
* @returns
*/
export declare function xPathToCss(expr: string): string;