New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@locker/shared-dom

Package Overview
Dependencies
Maintainers
7
Versions
236
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@locker/shared-dom - npm Package Compare versions

Comparing version 0.15.0 to 0.15.2

75

dist/index.cjs.js

@@ -130,2 +130,3 @@ /*!

const ElementProtoAttributesGetter = shared.ObjectLookupOwnGetter(Element.prototype, 'attributes');
const ElementProtoGetNamespaceURI = shared.ObjectLookupOwnGetter(Element.prototype, 'namespaceURI');

@@ -192,2 +193,6 @@ function ElementClosest(el, selectors) {

function ElementGetNamespaceURI(el) {
return shared.ReflectApply(ElementProtoGetNamespaceURI, el, shared.emptyArray);
}
const HTMLTemplateElementProtoContentGetter = shared.ObjectLookupOwnGetter(HTMLTemplateElement.prototype, 'content');

@@ -249,8 +254,2 @@

const {
document: document$1
} = window;
const leftTpl = DocumentCreateElement(document$1, 'template');
const rightTpl = DocumentCreateElement(document$1, 'template');
function deepIsEqualNode(leftRoot, rightRoot) {

@@ -280,20 +279,49 @@ const leftRootNode = leftRoot instanceof HTMLTemplateElement ? HTMLTemplateElementContentGetter(leftRoot) : leftRoot;

function isEqualDomString(leftString, rightString) {
ElementInnerHTMLSetter(leftTpl, leftString);
ElementInnerHTMLSetter(rightTpl, rightString);
return deepIsEqualNode(leftTpl, rightTpl);
const globalObjectToValidatorMap = new shared.WeakMapCtor();
/* eslint no-underscore-dangle: ['error',{allowAfterThis:true}] */
class Validator {
constructor(globalObject) {
this.isEqualDomString = (leftString, rightString) => {
ElementInnerHTMLSetter(this._templates.left, leftString);
ElementInnerHTMLSetter(this._templates.right, rightString);
return deepIsEqualNode(this._templates.left, this._templates.right);
};
this.isSharedElement = element => element === DocumentHeadGetter(this._document) || element === DocumentBodyGetter(this._document) || element === DocumentDocumentElementGetter(this._document);
this.isSharedElementChild = element => element instanceof this._constructors.HTMLLinkElement || element instanceof this._constructors.HTMLScriptElement;
this.isMediaSourceObject = object => // MediaSource may not be defined in some browsers
this._constructors.MediaSource && object instanceof this._constructors.MediaSource;
const {
document,
HTMLLinkElement,
HTMLScriptElement,
MediaSource
} = globalObject;
this._constructors = {
HTMLLinkElement,
HTMLScriptElement,
MediaSource
};
this._document = document;
this._templates = {
left: DocumentCreateElement(this._document, 'template'),
right: DocumentCreateElement(this._document, 'template')
};
}
}
function isSharedElement(element, doc = document$1) {
return element === DocumentHeadGetter(doc) || element === DocumentBodyGetter(doc) || element === DocumentDocumentElementGetter(doc);
} // TODO: this will move into a validator object that is globalObject sensitive
// in a follow up changeset.
function getValidator(globalObject) {
let validator = shared.WeakMapGet(globalObjectToValidatorMap, globalObject);
if (!validator) {
validator = new Validator(globalObject);
shared.WeakMapSet(globalObjectToValidatorMap, globalObject, validator);
}
function isInvalidSharedElementChild(element, globalObject = window) {
const {
HTMLLinkElement,
HTMLScriptElement
} = globalObject;
return !(element instanceof HTMLLinkElement) && !(element instanceof HTMLScriptElement);
return validator;
}

@@ -841,2 +869,3 @@

exports.ElementGetAttributeNodeNS = ElementGetAttributeNodeNS;
exports.ElementGetNamespaceURI = ElementGetNamespaceURI;
exports.ElementInnerHTMLGetter = ElementInnerHTMLGetter;

@@ -928,5 +957,3 @@ exports.ElementInnerHTMLSetter = ElementInnerHTMLSetter;

exports.getPatchedWindow = getPatchedWindow;
exports.isEqualDomString = isEqualDomString;
exports.isInvalidSharedElementChild = isInvalidSharedElementChild;
exports.isSharedElement = isSharedElement;
exports.getValidator = getValidator;
exports.isWindow = isWindow;

@@ -937,2 +964,2 @@ exports.isWindowLike = isWindowLike;

exports.patchedWindowPostMessageValue = patchedWindowPostMessageValue;
/*! version: 0.15.0 */
/*! version: 0.15.2 */
/*!
* Copyright (C) 2019 salesforce.com, inc.
*/
import { ObjectLookupOwnGetter, ReflectGetOwnPropertyDescriptor, ReflectApply, emptyArray, ObjectLookupOwnSetter, StringToUpperCase, JSONParse, JSONStringify, StringToLowerCase, ObjectLookupOwnValue, ReflectDefineProperty, WeakMapCtor, isObject, WeakMapGet, WeakMapSet, ObjectHasOwnProperty, toSafeDescriptor, FunctionBind } from '@locker/shared';
import { ObjectLookupOwnGetter, ReflectGetOwnPropertyDescriptor, ReflectApply, emptyArray, ObjectLookupOwnSetter, StringToUpperCase, WeakMapCtor, WeakMapGet, WeakMapSet, JSONParse, JSONStringify, StringToLowerCase, ObjectLookupOwnValue, ReflectDefineProperty, isObject, ObjectHasOwnProperty, toSafeDescriptor, FunctionBind } from '@locker/shared';
const AttrProtoNameGetter = ObjectLookupOwnGetter(Attr.prototype, 'name');

@@ -123,2 +123,3 @@ const AttrProtoNamespaceURIGetter = ObjectLookupOwnGetter(Attr.prototype, 'namespaceURI');

const ElementProtoAttributesGetter = ObjectLookupOwnGetter(Element.prototype, 'attributes');
const ElementProtoGetNamespaceURI = ObjectLookupOwnGetter(Element.prototype, 'namespaceURI');

@@ -185,2 +186,6 @@ function ElementClosest(el, selectors) {

function ElementGetNamespaceURI(el) {
return ReflectApply(ElementProtoGetNamespaceURI, el, emptyArray);
}
const HTMLTemplateElementProtoContentGetter = ObjectLookupOwnGetter(HTMLTemplateElement.prototype, 'content');

@@ -242,8 +247,2 @@

const {
document: document$1
} = window;
const leftTpl = DocumentCreateElement(document$1, 'template');
const rightTpl = DocumentCreateElement(document$1, 'template');
function deepIsEqualNode(leftRoot, rightRoot) {

@@ -273,20 +272,49 @@ const leftRootNode = leftRoot instanceof HTMLTemplateElement ? HTMLTemplateElementContentGetter(leftRoot) : leftRoot;

function isEqualDomString(leftString, rightString) {
ElementInnerHTMLSetter(leftTpl, leftString);
ElementInnerHTMLSetter(rightTpl, rightString);
return deepIsEqualNode(leftTpl, rightTpl);
const globalObjectToValidatorMap = new WeakMapCtor();
/* eslint no-underscore-dangle: ['error',{allowAfterThis:true}] */
class Validator {
constructor(globalObject) {
this.isEqualDomString = (leftString, rightString) => {
ElementInnerHTMLSetter(this._templates.left, leftString);
ElementInnerHTMLSetter(this._templates.right, rightString);
return deepIsEqualNode(this._templates.left, this._templates.right);
};
this.isSharedElement = element => element === DocumentHeadGetter(this._document) || element === DocumentBodyGetter(this._document) || element === DocumentDocumentElementGetter(this._document);
this.isSharedElementChild = element => element instanceof this._constructors.HTMLLinkElement || element instanceof this._constructors.HTMLScriptElement;
this.isMediaSourceObject = object => // MediaSource may not be defined in some browsers
this._constructors.MediaSource && object instanceof this._constructors.MediaSource;
const {
document,
HTMLLinkElement,
HTMLScriptElement,
MediaSource
} = globalObject;
this._constructors = {
HTMLLinkElement,
HTMLScriptElement,
MediaSource
};
this._document = document;
this._templates = {
left: DocumentCreateElement(this._document, 'template'),
right: DocumentCreateElement(this._document, 'template')
};
}
}
function isSharedElement(element, doc = document$1) {
return element === DocumentHeadGetter(doc) || element === DocumentBodyGetter(doc) || element === DocumentDocumentElementGetter(doc);
} // TODO: this will move into a validator object that is globalObject sensitive
// in a follow up changeset.
function getValidator(globalObject) {
let validator = WeakMapGet(globalObjectToValidatorMap, globalObject);
if (!validator) {
validator = new Validator(globalObject);
WeakMapSet(globalObjectToValidatorMap, globalObject, validator);
}
function isInvalidSharedElementChild(element, globalObject = window) {
const {
HTMLLinkElement,
HTMLScriptElement
} = globalObject;
return !(element instanceof HTMLLinkElement) && !(element instanceof HTMLScriptElement);
return validator;
}

@@ -800,3 +828,3 @@

export { AttrNameGetter, AttrNamespaceURIGetter, AttrOwnerElementGetter, AttrValueGetter, AttrValueSetter, BlobCtor, BlobSizeGetter, BlobSlice, BlobTypeGetter, CookieStoreProtoDelete, CookieStoreProtoGet, CookieStoreProtoGetAll, CookieStoreProtoSet, CustomElementRegistryProtoDefine, CustomElementRegistryProtoGet, DOMImplementationCreateDocument, DOMParserProtoParseFromString, DOMTokenListValueGetter, DocumentBodyGetter, DocumentCookieGetter, DocumentCookieSetter, DocumentCreateComment, DocumentCreateElement, DocumentCreateElementNS, DocumentDocumentElementGetter, DocumentFragmentGetElementById, DocumentGetElementById, DocumentHeadGetter, DocumentImplementation, DocumentProtoExecCommand, ElementAttributesGetter, ElementClosest, ElementGetAttributeNode, ElementGetAttributeNodeNS, ElementInnerHTMLGetter, ElementInnerHTMLSetter, ElementOuterHTMLGetter, ElementOuterHTMLSetter, ElementProtoAttachShadow, ElementProtoSetAttribute, ElementProtoSetAttributeNS, ElementProtoSetAttributeNode, ElementQuerySelector, ElementRemove, ElementRemoveAttributeNode, ElementSetAttribute, ElementSetAttributeNS, ElementSetAttributeNode, ElementSetAttributeNodeNS, EventCurrentTargetGetter, EventProtoComposedPath, EventTargetAddEventListener, HAS_BREAKABLE_CSS_STYLE_DECLARATION_MAGIC_OBJECT, HTMLAnchorElementHostnameGetter, HTMLAnchorElementHrefGetter, HTMLAnchorElementHrefSetter, HTMLAnchorElementPathnameGetter, HTMLAnchorElementProtocolGetter, HTMLElementDatasetGetter, HTMLElementInnerTextSetter, HTMLElementOuterTextSetter, HTMLElementStyleGetter, HTMLFrameElementContentDocumentGetter, HTMLFrameElementContentWindowGetter, HTMLIFrameElementContentDocumentGetter, HTMLIFrameElementContentWindowGetter, HTMLIFrameElementSrcSetter, HTMLLinkElementRelListSetter, HTMLLinkElementRelSetter, HTMLObjectElementContentDocumentGetter, HTMLObjectElementContentWindowGetter, HTMLScriptElementProtoSrcGetter, HTMLScriptElementProtoSrcSetter, HTMLTemplateElementContentGetter, JSONClone, MessageEventSourceGetter, NAMESPACE_DEFAULT, NAMESPACE_SVG, NAMESPACE_XHTML, NAMESPACE_XLINK, NamedNodeMapProtoSetNamedItem, NodeAppendChild, NodeChildNodesGetter, NodeClone, NodeFirstChildGetter, NodeIsEqualNode, NodeLastChildGetter, NodeNameGetter, NodeOwnerDocumentGetter, NodeTextContentSetter, RangeProtoCreateContextualFragment, RequestURLGetter, SVGElementDatasetGetter, ShadowRootInnerHTMLSetter, StorageProtoGetItem, StorageProtoKey, StorageProtoRemoveItem, StorageProtoSetItem, URLCreateObjectURL, URLRevokeObjectURL, WindowClearInterval, WindowLengthGetter, WindowOpenerGetter, WindowParentGetter, WindowSelfGetter, WindowSetInterval, WindowStaticDecodeURIComponent, WindowStaticEncodeURIComponent, WindowStaticFetch, WindowStaticOpen, WindowStaticSetInterval, WindowStaticSetTimeout, XhrCtor, XhrOpen, XhrProtoOpen, XhrResponseTextGetter, XhrSend, XhrStatusGetter, XhrWithCredentialsSetter, getPatchedWindow, isEqualDomString, isInvalidSharedElementChild, isSharedElement, isWindow, isWindowLike, nsCookieKey, nsCookieRootKey, patchedWindowPostMessageValue };
/*! version: 0.15.0 */
export { AttrNameGetter, AttrNamespaceURIGetter, AttrOwnerElementGetter, AttrValueGetter, AttrValueSetter, BlobCtor, BlobSizeGetter, BlobSlice, BlobTypeGetter, CookieStoreProtoDelete, CookieStoreProtoGet, CookieStoreProtoGetAll, CookieStoreProtoSet, CustomElementRegistryProtoDefine, CustomElementRegistryProtoGet, DOMImplementationCreateDocument, DOMParserProtoParseFromString, DOMTokenListValueGetter, DocumentBodyGetter, DocumentCookieGetter, DocumentCookieSetter, DocumentCreateComment, DocumentCreateElement, DocumentCreateElementNS, DocumentDocumentElementGetter, DocumentFragmentGetElementById, DocumentGetElementById, DocumentHeadGetter, DocumentImplementation, DocumentProtoExecCommand, ElementAttributesGetter, ElementClosest, ElementGetAttributeNode, ElementGetAttributeNodeNS, ElementGetNamespaceURI, ElementInnerHTMLGetter, ElementInnerHTMLSetter, ElementOuterHTMLGetter, ElementOuterHTMLSetter, ElementProtoAttachShadow, ElementProtoSetAttribute, ElementProtoSetAttributeNS, ElementProtoSetAttributeNode, ElementQuerySelector, ElementRemove, ElementRemoveAttributeNode, ElementSetAttribute, ElementSetAttributeNS, ElementSetAttributeNode, ElementSetAttributeNodeNS, EventCurrentTargetGetter, EventProtoComposedPath, EventTargetAddEventListener, HAS_BREAKABLE_CSS_STYLE_DECLARATION_MAGIC_OBJECT, HTMLAnchorElementHostnameGetter, HTMLAnchorElementHrefGetter, HTMLAnchorElementHrefSetter, HTMLAnchorElementPathnameGetter, HTMLAnchorElementProtocolGetter, HTMLElementDatasetGetter, HTMLElementInnerTextSetter, HTMLElementOuterTextSetter, HTMLElementStyleGetter, HTMLFrameElementContentDocumentGetter, HTMLFrameElementContentWindowGetter, HTMLIFrameElementContentDocumentGetter, HTMLIFrameElementContentWindowGetter, HTMLIFrameElementSrcSetter, HTMLLinkElementRelListSetter, HTMLLinkElementRelSetter, HTMLObjectElementContentDocumentGetter, HTMLObjectElementContentWindowGetter, HTMLScriptElementProtoSrcGetter, HTMLScriptElementProtoSrcSetter, HTMLTemplateElementContentGetter, JSONClone, MessageEventSourceGetter, NAMESPACE_DEFAULT, NAMESPACE_SVG, NAMESPACE_XHTML, NAMESPACE_XLINK, NamedNodeMapProtoSetNamedItem, NodeAppendChild, NodeChildNodesGetter, NodeClone, NodeFirstChildGetter, NodeIsEqualNode, NodeLastChildGetter, NodeNameGetter, NodeOwnerDocumentGetter, NodeTextContentSetter, RangeProtoCreateContextualFragment, RequestURLGetter, SVGElementDatasetGetter, ShadowRootInnerHTMLSetter, StorageProtoGetItem, StorageProtoKey, StorageProtoRemoveItem, StorageProtoSetItem, URLCreateObjectURL, URLRevokeObjectURL, WindowClearInterval, WindowLengthGetter, WindowOpenerGetter, WindowParentGetter, WindowSelfGetter, WindowSetInterval, WindowStaticDecodeURIComponent, WindowStaticEncodeURIComponent, WindowStaticFetch, WindowStaticOpen, WindowStaticSetInterval, WindowStaticSetTimeout, XhrCtor, XhrOpen, XhrProtoOpen, XhrResponseTextGetter, XhrSend, XhrStatusGetter, XhrWithCredentialsSetter, getPatchedWindow, getValidator, isWindow, isWindowLike, nsCookieKey, nsCookieRootKey, patchedWindowPostMessageValue };
/*! version: 0.15.2 */
{
"name": "@locker/shared-dom",
"version": "0.15.0",
"version": "0.15.2",
"license": "Salesforce Developer Agreement",

@@ -20,3 +20,3 @@ "author": "Salesforce UI Security Team",

"dependencies": {
"@locker/shared": "0.15.0"
"@locker/shared": "0.15.2"
},

@@ -27,3 +27,3 @@ "files": [

],
"gitHead": "864a503d2d60e4bca4801ab4d7ddee1c588bcc91"
"gitHead": "8eb2cdc03049ffe0d7b6f1e37380cce3642bd3be"
}

@@ -1,5 +0,4 @@

export declare function isEqualDomString(leftString: string, rightString: string): boolean;
export declare function isSharedElement(element: Element | HTMLElement | Node, doc?: Document): boolean;
export declare function isInvalidSharedElementChild(element: Element | HTMLElement | Node | string, globalObject?: Window & typeof globalThis): boolean;
import { GlobalObject } from './types';
export declare function getValidator(globalObject: GlobalObject): any;
export declare function JSONClone(value: any): any;
//# sourceMappingURL=basic.d.ts.map

@@ -17,2 +17,3 @@ export declare const ElementProtoAttachShadow: (init: ShadowRootInit) => ShadowRoot, ElementProtoSetAttribute: (qualifiedName: string, value: string) => void, ElementProtoSetAttributeNS: (namespace: string | null, qualifiedName: string, value: string) => void, ElementProtoSetAttributeNode: (attr: Attr) => Attr | null;

export declare function ElementSetAttributeNS(el: Element, namespace: string, name: string, value: string): ReturnType<typeof Element.prototype.setAttributeNS>;
export declare function ElementGetNamespaceURI(el: Element): typeof Element.prototype.namespaceURI;
//# sourceMappingURL=Element.d.ts.map

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc