rc-util
Advanced tools
Comparing version 5.24.5 to 5.24.6
@@ -13,3 +13,7 @@ export type Prepend = boolean | 'queue'; | ||
export declare function removeCSS(key: string, option?: Options): void; | ||
/** | ||
* manually clear container cache to avoid global cache in unit testes | ||
*/ | ||
export declare function clearContainerCache(): void; | ||
export declare function updateCSS(css: string, key: string, option?: Options): HTMLStyleElement; | ||
export {}; |
@@ -76,6 +76,8 @@ import canUseDom from './canUseDom'; | ||
export function removeCSS(key) { | ||
var _existNode$parentNode; | ||
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var existNode = findExistNode(key, option); | ||
existNode === null || existNode === void 0 ? void 0 : (_existNode$parentNode = existNode.parentNode) === null || _existNode$parentNode === void 0 ? void 0 : _existNode$parentNode.removeChild(existNode); | ||
if (existNode) { | ||
var container = getContainer(option); | ||
container.removeChild(existNode); | ||
} | ||
} | ||
@@ -92,5 +94,11 @@ /** | ||
containerCache.set(container, parentNode); | ||
parentNode.removeChild(placeholderStyle); | ||
container.removeChild(placeholderStyle); | ||
} | ||
} | ||
/** | ||
* manually clear container cache to avoid global cache in unit testes | ||
*/ | ||
export function clearContainerCache() { | ||
containerCache.clear(); | ||
} | ||
export function updateCSS(css, key) { | ||
@@ -97,0 +105,0 @@ var option = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; |
@@ -13,3 +13,7 @@ export type Prepend = boolean | 'queue'; | ||
export declare function removeCSS(key: string, option?: Options): void; | ||
/** | ||
* manually clear container cache to avoid global cache in unit testes | ||
*/ | ||
export declare function clearContainerCache(): void; | ||
export declare function updateCSS(css: string, key: string, option?: Options): HTMLStyleElement; | ||
export {}; |
@@ -7,2 +7,3 @@ "use strict"; | ||
}); | ||
exports.clearContainerCache = clearContainerCache; | ||
exports.injectCSS = injectCSS; | ||
@@ -86,6 +87,8 @@ exports.removeCSS = removeCSS; | ||
function removeCSS(key) { | ||
var _existNode$parentNode; | ||
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var existNode = findExistNode(key, option); | ||
existNode === null || existNode === void 0 ? void 0 : (_existNode$parentNode = existNode.parentNode) === null || _existNode$parentNode === void 0 ? void 0 : _existNode$parentNode.removeChild(existNode); | ||
if (existNode) { | ||
var container = getContainer(option); | ||
container.removeChild(existNode); | ||
} | ||
} | ||
@@ -102,5 +105,11 @@ /** | ||
containerCache.set(container, parentNode); | ||
parentNode.removeChild(placeholderStyle); | ||
container.removeChild(placeholderStyle); | ||
} | ||
} | ||
/** | ||
* manually clear container cache to avoid global cache in unit testes | ||
*/ | ||
function clearContainerCache() { | ||
containerCache.clear(); | ||
} | ||
function updateCSS(css, key) { | ||
@@ -107,0 +116,0 @@ var option = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; |
{ | ||
"name": "rc-util", | ||
"version": "5.24.5", | ||
"version": "5.24.6", | ||
"description": "Common Utils For React Component", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
204851
6392