Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'ownerDocument'
)!.get!;
const parentElementGetter: (this: Node) => Element | null = hasOwnProperty.call(
Node.prototype,
'parentElement'
)
? getOwnPropertyDescriptor(Node.prototype, 'parentElement')!.get!
: getOwnPropertyDescriptor(HTMLElement.prototype, 'parentElement')!.get!; // IE11
const textContextSetter: (this: Node, s: string) => void = getOwnPropertyDescriptor(
Node.prototype,
'textContent'
)!.set!;
const childNodesGetter: (this: Node) => NodeListOf = hasOwnProperty.call(
Node.prototype,
'childNodes'
)
? getOwnPropertyDescriptor(Node.prototype, 'childNodes')!.get!
: getOwnPropertyDescriptor(HTMLElement.prototype, 'childNodes')!.get!; // IE11
const isConnected = hasOwnProperty.call(Node.prototype, 'isConnected')
? getOwnPropertyDescriptor(Node.prototype, 'isConnected')!.get!
: function(this: Node): boolean {
const doc = ownerDocumentGetter.call(this);
// IE11
return (
// if doc is null, it means `this` is actually a document instance which
// is always connected
doc === null ||
(compareDocumentPosition.call(doc, this) & DOCUMENT_POSITION_CONTAINED_BY) !== 0
/*
* Copyright (c) 2018, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: MIT
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/
import { getOwnPropertyDescriptor, hasOwnProperty } from '@lwc/shared';
const DocumentPrototypeActiveElement: (this: Document) => Element | null = getOwnPropertyDescriptor(
Document.prototype,
'activeElement'
)!.get!;
const elementFromPoint: (x: number, y: number) => Element | null = hasOwnProperty.call(
Document.prototype,
'elementFromPoint'
)
? Document.prototype.elementFromPoint
: (Document.prototype as any).msElementFromPoint; // IE11
// defaultView can be null when a document has no browsing context. For example, the owner document
// of a node in a template doesn't have a default view: https://jsfiddle.net/hv9z0q5a/
const defaultViewGetter: (this: Document) => Window | null = getOwnPropertyDescriptor(
Document.prototype,
'defaultView'
)!.get!;
const {
createComment,
querySelectorAll,
Object.keys(object).forEach(key => {
const property = object[key];
if (property && hasOwnProperty.call(property, 'code')) {
fn(property as LWCErrorInfo, `${path}.${key}`);
} else if (property) {
traverseErrorInfo(property, fn, `${path}.${key}`);
}
});
}
function fileExists(fileName: string, { files }: NormalizedCompileOptions): boolean {
return hasOwnProperty.call(files, fileName);
}
function fileExists(fileName: string, { files }: NormalizedCompilerOptions): boolean {
return hasOwnProperty.call(files, fileName);
}
const ext = VALID_EXTENSIONS.find(ext => hasOwnProperty.call(files, fileName + ext)) || '';
return fileName + ext;
ParserDiagnostics.LWC_DOM_INVALID_CUSTOM_ELEMENT,
element.__original,
[`<${element.tag}>`]
);
}
if (element.tag === 'slot') {
return warnOnElement(
ParserDiagnostics.LWC_DOM_INVALID_SLOT_ELEMENT,
element.__original
);
}
if (
lwcDomAttribute.type !== IRAttributeType.String ||
hasOwnProperty.call(LWCDirectiveDomMode, lwcDomAttribute.value) === false
) {
const possibleValues = Object.keys(LWCDirectiveDomMode)
.map(value => `"${value}"`)
.join(', or ');
return warnOnElement(ParserDiagnostics.LWC_DOM_INVALID_VALUE, element.__original, [
possibleValues,
]);
}
if (element.children.length > 0) {
return warnOnElement(ParserDiagnostics.LWC_DOM_INVALID_CONTENTS, element.__original);
}
lwcOpts.dom = lwcDomAttribute.value as LWCDirectiveDomMode;
}