@lumino/domutils
Advanced tools
Comparing version 1.5.2 to 1.6.0
@@ -258,3 +258,3 @@ // Copyright (c) Jupyter Development Team. | ||
var result = Private.calculateSingle(selector); | ||
return Private.specificityCache[selector] = result; | ||
return (Private.specificityCache[selector] = result); | ||
} | ||
@@ -284,3 +284,3 @@ Selector.calculateSpecificity = calculateSpecificity; | ||
} | ||
return Private.validityCache[selector] = result; | ||
return (Private.validityCache[selector] = result); | ||
} | ||
@@ -334,7 +334,9 @@ Selector.isValid = isValid; | ||
proto.webkitMatchesSelector || | ||
(function (selector) { | ||
function (selector) { | ||
var elem = this; | ||
var matches = elem.ownerDocument ? elem.ownerDocument.querySelectorAll(selector) : []; | ||
var matches = elem.ownerDocument | ||
? elem.ownerDocument.querySelectorAll(selector) | ||
: []; | ||
return Array.prototype.indexOf.call(matches, elem) !== -1; | ||
})); | ||
}); | ||
})(); | ||
@@ -407,5 +409,5 @@ /** | ||
// Clamp each component to a reasonable base. | ||
a = Math.min(a, 0xFF); | ||
b = Math.min(b, 0xFF); | ||
c = Math.min(c, 0xFF); | ||
a = Math.min(a, 0xff); | ||
b = Math.min(b, 0xff); | ||
c = Math.min(c, 0xff); | ||
// Combine the components into a single result. | ||
@@ -412,0 +414,0 @@ return (a << 16) | (b << 8) | c; |
@@ -264,3 +264,3 @@ (function (global, factory) { | ||
var result = Private.calculateSingle(selector); | ||
return Private.specificityCache[selector] = result; | ||
return (Private.specificityCache[selector] = result); | ||
} | ||
@@ -290,3 +290,3 @@ Selector.calculateSpecificity = calculateSpecificity; | ||
} | ||
return Private.validityCache[selector] = result; | ||
return (Private.validityCache[selector] = result); | ||
} | ||
@@ -340,7 +340,9 @@ Selector.isValid = isValid; | ||
proto.webkitMatchesSelector || | ||
(function (selector) { | ||
function (selector) { | ||
var elem = this; | ||
var matches = elem.ownerDocument ? elem.ownerDocument.querySelectorAll(selector) : []; | ||
var matches = elem.ownerDocument | ||
? elem.ownerDocument.querySelectorAll(selector) | ||
: []; | ||
return Array.prototype.indexOf.call(matches, elem) !== -1; | ||
})); | ||
}); | ||
})(); | ||
@@ -413,5 +415,5 @@ /** | ||
// Clamp each component to a reasonable base. | ||
a = Math.min(a, 0xFF); | ||
b = Math.min(b, 0xFF); | ||
c = Math.min(c, 0xFF); | ||
a = Math.min(a, 0xff); | ||
b = Math.min(b, 0xff); | ||
c = Math.min(c, 0xff); | ||
// Combine the components into a single result. | ||
@@ -418,0 +420,0 @@ return (a << 16) | (b << 8) | c; |
{ | ||
"name": "@lumino/domutils", | ||
"version": "1.5.2", | ||
"version": "1.6.0", | ||
"description": "Lumino DOM Utilities", | ||
@@ -72,4 +72,3 @@ "homepage": "https://github.com/jupyterlab/lumino", | ||
"access": "public" | ||
}, | ||
"gitHead": "79b0d03a9d78fbc7055114bdafbd9d5d531490ce" | ||
} | ||
} |
@@ -14,4 +14,3 @@ // Copyright (c) Jupyter Development Team. | ||
*/ | ||
export | ||
namespace ClipboardExt { | ||
export namespace ClipboardExt { | ||
/** | ||
@@ -22,4 +21,3 @@ * Copy text to the system clipboard. | ||
*/ | ||
export | ||
function copyText(text: string): void { | ||
export function copyText(text: string): void { | ||
// Fetch the document body. | ||
@@ -26,0 +24,0 @@ const body = document.body; |
@@ -11,13 +11,10 @@ // Copyright (c) Jupyter Development Team. | ||
/** | ||
* The namespace for element related utilities. | ||
*/ | ||
export | ||
namespace ElementExt { | ||
export namespace ElementExt { | ||
/** | ||
* An object which holds the border and padding data for an element. | ||
*/ | ||
export | ||
interface IBoxSizing { | ||
export interface IBoxSizing { | ||
/** | ||
@@ -81,4 +78,3 @@ * The top border width, in pixels. | ||
*/ | ||
export | ||
function boxSizing(element: Element): IBoxSizing { | ||
export function boxSizing(element: Element): IBoxSizing { | ||
let style = window.getComputedStyle(element); | ||
@@ -112,4 +108,3 @@ let bt = parseFloat(style.borderTopWidth!) || 0; | ||
*/ | ||
export | ||
interface ISizeLimits { | ||
export interface ISizeLimits { | ||
/** | ||
@@ -143,4 +138,3 @@ * The minimum width, in pixels. | ||
*/ | ||
export | ||
function sizeLimits(element: Element): ISizeLimits { | ||
export function sizeLimits(element: Element): ISizeLimits { | ||
let style = window.getComputedStyle(element); | ||
@@ -167,4 +161,7 @@ let minWidth = parseFloat(style.minWidth!) || 0; | ||
*/ | ||
export | ||
function hitTest(element: Element, clientX: number, clientY: number): boolean { | ||
export function hitTest( | ||
element: Element, | ||
clientX: number, | ||
clientY: number | ||
): boolean { | ||
let rect = element.getBoundingClientRect(); | ||
@@ -195,4 +192,6 @@ return ( | ||
*/ | ||
export | ||
function scrollIntoViewIfNeeded(area: Element, element: Element): void { | ||
export function scrollIntoViewIfNeeded( | ||
area: Element, | ||
element: Element | ||
): void { | ||
let ar = area.getBoundingClientRect(); | ||
@@ -199,0 +198,0 @@ let er = element.getBoundingClientRect(); |
@@ -11,13 +11,10 @@ // Copyright (c) Jupyter Development Team. | ||
/** | ||
* The namespace for platform related utilities. | ||
*/ | ||
export | ||
namespace Platform { | ||
export namespace Platform { | ||
/** | ||
* A flag indicating whether the platform is Mac. | ||
*/ | ||
export | ||
const IS_MAC = !!navigator.platform.match(/Mac/i); | ||
export const IS_MAC = !!navigator.platform.match(/Mac/i); | ||
@@ -27,4 +24,3 @@ /** | ||
*/ | ||
export | ||
const IS_WIN = !!navigator.platform.match(/Win/i); | ||
export const IS_WIN = !!navigator.platform.match(/Win/i); | ||
@@ -34,4 +30,3 @@ /** | ||
*/ | ||
export | ||
const IS_IE = /Trident/.test(navigator.userAgent); | ||
export const IS_IE = /Trident/.test(navigator.userAgent); | ||
@@ -41,4 +36,3 @@ /** | ||
*/ | ||
export | ||
const IS_EDGE = /Edge/.test(navigator.userAgent); | ||
export const IS_EDGE = /Edge/.test(navigator.userAgent); | ||
@@ -56,6 +50,5 @@ /** | ||
*/ | ||
export | ||
function accelKey(event: KeyboardEvent | MouseEvent): boolean { | ||
export function accelKey(event: KeyboardEvent | MouseEvent): boolean { | ||
return IS_MAC ? event.metaKey : event.ctrlKey; | ||
} | ||
} |
@@ -11,8 +11,6 @@ // Copyright (c) Jupyter Development Team. | ||
/** | ||
* The namespace for selector related utilities. | ||
*/ | ||
export | ||
namespace Selector { | ||
export namespace Selector { | ||
/** | ||
@@ -43,4 +41,3 @@ * Calculate the specificity of a single CSS selector. | ||
*/ | ||
export | ||
function calculateSpecificity(selector: string): number { | ||
export function calculateSpecificity(selector: string): number { | ||
if (selector in Private.specificityCache) { | ||
@@ -50,3 +47,3 @@ return Private.specificityCache[selector]; | ||
let result = Private.calculateSingle(selector); | ||
return Private.specificityCache[selector] = result; | ||
return (Private.specificityCache[selector] = result); | ||
} | ||
@@ -65,4 +62,3 @@ | ||
*/ | ||
export | ||
function isValid(selector: string): boolean { | ||
export function isValid(selector: string): boolean { | ||
if (selector in Private.validityCache) { | ||
@@ -77,3 +73,3 @@ return Private.validityCache[selector]; | ||
} | ||
return Private.validityCache[selector] = result; | ||
return (Private.validityCache[selector] = result); | ||
} | ||
@@ -94,4 +90,3 @@ | ||
*/ | ||
export | ||
function matches(element: Element, selector: string): boolean { | ||
export function matches(element: Element, selector: string): boolean { | ||
return Private.protoMatchFunc.call(element, selector); | ||
@@ -101,3 +96,2 @@ } | ||
/** | ||
@@ -110,4 +104,3 @@ * The namespace for the module implementation details. | ||
*/ | ||
export | ||
type StringMap<T> = { [key: string]: T }; | ||
export type StringMap<T> = { [key: string]: T }; | ||
@@ -117,4 +110,3 @@ /** | ||
*/ | ||
export | ||
const specificityCache: StringMap<number> = Object.create(null); | ||
export const specificityCache: StringMap<number> = Object.create(null); | ||
@@ -124,4 +116,3 @@ /** | ||
*/ | ||
export | ||
const validityCache: StringMap<boolean> = Object.create(null); | ||
export const validityCache: StringMap<boolean> = Object.create(null); | ||
@@ -131,4 +122,3 @@ /** | ||
*/ | ||
export | ||
const testElem = document.createElement('div'); | ||
export const testElem = document.createElement('div'); | ||
@@ -138,4 +128,3 @@ /** | ||
*/ | ||
export | ||
const protoMatchFunc: Function = (() => { | ||
export const protoMatchFunc: Function = (() => { | ||
let proto = Element.prototype as any; | ||
@@ -149,7 +138,9 @@ return ( | ||
proto.webkitMatchesSelector || | ||
(function(selector: string) { | ||
function (selector: string) { | ||
let elem = this as Element; | ||
let matches = elem.ownerDocument ? elem.ownerDocument.querySelectorAll(selector) : []; | ||
let matches = elem.ownerDocument | ||
? elem.ownerDocument.querySelectorAll(selector) | ||
: []; | ||
return Array.prototype.indexOf.call(matches, elem) !== -1; | ||
}) | ||
} | ||
); | ||
@@ -163,4 +154,3 @@ })(); | ||
*/ | ||
export | ||
function calculateSingle(selector: string): number { | ||
export function calculateSingle(selector: string): number { | ||
// Ignore anything after the first comma. | ||
@@ -191,24 +181,43 @@ selector = selector.split(',', 1)[0]; | ||
while (selector.length > 0) { | ||
// Match an ID selector. | ||
if (match(ID_RE)) { a++; continue; } | ||
if (match(ID_RE)) { | ||
a++; | ||
continue; | ||
} | ||
// Match a class selector. | ||
if (match(CLASS_RE)) { b++; continue; } | ||
if (match(CLASS_RE)) { | ||
b++; | ||
continue; | ||
} | ||
// Match an attribute selector. | ||
if (match(ATTR_RE)) { b++; continue; } | ||
if (match(ATTR_RE)) { | ||
b++; | ||
continue; | ||
} | ||
// Match a pseudo-element selector. This is done before matching | ||
// a pseudo-class since this regex overlaps with that regex. | ||
if (match(PSEUDO_ELEM_RE)) { c++; continue; } | ||
if (match(PSEUDO_ELEM_RE)) { | ||
c++; | ||
continue; | ||
} | ||
// Match a pseudo-class selector. | ||
if (match(PSEDUO_CLASS_RE)) { b++; continue; } | ||
if (match(PSEDUO_CLASS_RE)) { | ||
b++; | ||
continue; | ||
} | ||
// Match a plain type selector. | ||
if (match(TYPE_RE)) { c++; continue; } | ||
if (match(TYPE_RE)) { | ||
c++; | ||
continue; | ||
} | ||
// Finally, match any ignored characters. | ||
if (match(IGNORE_RE)) { continue; } | ||
if (match(IGNORE_RE)) { | ||
continue; | ||
} | ||
@@ -220,5 +229,5 @@ // At this point, the selector is assumed to be invalid. | ||
// Clamp each component to a reasonable base. | ||
a = Math.min(a, 0xFF); | ||
b = Math.min(b, 0xFF); | ||
c = Math.min(c, 0xFF); | ||
a = Math.min(a, 0xff); | ||
b = Math.min(b, 0xff); | ||
c = Math.min(c, 0xff); | ||
@@ -225,0 +234,0 @@ // Combine the components into a single result. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
0
1649
132686
22