mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
Add type definitions for insert-css (#31263)
* Add type definitions for insert-css * Correct indentation in insert-css-tests.ts * Make createElement calls consistent * Use single quotes in import
This commit is contained in:
committed by
Nathan Shively-Sanders
parent
5b5759e17b
commit
1935ac55bc
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// Type definitions for insert-css 2.0
|
||||
// Project: https://github.com/substack/insert-css
|
||||
// Definitions by: Heye Vöcking <https://github.com/hvoecking>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export interface InsertCssOptions {
|
||||
container?: HTMLElement;
|
||||
prepend?: boolean;
|
||||
}
|
||||
|
||||
export interface InsertCssStyleElement extends HTMLStyleElement {
|
||||
styleSheet?: CSSStyleSheet;
|
||||
}
|
||||
|
||||
export function insertCss(
|
||||
css: string,
|
||||
options?: InsertCssOptions,
|
||||
): InsertCssStyleElement;
|
||||
@@ -0,0 +1,27 @@
|
||||
import { insertCss } from 'insert-css';
|
||||
|
||||
insertCss('body{position:absolute}');
|
||||
|
||||
insertCss('body{position:absolute}', {});
|
||||
|
||||
insertCss('body{text-decoration:underline !important}', {
|
||||
prepend: true,
|
||||
});
|
||||
|
||||
insertCss('body{text-decoration:underline !important}', {
|
||||
prepend: false,
|
||||
});
|
||||
|
||||
insertCss('body{position:absolute}', {
|
||||
container: document.createElement(''),
|
||||
});
|
||||
|
||||
insertCss('body{text-decoration:underline !important}', {
|
||||
prepend: true,
|
||||
container: document.createElement(''),
|
||||
});
|
||||
|
||||
insertCss('body{text-decoration:underline !important}', {
|
||||
prepend: false,
|
||||
container: document.createElement(''),
|
||||
});
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "../",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"lib": [
|
||||
"dom",
|
||||
"es6"
|
||||
],
|
||||
"module": "commonjs",
|
||||
"noEmit": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"strictNullChecks": true,
|
||||
"typeRoots": ["../"],
|
||||
"types": []
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"insert-css-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user