本文整理匯總了TypeScript中dom5.predicates.NOT方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript predicates.NOT方法的具體用法?TypeScript predicates.NOT怎麽用?TypeScript predicates.NOT使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dom5.predicates
的用法示例。
在下文中一共展示了predicates.NOT方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: _moveUnhiddenHtmlImportsIntoHiddenDiv
/**
* Move any remaining htmlImports that are not inside the hidden div
* already, into the hidden div.
*/
private _moveUnhiddenHtmlImportsIntoHiddenDiv(ast: ASTNode) {
const unhiddenHtmlImports = dom5.queryAll(
ast,
dom5.predicates.AND(
matchers.eagerHtmlImport,
dom5.predicates.NOT(matchers.inHiddenDiv)));
for (const htmlImport of unhiddenHtmlImports) {
removeElementAndNewline(htmlImport);
dom5.append(this._findOrCreateHiddenDiv(ast), htmlImport);
}
}
示例2:
// jshint node: true
'use strict';
import constants from './constants';
import {predicates} from 'dom5';
import * as parse5 from 'parse5';
export interface Matcher { (node: parse5.ASTNode): boolean; }
// TODO(aomarks) Look at what's using this matcher. A number of code paths
// should probably not be excluding type=module scripts.
export const nonModuleScript: Matcher = predicates.AND(
predicates.hasTagName('script'),
predicates.OR(
predicates.NOT(predicates.hasAttr('type')),
predicates.hasAttrValue('type', 'text/javascript'),
predicates.hasAttrValue('type', 'application/javascript')));
export const moduleScript: Matcher = predicates.AND(
predicates.hasTagName('script'), predicates.hasAttrValue('type', 'module'));
export const externalStyle: Matcher = predicates.AND(
predicates.hasTagName('link'),
predicates.hasAttrValue('rel', 'stylesheet'));
// polymer specific external stylesheet
export const polymerExternalStyle: Matcher = predicates.AND(
predicates.hasTagName('link'),
predicates.hasAttrValue('rel', 'import'),
predicates.hasAttrValue('type', 'css'));