@locker/shared-dom
Advanced tools
Comparing version 0.14.4 to 0.14.5
@@ -6,3 +6,5 @@ /*! | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
@@ -14,109 +16,184 @@ var shared = require('@locker/shared'); | ||
const AttrProtoOwnerElementGetter = shared.ObjectLookupOwnGetter(Attr.prototype, 'ownerElement'); | ||
const { get: AttrProtoValueGetter, set: AttrProtoValueSetter } = shared.ReflectGetOwnPropertyDescriptor(Attr.prototype, 'value'); | ||
const { | ||
get: AttrProtoValueGetter, | ||
set: AttrProtoValueSetter | ||
} = shared.ReflectGetOwnPropertyDescriptor(Attr.prototype, 'value'); | ||
function AttrNameGetter(attr) { | ||
return shared.ReflectApply(AttrProtoNameGetter, attr, shared.emptyArray); | ||
return shared.ReflectApply(AttrProtoNameGetter, attr, shared.emptyArray); | ||
} | ||
function AttrNamespaceURIGetter(attr) { | ||
return shared.ReflectApply(AttrProtoNamespaceURIGetter, attr, shared.emptyArray); | ||
return shared.ReflectApply(AttrProtoNamespaceURIGetter, attr, shared.emptyArray); | ||
} | ||
function AttrOwnerElementGetter(attr) { | ||
return shared.ReflectApply(AttrProtoOwnerElementGetter, attr, shared.emptyArray); | ||
return shared.ReflectApply(AttrProtoOwnerElementGetter, attr, shared.emptyArray); | ||
} | ||
function AttrValueGetter(attr) { | ||
return shared.ReflectApply(AttrProtoValueGetter, attr, shared.emptyArray); | ||
return shared.ReflectApply(AttrProtoValueGetter, attr, shared.emptyArray); | ||
} | ||
function AttrValueSetter(attr, value) { | ||
shared.ReflectApply(AttrProtoValueSetter, attr, [value]); | ||
shared.ReflectApply(AttrProtoValueSetter, attr, [value]); | ||
} | ||
const { get: DocumentProtoCookieGetter, set: DocumentProtoCookieSetter, } = shared.ReflectGetOwnPropertyDescriptor(Document.prototype, 'cookie'); | ||
const { createComment: DocumentProtoCreateComment, createElement: DocumentProtoCreateElement, createElementNS: DocumentProtoCreateElementNS, getElementById: DocumentProtoGetElementById, } = Document.prototype; | ||
const { | ||
get: DocumentProtoCookieGetter, | ||
set: DocumentProtoCookieSetter | ||
} = shared.ReflectGetOwnPropertyDescriptor(Document.prototype, 'cookie'); | ||
const { | ||
createComment: DocumentProtoCreateComment, | ||
createElement: DocumentProtoCreateElement, | ||
createElementNS: DocumentProtoCreateElementNS, | ||
getElementById: DocumentProtoGetElementById | ||
} = Document.prototype; | ||
const DocumentProtoBodyGetter = shared.ObjectLookupOwnGetter(Document.prototype, 'body'); | ||
const DocumentProtoHeadGetter = shared.ObjectLookupOwnGetter(Document.prototype, 'head'); | ||
const { execCommand: DocumentProtoExecCommand } = Document.prototype; | ||
const { | ||
execCommand: DocumentProtoExecCommand | ||
} = Document.prototype; | ||
function DocumentBodyGetter(doc) { | ||
return shared.ReflectApply(DocumentProtoBodyGetter, doc, shared.emptyArray); | ||
return shared.ReflectApply(DocumentProtoBodyGetter, doc, shared.emptyArray); | ||
} | ||
function DocumentCookieGetter(doc) { | ||
return shared.ReflectApply(DocumentProtoCookieGetter, doc, shared.emptyArray); | ||
return shared.ReflectApply(DocumentProtoCookieGetter, doc, shared.emptyArray); | ||
} | ||
function DocumentCookieSetter(doc, newCookie) { | ||
shared.ReflectApply(DocumentProtoCookieSetter, doc, [newCookie]); | ||
shared.ReflectApply(DocumentProtoCookieSetter, doc, [newCookie]); | ||
} | ||
function DocumentCreateComment(doc, data = '') { | ||
return shared.ReflectApply(DocumentProtoCreateComment, doc, [data]); | ||
function DocumentCreateComment(doc) { | ||
let data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; | ||
return shared.ReflectApply(DocumentProtoCreateComment, doc, [data]); | ||
} | ||
function DocumentCreateElement(doc, ...args) { | ||
return shared.ReflectApply(DocumentProtoCreateElement, doc, args); | ||
function DocumentCreateElement(doc) { | ||
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
args[_key - 1] = arguments[_key]; | ||
} | ||
return shared.ReflectApply(DocumentProtoCreateElement, doc, args); | ||
} | ||
function DocumentCreateElementNS(doc, ...args) { | ||
return shared.ReflectApply(DocumentProtoCreateElementNS, doc, args); | ||
function DocumentCreateElementNS(doc) { | ||
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { | ||
args[_key2 - 1] = arguments[_key2]; | ||
} | ||
return shared.ReflectApply(DocumentProtoCreateElementNS, doc, args); | ||
} | ||
function DocumentGetElementById(doc, id) { | ||
return shared.ReflectApply(DocumentProtoGetElementById, doc, [id]); | ||
return shared.ReflectApply(DocumentProtoGetElementById, doc, [id]); | ||
} | ||
function DocumentHeadGetter(doc) { | ||
return shared.ReflectApply(DocumentProtoHeadGetter, doc, shared.emptyArray); | ||
return shared.ReflectApply(DocumentProtoHeadGetter, doc, shared.emptyArray); | ||
} | ||
function nsCookieKey(key, ns) { | ||
return `${nsCookieRootKey(ns)}${key}`; | ||
return "".concat(nsCookieRootKey(ns)).concat(key); | ||
} | ||
function nsCookieRootKey(ns) { | ||
return `LSKey-${ns}$`; | ||
return "LSKey-".concat(ns, "$"); | ||
} | ||
const { attachShadow: ElementProtoAttachShadow, insertAdjacentHTML: ElementProtoInsertAdjacentHTML, setAttribute: ElementProtoSetAttribute, setAttributeNS: ElementProtoSetAttributeNS, setAttributeNode: ElementProtoSetAttributeNode, } = Element.prototype; | ||
const { closest: ElementProtoClosest, getAttributeNode: ElementProtoGetAttributeNode, getAttributeNodeNS: ElementProtoGetAttributeNodeNS, querySelector: ElementProtoQuerySelector, removeAttributeNode: ElementProtoRemoveAttributeNode, setAttributeNodeNS: ElementProtoSetAttributeNodeNS, } = Element.prototype; | ||
const { get: ElementProtoInnerHTMLGetter, set: ElementProtoInnerHTMLSetter, } = shared.ReflectGetOwnPropertyDescriptor(Element.prototype, 'innerHTML'); | ||
const { get: ElementProtoOuterHTMLGetter, set: ElementProtoOuterHTMLSetter, } = shared.ReflectGetOwnPropertyDescriptor(Element.prototype, 'outerHTML'); | ||
const { | ||
attachShadow: ElementProtoAttachShadow, | ||
insertAdjacentHTML: ElementProtoInsertAdjacentHTML, | ||
setAttribute: ElementProtoSetAttribute, | ||
setAttributeNS: ElementProtoSetAttributeNS, | ||
setAttributeNode: ElementProtoSetAttributeNode | ||
} = Element.prototype; | ||
const { | ||
closest: ElementProtoClosest, | ||
getAttributeNode: ElementProtoGetAttributeNode, | ||
getAttributeNodeNS: ElementProtoGetAttributeNodeNS, | ||
querySelector: ElementProtoQuerySelector, | ||
removeAttributeNode: ElementProtoRemoveAttributeNode, | ||
setAttributeNodeNS: ElementProtoSetAttributeNodeNS | ||
} = Element.prototype; | ||
const { | ||
get: ElementProtoInnerHTMLGetter, | ||
set: ElementProtoInnerHTMLSetter | ||
} = shared.ReflectGetOwnPropertyDescriptor(Element.prototype, 'innerHTML'); | ||
const { | ||
get: ElementProtoOuterHTMLGetter, | ||
set: ElementProtoOuterHTMLSetter | ||
} = shared.ReflectGetOwnPropertyDescriptor(Element.prototype, 'outerHTML'); | ||
const ElementProtoAttributesGetter = shared.ObjectLookupOwnGetter(Element.prototype, 'attributes'); | ||
function ElementClosest(el, selectors) { | ||
return shared.ReflectApply(ElementProtoClosest, el, [selectors]); | ||
return shared.ReflectApply(ElementProtoClosest, el, [selectors]); | ||
} | ||
function ElementInnerHTMLGetter(el) { | ||
return shared.ReflectApply(ElementProtoInnerHTMLGetter, el, shared.emptyArray); | ||
return shared.ReflectApply(ElementProtoInnerHTMLGetter, el, shared.emptyArray); | ||
} | ||
function ElementInnerHTMLSetter(el, html) { | ||
shared.ReflectApply(ElementProtoInnerHTMLSetter, el, [html]); | ||
shared.ReflectApply(ElementProtoInnerHTMLSetter, el, [html]); | ||
} | ||
function ElementOuterHTMLGetter(el) { | ||
return shared.ReflectApply(ElementProtoOuterHTMLGetter, el, shared.emptyArray); | ||
return shared.ReflectApply(ElementProtoOuterHTMLGetter, el, shared.emptyArray); | ||
} | ||
function ElementOuterHTMLSetter(el, html) { | ||
shared.ReflectApply(ElementProtoOuterHTMLSetter, el, [html]); | ||
shared.ReflectApply(ElementProtoOuterHTMLSetter, el, [html]); | ||
} | ||
function ElementQuerySelector(el, selectors) { | ||
return shared.ReflectApply(ElementProtoQuerySelector, el, [selectors]); | ||
return shared.ReflectApply(ElementProtoQuerySelector, el, [selectors]); | ||
} | ||
function ElementAttributesGetter(el) { | ||
return shared.ReflectApply(ElementProtoAttributesGetter, el, shared.emptyArray); | ||
return shared.ReflectApply(ElementProtoAttributesGetter, el, shared.emptyArray); | ||
} | ||
function ElementGetAttributeNode(el, attrName) { | ||
return shared.ReflectApply(ElementProtoGetAttributeNode, el, [attrName]); | ||
return shared.ReflectApply(ElementProtoGetAttributeNode, el, [attrName]); | ||
} | ||
function ElementGetAttributeNodeNS(el, namespace, nodeName) { | ||
return shared.ReflectApply(ElementProtoGetAttributeNodeNS, el, [namespace, nodeName]); | ||
return shared.ReflectApply(ElementProtoGetAttributeNodeNS, el, [namespace, nodeName]); | ||
} | ||
function ElementRemoveAttributeNode(el, attrNode) { | ||
return shared.ReflectApply(ElementProtoRemoveAttributeNode, el, [attrNode]); | ||
return shared.ReflectApply(ElementProtoRemoveAttributeNode, el, [attrNode]); | ||
} | ||
function ElementSetAttribute(el, name, value) { | ||
return shared.ReflectApply(ElementProtoSetAttribute, el, [name, value]); | ||
return shared.ReflectApply(ElementProtoSetAttribute, el, [name, value]); | ||
} | ||
function ElementSetAttributeNode(el, attr) { | ||
return shared.ReflectApply(ElementProtoSetAttributeNode, el, [attr]); | ||
return shared.ReflectApply(ElementProtoSetAttributeNode, el, [attr]); | ||
} | ||
function ElementSetAttributeNodeNS(el, attr) { | ||
return shared.ReflectApply(ElementProtoSetAttributeNodeNS, el, [attr]); | ||
return shared.ReflectApply(ElementProtoSetAttributeNodeNS, el, [attr]); | ||
} | ||
function ElementSetAttributeNS(el, namespace, name, value) { | ||
return shared.ReflectApply(ElementProtoSetAttributeNS, el, [namespace, name, value]); | ||
return shared.ReflectApply(ElementProtoSetAttributeNS, el, [namespace, name, value]); | ||
} | ||
const HTMLTemplateElementProtoContentGetter = shared.ObjectLookupOwnGetter(HTMLTemplateElement.prototype, 'content'); | ||
function HTMLTemplateElementContentGetter(template) { | ||
return shared.ReflectApply(HTMLTemplateElementProtoContentGetter, template, shared.emptyArray); | ||
return shared.ReflectApply(HTMLTemplateElementProtoContentGetter, template, shared.emptyArray); | ||
} | ||
const { appendChild: NodeProtoAppendChild, cloneNode: NodeProtoCloneNode, isEqualNode: NodeProtoIsEqualNode, } = Node.prototype; | ||
const { | ||
appendChild: NodeProtoAppendChild, | ||
cloneNode: NodeProtoCloneNode, | ||
isEqualNode: NodeProtoIsEqualNode | ||
} = Node.prototype; | ||
const NodeProtoChildNodesGetter = shared.ObjectLookupOwnGetter(Node.prototype, 'childNodes'); | ||
@@ -127,75 +204,100 @@ const NodeProtoFirstChildGetter = shared.ObjectLookupOwnGetter(Node.prototype, 'firstChild'); | ||
const NodeProtoTextContentSetter = shared.ObjectLookupOwnSetter(Node.prototype, 'textContent'); | ||
function NodeAppendChild(node, childNode) { | ||
return shared.ReflectApply(NodeProtoAppendChild, node, [childNode]); | ||
return shared.ReflectApply(NodeProtoAppendChild, node, [childNode]); | ||
} | ||
function NodeChildNodesGetter(node) { | ||
return shared.ReflectApply(NodeProtoChildNodesGetter, node, shared.emptyArray); | ||
return shared.ReflectApply(NodeProtoChildNodesGetter, node, shared.emptyArray); | ||
} | ||
function NodeClone(node, deep = false) { | ||
return shared.ReflectApply(NodeProtoCloneNode, node, [deep]); | ||
function NodeClone(node) { | ||
let deep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
return shared.ReflectApply(NodeProtoCloneNode, node, [deep]); | ||
} | ||
function NodeFirstChildGetter(node) { | ||
return shared.ReflectApply(NodeProtoFirstChildGetter, node, shared.emptyArray); | ||
return shared.ReflectApply(NodeProtoFirstChildGetter, node, shared.emptyArray); | ||
} | ||
function NodeIsEqualNode(node, otherNode) { | ||
return shared.ReflectApply(NodeProtoIsEqualNode, node, [otherNode]); | ||
return shared.ReflectApply(NodeProtoIsEqualNode, node, [otherNode]); | ||
} | ||
function NodeNameGetter(node) { | ||
// Normalize nodeName to upper case. | ||
// See https://johnresig.com/blog/nodename-case-sensitivity/. | ||
return shared.StringToUpperCase(shared.ReflectApply(NodeProtoNodeNameGetter, node, shared.emptyArray)); | ||
// Normalize nodeName to upper case. | ||
// See https://johnresig.com/blog/nodename-case-sensitivity/. | ||
return shared.StringToUpperCase(shared.ReflectApply(NodeProtoNodeNameGetter, node, shared.emptyArray)); | ||
} | ||
function NodeOwnerDocumentGetter(node) { | ||
return shared.ReflectApply(NodeProtoOwnerDocumentGetter, node, shared.emptyArray); | ||
return shared.ReflectApply(NodeProtoOwnerDocumentGetter, node, shared.emptyArray); | ||
} | ||
function NodeTextContentSetter(node, textContent) { | ||
shared.ReflectApply(NodeProtoTextContentSetter, node, [textContent]); | ||
shared.ReflectApply(NodeProtoTextContentSetter, node, [textContent]); | ||
} | ||
const { document } = window; | ||
const { | ||
document | ||
} = window; | ||
const leftTpl = DocumentCreateElement(document, 'template'); | ||
const rightTpl = DocumentCreateElement(document, 'template'); | ||
function deepIsEqualNode(leftRoot, rightRoot) { | ||
const leftRootNode = leftRoot instanceof HTMLTemplateElement | ||
? HTMLTemplateElementContentGetter(leftRoot) | ||
: leftRoot; | ||
const rightRootNode = rightRoot instanceof HTMLTemplateElement | ||
? HTMLTemplateElementContentGetter(rightRoot) | ||
: rightRoot; | ||
if (NodeIsEqualNode(leftRootNode, rightRootNode)) { | ||
const leftChildNodes = NodeChildNodesGetter(leftRootNode); | ||
const childCount = leftChildNodes.length; | ||
if (childCount > 0) { | ||
const rightChildNodes = NodeChildNodesGetter(rightRootNode); | ||
for (let i = 0; i < childCount; i += 1) { | ||
if (deepIsEqualNode(leftChildNodes[i], rightChildNodes[i]) === false) { | ||
return false; | ||
} | ||
} | ||
const leftRootNode = leftRoot instanceof HTMLTemplateElement ? HTMLTemplateElementContentGetter(leftRoot) : leftRoot; | ||
const rightRootNode = rightRoot instanceof HTMLTemplateElement ? HTMLTemplateElementContentGetter(rightRoot) : rightRoot; | ||
if (NodeIsEqualNode(leftRootNode, rightRootNode)) { | ||
const leftChildNodes = NodeChildNodesGetter(leftRootNode); | ||
const childCount = leftChildNodes.length; | ||
if (childCount > 0) { | ||
const rightChildNodes = NodeChildNodesGetter(rightRootNode); | ||
for (let i = 0; i < childCount; i += 1) { | ||
if (deepIsEqualNode(leftChildNodes[i], rightChildNodes[i]) === false) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
} | ||
return false; | ||
return true; | ||
} | ||
return false; | ||
} | ||
function isEqualDomString(leftString, rightString) { | ||
ElementInnerHTMLSetter(leftTpl, leftString); | ||
ElementInnerHTMLSetter(rightTpl, rightString); | ||
return deepIsEqualNode(leftTpl, rightTpl); | ||
ElementInnerHTMLSetter(leftTpl, leftString); | ||
ElementInnerHTMLSetter(rightTpl, rightString); | ||
return deepIsEqualNode(leftTpl, rightTpl); | ||
} | ||
function isSharedElement(element, doc = document) { | ||
return element === DocumentHeadGetter(doc) || element === DocumentBodyGetter(doc); | ||
function isSharedElement(element) { | ||
let doc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document; | ||
return element === DocumentHeadGetter(doc) || element === DocumentBodyGetter(doc); | ||
} | ||
const BlobProtoSizeGetter = shared.ObjectLookupOwnGetter(Blob.prototype, 'size'); | ||
const { slice: BlobProtoSlice } = Blob.prototype; | ||
const { | ||
slice: BlobProtoSlice | ||
} = Blob.prototype; | ||
const BlobProtoTypeGetter = shared.ObjectLookupOwnGetter(Blob.prototype, 'type'); | ||
const BlobCtor = Blob; | ||
function BlobSizeGetter(blob) { | ||
return shared.ReflectApply(BlobProtoSizeGetter, blob, shared.emptyArray); | ||
return shared.ReflectApply(BlobProtoSizeGetter, blob, shared.emptyArray); | ||
} | ||
function BlobSlice(blob, ...args) { | ||
return shared.ReflectApply(BlobProtoSlice, blob, args); | ||
function BlobSlice(blob) { | ||
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { | ||
args[_key3 - 1] = arguments[_key3]; | ||
} | ||
return shared.ReflectApply(BlobProtoSlice, blob, args); | ||
} | ||
function BlobTypeGetter(blob) { | ||
return shared.StringToLowerCase(shared.ReflectApply(BlobProtoTypeGetter, blob, shared.emptyArray)); | ||
return shared.StringToLowerCase(shared.ReflectApply(BlobProtoTypeGetter, blob, shared.emptyArray)); | ||
} | ||
@@ -208,47 +310,70 @@ | ||
const CookieStoreProtoSet = shared.ObjectLookupOwnValue(CookieStoreProto, 'set'); | ||
const { | ||
define: CustomElementRegistryProtoDefine, | ||
get: CustomElementRegistryProtoGet | ||
} = CustomElementRegistry.prototype; | ||
const { | ||
getElementById: DocumentFragmentProtoGetElementById | ||
} = DocumentFragment.prototype; | ||
const { define: CustomElementRegistryProtoDefine, get: CustomElementRegistryProtoGet, } = CustomElementRegistry.prototype; | ||
const { getElementById: DocumentFragmentProtoGetElementById } = DocumentFragment.prototype; | ||
function DocumentFragmentGetElementById(fragment, id) { | ||
return shared.ReflectApply(DocumentFragmentProtoGetElementById, fragment, [id]); | ||
return shared.ReflectApply(DocumentFragmentProtoGetElementById, fragment, [id]); | ||
} | ||
const DOMTokenListProtoValueGetter = shared.ObjectLookupOwnGetter(DOMTokenList.prototype, 'value'); | ||
function DOMTokenListValueGetter(tokenList) { | ||
return shared.ReflectApply(DOMTokenListProtoValueGetter, tokenList, shared.emptyArray); | ||
return shared.ReflectApply(DOMTokenListProtoValueGetter, tokenList, shared.emptyArray); | ||
} | ||
const { composedPath: EventProtoComposedPath } = Event.prototype; | ||
const { | ||
composedPath: EventProtoComposedPath | ||
} = Event.prototype; | ||
const EventProtoCurrentTargetGetter = shared.ObjectLookupOwnGetter(Event.prototype, 'currentTarget'); | ||
function EventCurrentTargetGetter(event) { | ||
return shared.ReflectApply(EventProtoCurrentTargetGetter, event, shared.emptyArray); | ||
return shared.ReflectApply(EventProtoCurrentTargetGetter, event, shared.emptyArray); | ||
} | ||
const { addEventListener: EventTargetProtoAddEventListener } = EventTarget.prototype; | ||
function EventTargetAddEventListener(target, ...args) { | ||
return shared.ReflectApply(EventTargetProtoAddEventListener, target, args); | ||
const { | ||
addEventListener: EventTargetProtoAddEventListener | ||
} = EventTarget.prototype; | ||
function EventTargetAddEventListener(target) { | ||
for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) { | ||
args[_key4 - 1] = arguments[_key4]; | ||
} | ||
return shared.ReflectApply(EventTargetProtoAddEventListener, target, args); | ||
} | ||
const HTMLAnchorElementProtoHostnameGetter = shared.ObjectLookupOwnGetter(HTMLAnchorElement.prototype, 'hostname'); | ||
const { get: HTMLAnchorElementProtoHrefGetter, set: HTMLAnchorElementProtoHrefSetter, } = shared.ReflectGetOwnPropertyDescriptor(HTMLAnchorElement.prototype, 'href'); | ||
const { | ||
get: HTMLAnchorElementProtoHrefGetter, | ||
set: HTMLAnchorElementProtoHrefSetter | ||
} = shared.ReflectGetOwnPropertyDescriptor(HTMLAnchorElement.prototype, 'href'); | ||
const HTMLAnchorElementProtoPathnameGetter = shared.ObjectLookupOwnGetter(HTMLAnchorElement.prototype, 'pathname'); | ||
const HTMLAnchorElementProtoProtocolGetter = shared.ObjectLookupOwnGetter(HTMLAnchorElement.prototype, 'protocol'); | ||
function HTMLAnchorElementHostnameGetter(anchor) { | ||
return shared.ReflectApply(HTMLAnchorElementProtoHostnameGetter, anchor, shared.emptyArray); | ||
return shared.ReflectApply(HTMLAnchorElementProtoHostnameGetter, anchor, shared.emptyArray); | ||
} | ||
function HTMLAnchorElementHrefGetter(anchor) { | ||
return shared.ReflectApply(HTMLAnchorElementProtoHrefGetter, anchor, shared.emptyArray); | ||
return shared.ReflectApply(HTMLAnchorElementProtoHrefGetter, anchor, shared.emptyArray); | ||
} | ||
function HTMLAnchorElementHrefSetter(anchor, href) { | ||
shared.ReflectApply(HTMLAnchorElementProtoHrefSetter, anchor, [href]); | ||
shared.ReflectApply(HTMLAnchorElementProtoHrefSetter, anchor, [href]); | ||
} | ||
function HTMLAnchorElementPathnameGetter(anchor) { | ||
return shared.ReflectApply(HTMLAnchorElementProtoPathnameGetter, anchor, shared.emptyArray); | ||
return shared.ReflectApply(HTMLAnchorElementProtoPathnameGetter, anchor, shared.emptyArray); | ||
} | ||
function HTMLAnchorElementProtocolGetter(anchor) { | ||
return shared.ReflectApply(HTMLAnchorElementProtoProtocolGetter, anchor, shared.emptyArray); | ||
} | ||
return shared.ReflectApply(HTMLAnchorElementProtoProtocolGetter, anchor, shared.emptyArray); | ||
} // The innerText and outerText setters may be undefined. | ||
// The innerText and outerText setters may be undefined. | ||
const HTMLElementProtoInnerTextSetter = shared.ObjectLookupOwnSetter(HTMLElement.prototype, 'innerText'); | ||
@@ -258,17 +383,16 @@ const HTMLElementProtoOuterTextSetter = shared.ObjectLookupOwnSetter(HTMLElement.prototype, 'outerText'); | ||
const HTMLElementProtoStyleGetter = shared.ObjectLookupOwnGetter(HTMLElement.prototype, 'style'); | ||
function HTMLElementDatasetGetter(el) { | ||
return shared.ReflectApply(HTMLElementProtoDatasetGetter, el, shared.emptyArray); | ||
return shared.ReflectApply(HTMLElementProtoDatasetGetter, el, shared.emptyArray); | ||
} | ||
const HTMLElementInnerTextSetter = HTMLElementProtoInnerTextSetter | ||
? function HTMLElementInnerTextSetter(el, text) { | ||
shared.ReflectApply(HTMLElementProtoInnerTextSetter, el, [text]); | ||
} | ||
: function HTMLElementInnerTextSetter(_el, _text) { }; | ||
const HTMLElementOuterTextSetter = HTMLElementProtoOuterTextSetter | ||
? function HTMLElementOuterTextSetter(el, text) { | ||
shared.ReflectApply(HTMLElementProtoOuterTextSetter, el, [text]); | ||
} | ||
: function HTMLElementOuterTextSetter(_el, _text) { }; | ||
const HTMLElementInnerTextSetter = HTMLElementProtoInnerTextSetter ? function HTMLElementInnerTextSetter(el, text) { | ||
shared.ReflectApply(HTMLElementProtoInnerTextSetter, el, [text]); | ||
} : function HTMLElementInnerTextSetter(_el, _text) {}; | ||
const HTMLElementOuterTextSetter = HTMLElementProtoOuterTextSetter ? function HTMLElementOuterTextSetter(el, text) { | ||
shared.ReflectApply(HTMLElementProtoOuterTextSetter, el, [text]); | ||
} : function HTMLElementOuterTextSetter(_el, _text) {}; | ||
function HTMLElementStyleGetter(el) { | ||
return shared.ReflectApply(HTMLElementProtoStyleGetter, el, shared.emptyArray); | ||
return shared.ReflectApply(HTMLElementProtoStyleGetter, el, shared.emptyArray); | ||
} | ||
@@ -278,7 +402,9 @@ | ||
const HTMLFrameElementProtoContentWindowGetter = shared.ObjectLookupOwnGetter(HTMLFrameElement.prototype, 'contentWindow'); | ||
function HTMLFrameElementContentDocumentGetter(frame) { | ||
return shared.ReflectApply(HTMLFrameElementProtoContentDocumentGetter, frame, shared.emptyArray); | ||
return shared.ReflectApply(HTMLFrameElementProtoContentDocumentGetter, frame, shared.emptyArray); | ||
} | ||
function HTMLFrameElementContentWindowGetter(frame) { | ||
return shared.ReflectApply(HTMLFrameElementProtoContentWindowGetter, frame, shared.emptyArray); | ||
return shared.ReflectApply(HTMLFrameElementProtoContentWindowGetter, frame, shared.emptyArray); | ||
} | ||
@@ -289,10 +415,13 @@ | ||
const HTMLIFrameElementProtoSrcSetter = shared.ObjectLookupOwnSetter(HTMLIFrameElement.prototype, 'src'); | ||
function HTMLIFrameElementContentDocumentGetter(iframe) { | ||
return shared.ReflectApply(HTMLIFrameElementProtoContentDocumentGetter, iframe, shared.emptyArray); | ||
return shared.ReflectApply(HTMLIFrameElementProtoContentDocumentGetter, iframe, shared.emptyArray); | ||
} | ||
function HTMLIFrameElementContentWindowGetter(iframe) { | ||
return shared.ReflectApply(HTMLIFrameElementProtoContentWindowGetter, iframe, shared.emptyArray); | ||
return shared.ReflectApply(HTMLIFrameElementProtoContentWindowGetter, iframe, shared.emptyArray); | ||
} | ||
function HTMLIFrameElementSrcSetter(iframe, src) { | ||
shared.ReflectApply(HTMLIFrameElementProtoSrcSetter, iframe, [src]); | ||
shared.ReflectApply(HTMLIFrameElementProtoSrcSetter, iframe, [src]); | ||
} | ||
@@ -302,7 +431,9 @@ | ||
const HTMLLinkElementProtoRelListSetter = shared.ObjectLookupOwnSetter(HTMLLinkElement.prototype, 'relList'); | ||
function HTMLLinkElementRelSetter(link, rel) { | ||
shared.ReflectApply(HTMLLinkElementProtoRelSetter, link, [rel]); | ||
shared.ReflectApply(HTMLLinkElementProtoRelSetter, link, [rel]); | ||
} | ||
function HTMLLinkElementRelListSetter(link, relList) { | ||
shared.ReflectApply(HTMLLinkElementProtoRelListSetter, link, [relList]); | ||
shared.ReflectApply(HTMLLinkElementProtoRelListSetter, link, [relList]); | ||
} | ||
@@ -312,44 +443,58 @@ | ||
const HTMLObjectElementProtoContentWindowGetter = shared.ObjectLookupOwnGetter(HTMLObjectElement.prototype, 'contentWindow'); | ||
function HTMLObjectElementContentDocumentGetter(objectEl) { | ||
return shared.ReflectApply(HTMLObjectProtoContentDocumentGetter, objectEl, shared.emptyArray); | ||
} | ||
// contentWindow is not supported on object elements in iOS < 13. | ||
return shared.ReflectApply(HTMLObjectProtoContentDocumentGetter, objectEl, shared.emptyArray); | ||
} // contentWindow is not supported on object elements in iOS < 13. | ||
// https://caniuse.com/mdn-api_htmlobjectelement_contentwindow | ||
const HTMLObjectElementContentWindowGetter = HTMLObjectElementProtoContentWindowGetter | ||
? function HTMLObjectElementContentWindowGetter(objectEl) { | ||
return shared.ReflectApply(HTMLObjectElementProtoContentWindowGetter, objectEl, shared.emptyArray); | ||
} | ||
: function HTMLObjectElementContentWindowGetter(_objectEl) { | ||
return null; | ||
}; | ||
const { get: HTMLScriptElementProtoSrcGetter, set: HTMLScriptElementProtoSrcSetter, } = shared.ReflectGetOwnPropertyDescriptor(HTMLScriptElement.prototype, 'src'); | ||
const HTMLObjectElementContentWindowGetter = HTMLObjectElementProtoContentWindowGetter ? function HTMLObjectElementContentWindowGetter(objectEl) { | ||
return shared.ReflectApply(HTMLObjectElementProtoContentWindowGetter, objectEl, shared.emptyArray); | ||
} : function HTMLObjectElementContentWindowGetter(_objectEl) { | ||
return null; | ||
}; | ||
const { | ||
get: HTMLScriptElementProtoSrcGetter, | ||
set: HTMLScriptElementProtoSrcSetter | ||
} = shared.ReflectGetOwnPropertyDescriptor(HTMLScriptElement.prototype, 'src'); | ||
const MessageEventProtoSourceGetter = shared.ObjectLookupOwnGetter(MessageEvent.prototype, 'source'); | ||
function MessageEventSourceGetter(messageEvent) { | ||
return shared.ReflectApply(MessageEventProtoSourceGetter, messageEvent, shared.emptyArray); | ||
return shared.ReflectApply(MessageEventProtoSourceGetter, messageEvent, shared.emptyArray); | ||
} | ||
const { setNamedItem: NamedNodeMapProtoSetNamedItem } = NamedNodeMap.prototype; | ||
const { | ||
setNamedItem: NamedNodeMapProtoSetNamedItem | ||
} = NamedNodeMap.prototype; | ||
const { | ||
createContextualFragment: RangeProtoCreateContextualFragment | ||
} = Range.prototype; | ||
const RequestProtoURLGetter = shared.ObjectLookupOwnGetter(Request.prototype, 'url'); | ||
const { createContextualFragment: RangeProtoCreateContextualFragment } = Range.prototype; | ||
const RequestProtoURLGetter = shared.ObjectLookupOwnGetter(Request.prototype, 'url'); | ||
function RequestURLGetter(request) { | ||
return shared.ReflectApply(RequestProtoURLGetter, request, shared.emptyArray); | ||
return shared.ReflectApply(RequestProtoURLGetter, request, shared.emptyArray); | ||
} | ||
const { key: StorageProtoKey, getItem: StorageProtoGetItem, removeItem: StorageProtoRemoveItem, setItem: StorageProtoSetItem, } = Storage.prototype; | ||
const { | ||
key: StorageProtoKey, | ||
getItem: StorageProtoGetItem, | ||
removeItem: StorageProtoRemoveItem, | ||
setItem: StorageProtoSetItem | ||
} = Storage.prototype; | ||
const SVGElementProtoDatasetGetter = shared.ObjectLookupOwnGetter(SVGElement.prototype, 'dataset'); | ||
const SVGElementProtoDatasetGetter = shared.ObjectLookupOwnGetter(SVGElement.prototype, 'dataset'); | ||
function SVGElementDatasetGetter(svg) { | ||
return shared.ReflectApply(SVGElementProtoDatasetGetter, svg, shared.emptyArray); | ||
return shared.ReflectApply(SVGElementProtoDatasetGetter, svg, shared.emptyArray); | ||
} | ||
const { createObjectURL: URLCreateObjectURL, revokeObjectURL: URLRevokeObjectURL } = URL; | ||
const { | ||
createObjectURL: URLCreateObjectURL, | ||
revokeObjectURL: URLRevokeObjectURL | ||
} = URL; | ||
const ALLOW_LIST_PATCHED = ['opener', 'parent']; | ||
const ALLOW_LIST_RAW = ['close', 'closed', 'focus', 'postMessage']; | ||
const DEFAULT_OVERWRITTEN_VALUE = {}; | ||
const { clearInterval: WindowStaticClearInterval } = window; | ||
const { | ||
clearInterval: WindowStaticClearInterval | ||
} = window; | ||
const WindowStaticLengthGetter = shared.ObjectLookupOwnGetter(window, 'length'); | ||
@@ -360,113 +505,155 @@ const WindowStaticOpenerGetter = shared.ObjectLookupOwnGetter(window, 'opener'); | ||
const patchedWindowMap = new shared.WeakMapCtor(); | ||
function createPatchedWindow(rawWindow) { | ||
const patchedWindow = {}; | ||
for (let i = 0, len = ALLOW_LIST_RAW.length; i < len; i += 1) { | ||
const key = ALLOW_LIST_RAW[i]; | ||
const originalDescriptor = shared.ReflectGetOwnPropertyDescriptor(rawWindow, key); | ||
if (originalDescriptor) { | ||
shared.ReflectSetPrototypeOf(originalDescriptor, null); | ||
const { value: originalValue } = originalDescriptor; | ||
if (typeof originalValue === 'function') { | ||
const bound = shared.FunctionBind(originalValue, rawWindow); | ||
shared.ReflectDefineProperty(bound, 'name', shared.ReflectGetOwnPropertyDescriptor(originalValue, 'name')); | ||
originalDescriptor.value = bound; | ||
} | ||
else { | ||
const { get: originalDescriptorGetter, set: originalDescriptorSetter, } = originalDescriptor; | ||
let overwrittenValue = DEFAULT_OVERWRITTEN_VALUE; | ||
if (typeof originalDescriptorGetter === 'function') { | ||
originalDescriptor.get = function get() { | ||
return overwrittenValue === DEFAULT_OVERWRITTEN_VALUE | ||
? shared.ReflectApply(originalDescriptorGetter, rawWindow, shared.emptyArray) | ||
: overwrittenValue; | ||
}; | ||
} | ||
if (typeof originalDescriptorSetter === 'function') { | ||
originalDescriptor.set = function set(value) { | ||
overwrittenValue = value; | ||
}; | ||
} | ||
} | ||
shared.ReflectDefineProperty(patchedWindow, key, originalDescriptor); | ||
const patchedWindow = {}; | ||
for (let i = 0, len = ALLOW_LIST_RAW.length; i < len; i += 1) { | ||
const key = ALLOW_LIST_RAW[i]; | ||
const originalDescriptor = shared.ReflectGetOwnPropertyDescriptor(rawWindow, key); | ||
if (originalDescriptor) { | ||
shared.ReflectSetPrototypeOf(originalDescriptor, null); | ||
const { | ||
value: originalValue | ||
} = originalDescriptor; | ||
if (typeof originalValue === 'function') { | ||
const bound = shared.FunctionBind(originalValue, rawWindow); | ||
shared.ReflectDefineProperty(bound, 'name', shared.ReflectGetOwnPropertyDescriptor(originalValue, 'name')); | ||
originalDescriptor.value = bound; | ||
} else { | ||
const { | ||
get: originalDescriptorGetter, | ||
set: originalDescriptorSetter | ||
} = originalDescriptor; | ||
let overwrittenValue = DEFAULT_OVERWRITTEN_VALUE; | ||
if (typeof originalDescriptorGetter === 'function') { | ||
originalDescriptor.get = function get() { | ||
return overwrittenValue === DEFAULT_OVERWRITTEN_VALUE ? shared.ReflectApply(originalDescriptorGetter, rawWindow, shared.emptyArray) : overwrittenValue; | ||
}; | ||
} | ||
} | ||
for (let i = 0, len = ALLOW_LIST_PATCHED.length; i < len; i += 1) { | ||
const key = ALLOW_LIST_PATCHED[i]; | ||
const originalDescriptor = shared.ReflectGetOwnPropertyDescriptor(rawWindow, key); | ||
if (originalDescriptor) { | ||
shared.ReflectSetPrototypeOf(originalDescriptor, null); | ||
const { get: originalDescriptorGetter, set: originalDescriptorSetter, } = originalDescriptor; | ||
let overwrittenValue = DEFAULT_OVERWRITTEN_VALUE; | ||
if (typeof originalDescriptorGetter === 'function') { | ||
originalDescriptor.get = function get() { | ||
if (overwrittenValue === DEFAULT_OVERWRITTEN_VALUE) { | ||
return getPatchedWindow(shared.ReflectApply(originalDescriptorGetter, rawWindow, shared.emptyArray)); | ||
} | ||
return overwrittenValue; | ||
}; | ||
} | ||
if (typeof originalDescriptorSetter === 'function') { | ||
originalDescriptor.set = function set(value) { | ||
overwrittenValue = value; | ||
}; | ||
} | ||
shared.ReflectDefineProperty(patchedWindow, key, originalDescriptor); | ||
if (typeof originalDescriptorSetter === 'function') { | ||
originalDescriptor.set = function set(value) { | ||
overwrittenValue = value; | ||
}; | ||
} | ||
} | ||
shared.ReflectDefineProperty(patchedWindow, key, originalDescriptor); | ||
} | ||
return patchedWindow; | ||
} | ||
// setInterval and clearInterval are part of WindowOrGlobalScope mixin, they are | ||
} | ||
for (let i = 0, len = ALLOW_LIST_PATCHED.length; i < len; i += 1) { | ||
const key = ALLOW_LIST_PATCHED[i]; | ||
const originalDescriptor = shared.ReflectGetOwnPropertyDescriptor(rawWindow, key); | ||
if (originalDescriptor) { | ||
shared.ReflectSetPrototypeOf(originalDescriptor, null); | ||
const { | ||
get: originalDescriptorGetter, | ||
set: originalDescriptorSetter | ||
} = originalDescriptor; | ||
let overwrittenValue = DEFAULT_OVERWRITTEN_VALUE; | ||
if (typeof originalDescriptorGetter === 'function') { | ||
originalDescriptor.get = function get() { | ||
if (overwrittenValue === DEFAULT_OVERWRITTEN_VALUE) { | ||
return getPatchedWindow(shared.ReflectApply(originalDescriptorGetter, rawWindow, shared.emptyArray)); | ||
} | ||
return overwrittenValue; | ||
}; | ||
} | ||
if (typeof originalDescriptorSetter === 'function') { | ||
originalDescriptor.set = function set(value) { | ||
overwrittenValue = value; | ||
}; | ||
} | ||
shared.ReflectDefineProperty(patchedWindow, key, originalDescriptor); | ||
} | ||
} | ||
return patchedWindow; | ||
} // setInterval and clearInterval are part of WindowOrGlobalScope mixin, they are | ||
// not on Window.prototype. See https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope. | ||
const { decodeURIComponent: WindowStaticDecodeURIComponent, encodeURIComponent: WindowStaticEncodeURIComponent, fetch: WindowStaticFetch, open: WindowStaticOpen, setInterval: WindowStaticSetInterval, setTimeout: WindowStaticSetTimeout, } = window; | ||
const { | ||
decodeURIComponent: WindowStaticDecodeURIComponent, | ||
encodeURIComponent: WindowStaticEncodeURIComponent, | ||
fetch: WindowStaticFetch, | ||
open: WindowStaticOpen, | ||
setInterval: WindowStaticSetInterval, | ||
setTimeout: WindowStaticSetTimeout | ||
} = window; | ||
function getPatchedWindow(win) { | ||
let patchedContentWindow = null; | ||
if (win !== null) { | ||
patchedContentWindow = shared.WeakMapGet(patchedWindowMap, win); | ||
if (!patchedContentWindow) { | ||
patchedContentWindow = createPatchedWindow(win); | ||
shared.WeakMapSet(patchedWindowMap, win, patchedContentWindow); | ||
} | ||
let patchedContentWindow = null; | ||
if (win !== null) { | ||
patchedContentWindow = shared.WeakMapGet(patchedWindowMap, win); | ||
if (!patchedContentWindow) { | ||
patchedContentWindow = createPatchedWindow(win); | ||
shared.WeakMapSet(patchedWindowMap, win, patchedContentWindow); | ||
} | ||
return patchedContentWindow; | ||
} | ||
return patchedContentWindow; | ||
} | ||
function isWindowLike(value) { | ||
// fast check to narrow down when to do the slow check for window objects | ||
// window.top is unforgeable, this means this check should be safe from | ||
// user-intervention to try to bypass this check. | ||
return shared.ObjectHasOwnProperty(value, 'top'); | ||
// fast check to narrow down when to do the slow check for window objects | ||
// window.top is unforgeable, this means this check should be safe from | ||
// user-intervention to try to bypass this check. | ||
return shared.ObjectHasOwnProperty(value, 'top'); | ||
} | ||
function isWindow(value) { | ||
// slower check that must certainly detect a window object | ||
try { | ||
// window.self getter only works for a window object, otherwise it throws, | ||
// additionally, this works fine for a detached window as well, which is | ||
// important since it will guarantee that this check works also for iframes | ||
// that are disconnected, and could be connected later on, that should not | ||
// bypass this check. This check is is also equivalent to window.frames, and | ||
// here is the very simple spec for this getter: | ||
// https://html.spec.whatwg.org/multipage/window-object.html#dom-self | ||
WindowSelfGetter(value); | ||
return true; | ||
// eslint-disable-next-line no-empty | ||
} | ||
catch { } | ||
return false; | ||
// slower check that must certainly detect a window object | ||
try { | ||
// window.self getter only works for a window object, otherwise it throws, | ||
// additionally, this works fine for a detached window as well, which is | ||
// important since it will guarantee that this check works also for iframes | ||
// that are disconnected, and could be connected later on, that should not | ||
// bypass this check. This check is is also equivalent to window.frames, and | ||
// here is the very simple spec for this getter: | ||
// https://html.spec.whatwg.org/multipage/window-object.html#dom-self | ||
WindowSelfGetter(value); | ||
return true; // eslint-disable-next-line no-empty | ||
} catch (_unused) {} | ||
return false; | ||
} | ||
function WindowClearInterval(win, intervalID) { | ||
return shared.ReflectApply(WindowStaticClearInterval, win, [intervalID]); | ||
return shared.ReflectApply(WindowStaticClearInterval, win, [intervalID]); | ||
} | ||
function WindowLengthGetter(win) { | ||
return shared.ReflectApply(WindowStaticLengthGetter, win, shared.emptyArray); | ||
return shared.ReflectApply(WindowStaticLengthGetter, win, shared.emptyArray); | ||
} | ||
function WindowOpenerGetter(win) { | ||
return shared.ReflectApply(WindowStaticOpenerGetter, win, shared.emptyArray); | ||
return shared.ReflectApply(WindowStaticOpenerGetter, win, shared.emptyArray); | ||
} | ||
function WindowParentGetter(win) { | ||
return shared.ReflectApply(WindowStaticParentGetter, win, shared.emptyArray); | ||
return shared.ReflectApply(WindowStaticParentGetter, win, shared.emptyArray); | ||
} | ||
function WindowSelfGetter(win) { | ||
return shared.ReflectApply(WindowStaticSelfGetter, win, shared.emptyArray); | ||
return shared.ReflectApply(WindowStaticSelfGetter, win, shared.emptyArray); | ||
} | ||
function WindowSetInterval(win, ...args) { | ||
return shared.ReflectApply(WindowStaticSetInterval, win, args); | ||
function WindowSetInterval(win) { | ||
for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) { | ||
args[_key5 - 1] = arguments[_key5]; | ||
} | ||
return shared.ReflectApply(WindowStaticSetInterval, win, args); | ||
} | ||
@@ -476,21 +663,31 @@ | ||
const XhrProto = XhrCtor.prototype; | ||
const { send: XhrProtoSend } = XhrProto; | ||
const { | ||
send: XhrProtoSend | ||
} = XhrProto; | ||
const XhrProtoResponseTextGetter = shared.ObjectLookupOwnGetter(XhrProto, 'responseText'); | ||
const XhrProtoStatusGetter = shared.ObjectLookupOwnGetter(XhrProto, 'status'); | ||
const XhrProtoWithCredentialsSetter = shared.ObjectLookupOwnSetter(XhrProto, 'withCredentials'); | ||
const { open: XhrProtoOpen } = XhrProto; | ||
function XhrOpen(xhr, requestMethod, url, async = true) { | ||
return shared.ReflectApply(XhrProtoOpen, xhr, [requestMethod, url, async]); | ||
const { | ||
open: XhrProtoOpen | ||
} = XhrProto; | ||
function XhrOpen(xhr, requestMethod, url) { | ||
let async = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; | ||
return shared.ReflectApply(XhrProtoOpen, xhr, [requestMethod, url, async]); | ||
} | ||
function XhrResponseTextGetter(xhr) { | ||
return shared.ReflectApply(XhrProtoResponseTextGetter, xhr, shared.emptyArray); | ||
return shared.ReflectApply(XhrProtoResponseTextGetter, xhr, shared.emptyArray); | ||
} | ||
function XhrSend(xhr) { | ||
return shared.ReflectApply(XhrProtoSend, xhr, shared.emptyArray); | ||
return shared.ReflectApply(XhrProtoSend, xhr, shared.emptyArray); | ||
} | ||
function XhrStatusGetter(xhr) { | ||
return shared.ReflectApply(XhrProtoStatusGetter, xhr, shared.emptyArray); | ||
return shared.ReflectApply(XhrProtoStatusGetter, xhr, shared.emptyArray); | ||
} | ||
function XhrWithCredentialsSetter(xhr, bool) { | ||
shared.ReflectApply(XhrProtoWithCredentialsSetter, xhr, [bool]); | ||
shared.ReflectApply(XhrProtoWithCredentialsSetter, xhr, [bool]); | ||
} | ||
@@ -612,2 +809,2 @@ | ||
exports.nsCookieRootKey = nsCookieRootKey; | ||
/*! version: 0.14.4 */ | ||
/*! version: 0.14.5 */ |
@@ -5,113 +5,187 @@ /*! | ||
import { ObjectLookupOwnGetter, ReflectGetOwnPropertyDescriptor, ReflectApply, emptyArray, ObjectLookupOwnSetter, StringToUpperCase, StringToLowerCase, ObjectLookupOwnValue, WeakMapCtor, WeakMapGet, WeakMapSet, ObjectHasOwnProperty, ReflectSetPrototypeOf, FunctionBind, ReflectDefineProperty } from '@locker/shared'; | ||
const AttrProtoNameGetter = ObjectLookupOwnGetter(Attr.prototype, 'name'); | ||
const AttrProtoNamespaceURIGetter = ObjectLookupOwnGetter(Attr.prototype, 'namespaceURI'); | ||
const AttrProtoOwnerElementGetter = ObjectLookupOwnGetter(Attr.prototype, 'ownerElement'); | ||
const { get: AttrProtoValueGetter, set: AttrProtoValueSetter } = ReflectGetOwnPropertyDescriptor(Attr.prototype, 'value'); | ||
const { | ||
get: AttrProtoValueGetter, | ||
set: AttrProtoValueSetter | ||
} = ReflectGetOwnPropertyDescriptor(Attr.prototype, 'value'); | ||
function AttrNameGetter(attr) { | ||
return ReflectApply(AttrProtoNameGetter, attr, emptyArray); | ||
return ReflectApply(AttrProtoNameGetter, attr, emptyArray); | ||
} | ||
function AttrNamespaceURIGetter(attr) { | ||
return ReflectApply(AttrProtoNamespaceURIGetter, attr, emptyArray); | ||
return ReflectApply(AttrProtoNamespaceURIGetter, attr, emptyArray); | ||
} | ||
function AttrOwnerElementGetter(attr) { | ||
return ReflectApply(AttrProtoOwnerElementGetter, attr, emptyArray); | ||
return ReflectApply(AttrProtoOwnerElementGetter, attr, emptyArray); | ||
} | ||
function AttrValueGetter(attr) { | ||
return ReflectApply(AttrProtoValueGetter, attr, emptyArray); | ||
return ReflectApply(AttrProtoValueGetter, attr, emptyArray); | ||
} | ||
function AttrValueSetter(attr, value) { | ||
ReflectApply(AttrProtoValueSetter, attr, [value]); | ||
ReflectApply(AttrProtoValueSetter, attr, [value]); | ||
} | ||
const { get: DocumentProtoCookieGetter, set: DocumentProtoCookieSetter, } = ReflectGetOwnPropertyDescriptor(Document.prototype, 'cookie'); | ||
const { createComment: DocumentProtoCreateComment, createElement: DocumentProtoCreateElement, createElementNS: DocumentProtoCreateElementNS, getElementById: DocumentProtoGetElementById, } = Document.prototype; | ||
const { | ||
get: DocumentProtoCookieGetter, | ||
set: DocumentProtoCookieSetter | ||
} = ReflectGetOwnPropertyDescriptor(Document.prototype, 'cookie'); | ||
const { | ||
createComment: DocumentProtoCreateComment, | ||
createElement: DocumentProtoCreateElement, | ||
createElementNS: DocumentProtoCreateElementNS, | ||
getElementById: DocumentProtoGetElementById | ||
} = Document.prototype; | ||
const DocumentProtoBodyGetter = ObjectLookupOwnGetter(Document.prototype, 'body'); | ||
const DocumentProtoHeadGetter = ObjectLookupOwnGetter(Document.prototype, 'head'); | ||
const { execCommand: DocumentProtoExecCommand } = Document.prototype; | ||
const { | ||
execCommand: DocumentProtoExecCommand | ||
} = Document.prototype; | ||
function DocumentBodyGetter(doc) { | ||
return ReflectApply(DocumentProtoBodyGetter, doc, emptyArray); | ||
return ReflectApply(DocumentProtoBodyGetter, doc, emptyArray); | ||
} | ||
function DocumentCookieGetter(doc) { | ||
return ReflectApply(DocumentProtoCookieGetter, doc, emptyArray); | ||
return ReflectApply(DocumentProtoCookieGetter, doc, emptyArray); | ||
} | ||
function DocumentCookieSetter(doc, newCookie) { | ||
ReflectApply(DocumentProtoCookieSetter, doc, [newCookie]); | ||
ReflectApply(DocumentProtoCookieSetter, doc, [newCookie]); | ||
} | ||
function DocumentCreateComment(doc, data = '') { | ||
return ReflectApply(DocumentProtoCreateComment, doc, [data]); | ||
function DocumentCreateComment(doc) { | ||
let data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; | ||
return ReflectApply(DocumentProtoCreateComment, doc, [data]); | ||
} | ||
function DocumentCreateElement(doc, ...args) { | ||
return ReflectApply(DocumentProtoCreateElement, doc, args); | ||
function DocumentCreateElement(doc) { | ||
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
args[_key - 1] = arguments[_key]; | ||
} | ||
return ReflectApply(DocumentProtoCreateElement, doc, args); | ||
} | ||
function DocumentCreateElementNS(doc, ...args) { | ||
return ReflectApply(DocumentProtoCreateElementNS, doc, args); | ||
function DocumentCreateElementNS(doc) { | ||
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { | ||
args[_key2 - 1] = arguments[_key2]; | ||
} | ||
return ReflectApply(DocumentProtoCreateElementNS, doc, args); | ||
} | ||
function DocumentGetElementById(doc, id) { | ||
return ReflectApply(DocumentProtoGetElementById, doc, [id]); | ||
return ReflectApply(DocumentProtoGetElementById, doc, [id]); | ||
} | ||
function DocumentHeadGetter(doc) { | ||
return ReflectApply(DocumentProtoHeadGetter, doc, emptyArray); | ||
return ReflectApply(DocumentProtoHeadGetter, doc, emptyArray); | ||
} | ||
function nsCookieKey(key, ns) { | ||
return `${nsCookieRootKey(ns)}${key}`; | ||
return "".concat(nsCookieRootKey(ns)).concat(key); | ||
} | ||
function nsCookieRootKey(ns) { | ||
return `LSKey-${ns}$`; | ||
return "LSKey-".concat(ns, "$"); | ||
} | ||
const { attachShadow: ElementProtoAttachShadow, insertAdjacentHTML: ElementProtoInsertAdjacentHTML, setAttribute: ElementProtoSetAttribute, setAttributeNS: ElementProtoSetAttributeNS, setAttributeNode: ElementProtoSetAttributeNode, } = Element.prototype; | ||
const { closest: ElementProtoClosest, getAttributeNode: ElementProtoGetAttributeNode, getAttributeNodeNS: ElementProtoGetAttributeNodeNS, querySelector: ElementProtoQuerySelector, removeAttributeNode: ElementProtoRemoveAttributeNode, setAttributeNodeNS: ElementProtoSetAttributeNodeNS, } = Element.prototype; | ||
const { get: ElementProtoInnerHTMLGetter, set: ElementProtoInnerHTMLSetter, } = ReflectGetOwnPropertyDescriptor(Element.prototype, 'innerHTML'); | ||
const { get: ElementProtoOuterHTMLGetter, set: ElementProtoOuterHTMLSetter, } = ReflectGetOwnPropertyDescriptor(Element.prototype, 'outerHTML'); | ||
const { | ||
attachShadow: ElementProtoAttachShadow, | ||
insertAdjacentHTML: ElementProtoInsertAdjacentHTML, | ||
setAttribute: ElementProtoSetAttribute, | ||
setAttributeNS: ElementProtoSetAttributeNS, | ||
setAttributeNode: ElementProtoSetAttributeNode | ||
} = Element.prototype; | ||
const { | ||
closest: ElementProtoClosest, | ||
getAttributeNode: ElementProtoGetAttributeNode, | ||
getAttributeNodeNS: ElementProtoGetAttributeNodeNS, | ||
querySelector: ElementProtoQuerySelector, | ||
removeAttributeNode: ElementProtoRemoveAttributeNode, | ||
setAttributeNodeNS: ElementProtoSetAttributeNodeNS | ||
} = Element.prototype; | ||
const { | ||
get: ElementProtoInnerHTMLGetter, | ||
set: ElementProtoInnerHTMLSetter | ||
} = ReflectGetOwnPropertyDescriptor(Element.prototype, 'innerHTML'); | ||
const { | ||
get: ElementProtoOuterHTMLGetter, | ||
set: ElementProtoOuterHTMLSetter | ||
} = ReflectGetOwnPropertyDescriptor(Element.prototype, 'outerHTML'); | ||
const ElementProtoAttributesGetter = ObjectLookupOwnGetter(Element.prototype, 'attributes'); | ||
function ElementClosest(el, selectors) { | ||
return ReflectApply(ElementProtoClosest, el, [selectors]); | ||
return ReflectApply(ElementProtoClosest, el, [selectors]); | ||
} | ||
function ElementInnerHTMLGetter(el) { | ||
return ReflectApply(ElementProtoInnerHTMLGetter, el, emptyArray); | ||
return ReflectApply(ElementProtoInnerHTMLGetter, el, emptyArray); | ||
} | ||
function ElementInnerHTMLSetter(el, html) { | ||
ReflectApply(ElementProtoInnerHTMLSetter, el, [html]); | ||
ReflectApply(ElementProtoInnerHTMLSetter, el, [html]); | ||
} | ||
function ElementOuterHTMLGetter(el) { | ||
return ReflectApply(ElementProtoOuterHTMLGetter, el, emptyArray); | ||
return ReflectApply(ElementProtoOuterHTMLGetter, el, emptyArray); | ||
} | ||
function ElementOuterHTMLSetter(el, html) { | ||
ReflectApply(ElementProtoOuterHTMLSetter, el, [html]); | ||
ReflectApply(ElementProtoOuterHTMLSetter, el, [html]); | ||
} | ||
function ElementQuerySelector(el, selectors) { | ||
return ReflectApply(ElementProtoQuerySelector, el, [selectors]); | ||
return ReflectApply(ElementProtoQuerySelector, el, [selectors]); | ||
} | ||
function ElementAttributesGetter(el) { | ||
return ReflectApply(ElementProtoAttributesGetter, el, emptyArray); | ||
return ReflectApply(ElementProtoAttributesGetter, el, emptyArray); | ||
} | ||
function ElementGetAttributeNode(el, attrName) { | ||
return ReflectApply(ElementProtoGetAttributeNode, el, [attrName]); | ||
return ReflectApply(ElementProtoGetAttributeNode, el, [attrName]); | ||
} | ||
function ElementGetAttributeNodeNS(el, namespace, nodeName) { | ||
return ReflectApply(ElementProtoGetAttributeNodeNS, el, [namespace, nodeName]); | ||
return ReflectApply(ElementProtoGetAttributeNodeNS, el, [namespace, nodeName]); | ||
} | ||
function ElementRemoveAttributeNode(el, attrNode) { | ||
return ReflectApply(ElementProtoRemoveAttributeNode, el, [attrNode]); | ||
return ReflectApply(ElementProtoRemoveAttributeNode, el, [attrNode]); | ||
} | ||
function ElementSetAttribute(el, name, value) { | ||
return ReflectApply(ElementProtoSetAttribute, el, [name, value]); | ||
return ReflectApply(ElementProtoSetAttribute, el, [name, value]); | ||
} | ||
function ElementSetAttributeNode(el, attr) { | ||
return ReflectApply(ElementProtoSetAttributeNode, el, [attr]); | ||
return ReflectApply(ElementProtoSetAttributeNode, el, [attr]); | ||
} | ||
function ElementSetAttributeNodeNS(el, attr) { | ||
return ReflectApply(ElementProtoSetAttributeNodeNS, el, [attr]); | ||
return ReflectApply(ElementProtoSetAttributeNodeNS, el, [attr]); | ||
} | ||
function ElementSetAttributeNS(el, namespace, name, value) { | ||
return ReflectApply(ElementProtoSetAttributeNS, el, [namespace, name, value]); | ||
return ReflectApply(ElementProtoSetAttributeNS, el, [namespace, name, value]); | ||
} | ||
const HTMLTemplateElementProtoContentGetter = ObjectLookupOwnGetter(HTMLTemplateElement.prototype, 'content'); | ||
function HTMLTemplateElementContentGetter(template) { | ||
return ReflectApply(HTMLTemplateElementProtoContentGetter, template, emptyArray); | ||
return ReflectApply(HTMLTemplateElementProtoContentGetter, template, emptyArray); | ||
} | ||
const { appendChild: NodeProtoAppendChild, cloneNode: NodeProtoCloneNode, isEqualNode: NodeProtoIsEqualNode, } = Node.prototype; | ||
const { | ||
appendChild: NodeProtoAppendChild, | ||
cloneNode: NodeProtoCloneNode, | ||
isEqualNode: NodeProtoIsEqualNode | ||
} = Node.prototype; | ||
const NodeProtoChildNodesGetter = ObjectLookupOwnGetter(Node.prototype, 'childNodes'); | ||
@@ -122,75 +196,100 @@ const NodeProtoFirstChildGetter = ObjectLookupOwnGetter(Node.prototype, 'firstChild'); | ||
const NodeProtoTextContentSetter = ObjectLookupOwnSetter(Node.prototype, 'textContent'); | ||
function NodeAppendChild(node, childNode) { | ||
return ReflectApply(NodeProtoAppendChild, node, [childNode]); | ||
return ReflectApply(NodeProtoAppendChild, node, [childNode]); | ||
} | ||
function NodeChildNodesGetter(node) { | ||
return ReflectApply(NodeProtoChildNodesGetter, node, emptyArray); | ||
return ReflectApply(NodeProtoChildNodesGetter, node, emptyArray); | ||
} | ||
function NodeClone(node, deep = false) { | ||
return ReflectApply(NodeProtoCloneNode, node, [deep]); | ||
function NodeClone(node) { | ||
let deep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
return ReflectApply(NodeProtoCloneNode, node, [deep]); | ||
} | ||
function NodeFirstChildGetter(node) { | ||
return ReflectApply(NodeProtoFirstChildGetter, node, emptyArray); | ||
return ReflectApply(NodeProtoFirstChildGetter, node, emptyArray); | ||
} | ||
function NodeIsEqualNode(node, otherNode) { | ||
return ReflectApply(NodeProtoIsEqualNode, node, [otherNode]); | ||
return ReflectApply(NodeProtoIsEqualNode, node, [otherNode]); | ||
} | ||
function NodeNameGetter(node) { | ||
// Normalize nodeName to upper case. | ||
// See https://johnresig.com/blog/nodename-case-sensitivity/. | ||
return StringToUpperCase(ReflectApply(NodeProtoNodeNameGetter, node, emptyArray)); | ||
// Normalize nodeName to upper case. | ||
// See https://johnresig.com/blog/nodename-case-sensitivity/. | ||
return StringToUpperCase(ReflectApply(NodeProtoNodeNameGetter, node, emptyArray)); | ||
} | ||
function NodeOwnerDocumentGetter(node) { | ||
return ReflectApply(NodeProtoOwnerDocumentGetter, node, emptyArray); | ||
return ReflectApply(NodeProtoOwnerDocumentGetter, node, emptyArray); | ||
} | ||
function NodeTextContentSetter(node, textContent) { | ||
ReflectApply(NodeProtoTextContentSetter, node, [textContent]); | ||
ReflectApply(NodeProtoTextContentSetter, node, [textContent]); | ||
} | ||
const { document } = window; | ||
const { | ||
document | ||
} = window; | ||
const leftTpl = DocumentCreateElement(document, 'template'); | ||
const rightTpl = DocumentCreateElement(document, 'template'); | ||
function deepIsEqualNode(leftRoot, rightRoot) { | ||
const leftRootNode = leftRoot instanceof HTMLTemplateElement | ||
? HTMLTemplateElementContentGetter(leftRoot) | ||
: leftRoot; | ||
const rightRootNode = rightRoot instanceof HTMLTemplateElement | ||
? HTMLTemplateElementContentGetter(rightRoot) | ||
: rightRoot; | ||
if (NodeIsEqualNode(leftRootNode, rightRootNode)) { | ||
const leftChildNodes = NodeChildNodesGetter(leftRootNode); | ||
const childCount = leftChildNodes.length; | ||
if (childCount > 0) { | ||
const rightChildNodes = NodeChildNodesGetter(rightRootNode); | ||
for (let i = 0; i < childCount; i += 1) { | ||
if (deepIsEqualNode(leftChildNodes[i], rightChildNodes[i]) === false) { | ||
return false; | ||
} | ||
} | ||
const leftRootNode = leftRoot instanceof HTMLTemplateElement ? HTMLTemplateElementContentGetter(leftRoot) : leftRoot; | ||
const rightRootNode = rightRoot instanceof HTMLTemplateElement ? HTMLTemplateElementContentGetter(rightRoot) : rightRoot; | ||
if (NodeIsEqualNode(leftRootNode, rightRootNode)) { | ||
const leftChildNodes = NodeChildNodesGetter(leftRootNode); | ||
const childCount = leftChildNodes.length; | ||
if (childCount > 0) { | ||
const rightChildNodes = NodeChildNodesGetter(rightRootNode); | ||
for (let i = 0; i < childCount; i += 1) { | ||
if (deepIsEqualNode(leftChildNodes[i], rightChildNodes[i]) === false) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
} | ||
return false; | ||
return true; | ||
} | ||
return false; | ||
} | ||
function isEqualDomString(leftString, rightString) { | ||
ElementInnerHTMLSetter(leftTpl, leftString); | ||
ElementInnerHTMLSetter(rightTpl, rightString); | ||
return deepIsEqualNode(leftTpl, rightTpl); | ||
ElementInnerHTMLSetter(leftTpl, leftString); | ||
ElementInnerHTMLSetter(rightTpl, rightString); | ||
return deepIsEqualNode(leftTpl, rightTpl); | ||
} | ||
function isSharedElement(element, doc = document) { | ||
return element === DocumentHeadGetter(doc) || element === DocumentBodyGetter(doc); | ||
function isSharedElement(element) { | ||
let doc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document; | ||
return element === DocumentHeadGetter(doc) || element === DocumentBodyGetter(doc); | ||
} | ||
const BlobProtoSizeGetter = ObjectLookupOwnGetter(Blob.prototype, 'size'); | ||
const { slice: BlobProtoSlice } = Blob.prototype; | ||
const { | ||
slice: BlobProtoSlice | ||
} = Blob.prototype; | ||
const BlobProtoTypeGetter = ObjectLookupOwnGetter(Blob.prototype, 'type'); | ||
const BlobCtor = Blob; | ||
function BlobSizeGetter(blob) { | ||
return ReflectApply(BlobProtoSizeGetter, blob, emptyArray); | ||
return ReflectApply(BlobProtoSizeGetter, blob, emptyArray); | ||
} | ||
function BlobSlice(blob, ...args) { | ||
return ReflectApply(BlobProtoSlice, blob, args); | ||
function BlobSlice(blob) { | ||
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { | ||
args[_key3 - 1] = arguments[_key3]; | ||
} | ||
return ReflectApply(BlobProtoSlice, blob, args); | ||
} | ||
function BlobTypeGetter(blob) { | ||
return StringToLowerCase(ReflectApply(BlobProtoTypeGetter, blob, emptyArray)); | ||
return StringToLowerCase(ReflectApply(BlobProtoTypeGetter, blob, emptyArray)); | ||
} | ||
@@ -203,47 +302,70 @@ | ||
const CookieStoreProtoSet = ObjectLookupOwnValue(CookieStoreProto, 'set'); | ||
const { | ||
define: CustomElementRegistryProtoDefine, | ||
get: CustomElementRegistryProtoGet | ||
} = CustomElementRegistry.prototype; | ||
const { | ||
getElementById: DocumentFragmentProtoGetElementById | ||
} = DocumentFragment.prototype; | ||
const { define: CustomElementRegistryProtoDefine, get: CustomElementRegistryProtoGet, } = CustomElementRegistry.prototype; | ||
const { getElementById: DocumentFragmentProtoGetElementById } = DocumentFragment.prototype; | ||
function DocumentFragmentGetElementById(fragment, id) { | ||
return ReflectApply(DocumentFragmentProtoGetElementById, fragment, [id]); | ||
return ReflectApply(DocumentFragmentProtoGetElementById, fragment, [id]); | ||
} | ||
const DOMTokenListProtoValueGetter = ObjectLookupOwnGetter(DOMTokenList.prototype, 'value'); | ||
function DOMTokenListValueGetter(tokenList) { | ||
return ReflectApply(DOMTokenListProtoValueGetter, tokenList, emptyArray); | ||
return ReflectApply(DOMTokenListProtoValueGetter, tokenList, emptyArray); | ||
} | ||
const { composedPath: EventProtoComposedPath } = Event.prototype; | ||
const { | ||
composedPath: EventProtoComposedPath | ||
} = Event.prototype; | ||
const EventProtoCurrentTargetGetter = ObjectLookupOwnGetter(Event.prototype, 'currentTarget'); | ||
function EventCurrentTargetGetter(event) { | ||
return ReflectApply(EventProtoCurrentTargetGetter, event, emptyArray); | ||
return ReflectApply(EventProtoCurrentTargetGetter, event, emptyArray); | ||
} | ||
const { addEventListener: EventTargetProtoAddEventListener } = EventTarget.prototype; | ||
function EventTargetAddEventListener(target, ...args) { | ||
return ReflectApply(EventTargetProtoAddEventListener, target, args); | ||
const { | ||
addEventListener: EventTargetProtoAddEventListener | ||
} = EventTarget.prototype; | ||
function EventTargetAddEventListener(target) { | ||
for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) { | ||
args[_key4 - 1] = arguments[_key4]; | ||
} | ||
return ReflectApply(EventTargetProtoAddEventListener, target, args); | ||
} | ||
const HTMLAnchorElementProtoHostnameGetter = ObjectLookupOwnGetter(HTMLAnchorElement.prototype, 'hostname'); | ||
const { get: HTMLAnchorElementProtoHrefGetter, set: HTMLAnchorElementProtoHrefSetter, } = ReflectGetOwnPropertyDescriptor(HTMLAnchorElement.prototype, 'href'); | ||
const { | ||
get: HTMLAnchorElementProtoHrefGetter, | ||
set: HTMLAnchorElementProtoHrefSetter | ||
} = ReflectGetOwnPropertyDescriptor(HTMLAnchorElement.prototype, 'href'); | ||
const HTMLAnchorElementProtoPathnameGetter = ObjectLookupOwnGetter(HTMLAnchorElement.prototype, 'pathname'); | ||
const HTMLAnchorElementProtoProtocolGetter = ObjectLookupOwnGetter(HTMLAnchorElement.prototype, 'protocol'); | ||
function HTMLAnchorElementHostnameGetter(anchor) { | ||
return ReflectApply(HTMLAnchorElementProtoHostnameGetter, anchor, emptyArray); | ||
return ReflectApply(HTMLAnchorElementProtoHostnameGetter, anchor, emptyArray); | ||
} | ||
function HTMLAnchorElementHrefGetter(anchor) { | ||
return ReflectApply(HTMLAnchorElementProtoHrefGetter, anchor, emptyArray); | ||
return ReflectApply(HTMLAnchorElementProtoHrefGetter, anchor, emptyArray); | ||
} | ||
function HTMLAnchorElementHrefSetter(anchor, href) { | ||
ReflectApply(HTMLAnchorElementProtoHrefSetter, anchor, [href]); | ||
ReflectApply(HTMLAnchorElementProtoHrefSetter, anchor, [href]); | ||
} | ||
function HTMLAnchorElementPathnameGetter(anchor) { | ||
return ReflectApply(HTMLAnchorElementProtoPathnameGetter, anchor, emptyArray); | ||
return ReflectApply(HTMLAnchorElementProtoPathnameGetter, anchor, emptyArray); | ||
} | ||
function HTMLAnchorElementProtocolGetter(anchor) { | ||
return ReflectApply(HTMLAnchorElementProtoProtocolGetter, anchor, emptyArray); | ||
} | ||
return ReflectApply(HTMLAnchorElementProtoProtocolGetter, anchor, emptyArray); | ||
} // The innerText and outerText setters may be undefined. | ||
// The innerText and outerText setters may be undefined. | ||
const HTMLElementProtoInnerTextSetter = ObjectLookupOwnSetter(HTMLElement.prototype, 'innerText'); | ||
@@ -253,17 +375,16 @@ const HTMLElementProtoOuterTextSetter = ObjectLookupOwnSetter(HTMLElement.prototype, 'outerText'); | ||
const HTMLElementProtoStyleGetter = ObjectLookupOwnGetter(HTMLElement.prototype, 'style'); | ||
function HTMLElementDatasetGetter(el) { | ||
return ReflectApply(HTMLElementProtoDatasetGetter, el, emptyArray); | ||
return ReflectApply(HTMLElementProtoDatasetGetter, el, emptyArray); | ||
} | ||
const HTMLElementInnerTextSetter = HTMLElementProtoInnerTextSetter | ||
? function HTMLElementInnerTextSetter(el, text) { | ||
ReflectApply(HTMLElementProtoInnerTextSetter, el, [text]); | ||
} | ||
: function HTMLElementInnerTextSetter(_el, _text) { }; | ||
const HTMLElementOuterTextSetter = HTMLElementProtoOuterTextSetter | ||
? function HTMLElementOuterTextSetter(el, text) { | ||
ReflectApply(HTMLElementProtoOuterTextSetter, el, [text]); | ||
} | ||
: function HTMLElementOuterTextSetter(_el, _text) { }; | ||
const HTMLElementInnerTextSetter = HTMLElementProtoInnerTextSetter ? function HTMLElementInnerTextSetter(el, text) { | ||
ReflectApply(HTMLElementProtoInnerTextSetter, el, [text]); | ||
} : function HTMLElementInnerTextSetter(_el, _text) {}; | ||
const HTMLElementOuterTextSetter = HTMLElementProtoOuterTextSetter ? function HTMLElementOuterTextSetter(el, text) { | ||
ReflectApply(HTMLElementProtoOuterTextSetter, el, [text]); | ||
} : function HTMLElementOuterTextSetter(_el, _text) {}; | ||
function HTMLElementStyleGetter(el) { | ||
return ReflectApply(HTMLElementProtoStyleGetter, el, emptyArray); | ||
return ReflectApply(HTMLElementProtoStyleGetter, el, emptyArray); | ||
} | ||
@@ -273,7 +394,9 @@ | ||
const HTMLFrameElementProtoContentWindowGetter = ObjectLookupOwnGetter(HTMLFrameElement.prototype, 'contentWindow'); | ||
function HTMLFrameElementContentDocumentGetter(frame) { | ||
return ReflectApply(HTMLFrameElementProtoContentDocumentGetter, frame, emptyArray); | ||
return ReflectApply(HTMLFrameElementProtoContentDocumentGetter, frame, emptyArray); | ||
} | ||
function HTMLFrameElementContentWindowGetter(frame) { | ||
return ReflectApply(HTMLFrameElementProtoContentWindowGetter, frame, emptyArray); | ||
return ReflectApply(HTMLFrameElementProtoContentWindowGetter, frame, emptyArray); | ||
} | ||
@@ -284,10 +407,13 @@ | ||
const HTMLIFrameElementProtoSrcSetter = ObjectLookupOwnSetter(HTMLIFrameElement.prototype, 'src'); | ||
function HTMLIFrameElementContentDocumentGetter(iframe) { | ||
return ReflectApply(HTMLIFrameElementProtoContentDocumentGetter, iframe, emptyArray); | ||
return ReflectApply(HTMLIFrameElementProtoContentDocumentGetter, iframe, emptyArray); | ||
} | ||
function HTMLIFrameElementContentWindowGetter(iframe) { | ||
return ReflectApply(HTMLIFrameElementProtoContentWindowGetter, iframe, emptyArray); | ||
return ReflectApply(HTMLIFrameElementProtoContentWindowGetter, iframe, emptyArray); | ||
} | ||
function HTMLIFrameElementSrcSetter(iframe, src) { | ||
ReflectApply(HTMLIFrameElementProtoSrcSetter, iframe, [src]); | ||
ReflectApply(HTMLIFrameElementProtoSrcSetter, iframe, [src]); | ||
} | ||
@@ -297,7 +423,9 @@ | ||
const HTMLLinkElementProtoRelListSetter = ObjectLookupOwnSetter(HTMLLinkElement.prototype, 'relList'); | ||
function HTMLLinkElementRelSetter(link, rel) { | ||
ReflectApply(HTMLLinkElementProtoRelSetter, link, [rel]); | ||
ReflectApply(HTMLLinkElementProtoRelSetter, link, [rel]); | ||
} | ||
function HTMLLinkElementRelListSetter(link, relList) { | ||
ReflectApply(HTMLLinkElementProtoRelListSetter, link, [relList]); | ||
ReflectApply(HTMLLinkElementProtoRelListSetter, link, [relList]); | ||
} | ||
@@ -307,44 +435,58 @@ | ||
const HTMLObjectElementProtoContentWindowGetter = ObjectLookupOwnGetter(HTMLObjectElement.prototype, 'contentWindow'); | ||
function HTMLObjectElementContentDocumentGetter(objectEl) { | ||
return ReflectApply(HTMLObjectProtoContentDocumentGetter, objectEl, emptyArray); | ||
} | ||
// contentWindow is not supported on object elements in iOS < 13. | ||
return ReflectApply(HTMLObjectProtoContentDocumentGetter, objectEl, emptyArray); | ||
} // contentWindow is not supported on object elements in iOS < 13. | ||
// https://caniuse.com/mdn-api_htmlobjectelement_contentwindow | ||
const HTMLObjectElementContentWindowGetter = HTMLObjectElementProtoContentWindowGetter | ||
? function HTMLObjectElementContentWindowGetter(objectEl) { | ||
return ReflectApply(HTMLObjectElementProtoContentWindowGetter, objectEl, emptyArray); | ||
} | ||
: function HTMLObjectElementContentWindowGetter(_objectEl) { | ||
return null; | ||
}; | ||
const { get: HTMLScriptElementProtoSrcGetter, set: HTMLScriptElementProtoSrcSetter, } = ReflectGetOwnPropertyDescriptor(HTMLScriptElement.prototype, 'src'); | ||
const HTMLObjectElementContentWindowGetter = HTMLObjectElementProtoContentWindowGetter ? function HTMLObjectElementContentWindowGetter(objectEl) { | ||
return ReflectApply(HTMLObjectElementProtoContentWindowGetter, objectEl, emptyArray); | ||
} : function HTMLObjectElementContentWindowGetter(_objectEl) { | ||
return null; | ||
}; | ||
const { | ||
get: HTMLScriptElementProtoSrcGetter, | ||
set: HTMLScriptElementProtoSrcSetter | ||
} = ReflectGetOwnPropertyDescriptor(HTMLScriptElement.prototype, 'src'); | ||
const MessageEventProtoSourceGetter = ObjectLookupOwnGetter(MessageEvent.prototype, 'source'); | ||
function MessageEventSourceGetter(messageEvent) { | ||
return ReflectApply(MessageEventProtoSourceGetter, messageEvent, emptyArray); | ||
return ReflectApply(MessageEventProtoSourceGetter, messageEvent, emptyArray); | ||
} | ||
const { setNamedItem: NamedNodeMapProtoSetNamedItem } = NamedNodeMap.prototype; | ||
const { | ||
setNamedItem: NamedNodeMapProtoSetNamedItem | ||
} = NamedNodeMap.prototype; | ||
const { | ||
createContextualFragment: RangeProtoCreateContextualFragment | ||
} = Range.prototype; | ||
const RequestProtoURLGetter = ObjectLookupOwnGetter(Request.prototype, 'url'); | ||
const { createContextualFragment: RangeProtoCreateContextualFragment } = Range.prototype; | ||
const RequestProtoURLGetter = ObjectLookupOwnGetter(Request.prototype, 'url'); | ||
function RequestURLGetter(request) { | ||
return ReflectApply(RequestProtoURLGetter, request, emptyArray); | ||
return ReflectApply(RequestProtoURLGetter, request, emptyArray); | ||
} | ||
const { key: StorageProtoKey, getItem: StorageProtoGetItem, removeItem: StorageProtoRemoveItem, setItem: StorageProtoSetItem, } = Storage.prototype; | ||
const { | ||
key: StorageProtoKey, | ||
getItem: StorageProtoGetItem, | ||
removeItem: StorageProtoRemoveItem, | ||
setItem: StorageProtoSetItem | ||
} = Storage.prototype; | ||
const SVGElementProtoDatasetGetter = ObjectLookupOwnGetter(SVGElement.prototype, 'dataset'); | ||
const SVGElementProtoDatasetGetter = ObjectLookupOwnGetter(SVGElement.prototype, 'dataset'); | ||
function SVGElementDatasetGetter(svg) { | ||
return ReflectApply(SVGElementProtoDatasetGetter, svg, emptyArray); | ||
return ReflectApply(SVGElementProtoDatasetGetter, svg, emptyArray); | ||
} | ||
const { createObjectURL: URLCreateObjectURL, revokeObjectURL: URLRevokeObjectURL } = URL; | ||
const { | ||
createObjectURL: URLCreateObjectURL, | ||
revokeObjectURL: URLRevokeObjectURL | ||
} = URL; | ||
const ALLOW_LIST_PATCHED = ['opener', 'parent']; | ||
const ALLOW_LIST_RAW = ['close', 'closed', 'focus', 'postMessage']; | ||
const DEFAULT_OVERWRITTEN_VALUE = {}; | ||
const { clearInterval: WindowStaticClearInterval } = window; | ||
const { | ||
clearInterval: WindowStaticClearInterval | ||
} = window; | ||
const WindowStaticLengthGetter = ObjectLookupOwnGetter(window, 'length'); | ||
@@ -355,113 +497,155 @@ const WindowStaticOpenerGetter = ObjectLookupOwnGetter(window, 'opener'); | ||
const patchedWindowMap = new WeakMapCtor(); | ||
function createPatchedWindow(rawWindow) { | ||
const patchedWindow = {}; | ||
for (let i = 0, len = ALLOW_LIST_RAW.length; i < len; i += 1) { | ||
const key = ALLOW_LIST_RAW[i]; | ||
const originalDescriptor = ReflectGetOwnPropertyDescriptor(rawWindow, key); | ||
if (originalDescriptor) { | ||
ReflectSetPrototypeOf(originalDescriptor, null); | ||
const { value: originalValue } = originalDescriptor; | ||
if (typeof originalValue === 'function') { | ||
const bound = FunctionBind(originalValue, rawWindow); | ||
ReflectDefineProperty(bound, 'name', ReflectGetOwnPropertyDescriptor(originalValue, 'name')); | ||
originalDescriptor.value = bound; | ||
} | ||
else { | ||
const { get: originalDescriptorGetter, set: originalDescriptorSetter, } = originalDescriptor; | ||
let overwrittenValue = DEFAULT_OVERWRITTEN_VALUE; | ||
if (typeof originalDescriptorGetter === 'function') { | ||
originalDescriptor.get = function get() { | ||
return overwrittenValue === DEFAULT_OVERWRITTEN_VALUE | ||
? ReflectApply(originalDescriptorGetter, rawWindow, emptyArray) | ||
: overwrittenValue; | ||
}; | ||
} | ||
if (typeof originalDescriptorSetter === 'function') { | ||
originalDescriptor.set = function set(value) { | ||
overwrittenValue = value; | ||
}; | ||
} | ||
} | ||
ReflectDefineProperty(patchedWindow, key, originalDescriptor); | ||
const patchedWindow = {}; | ||
for (let i = 0, len = ALLOW_LIST_RAW.length; i < len; i += 1) { | ||
const key = ALLOW_LIST_RAW[i]; | ||
const originalDescriptor = ReflectGetOwnPropertyDescriptor(rawWindow, key); | ||
if (originalDescriptor) { | ||
ReflectSetPrototypeOf(originalDescriptor, null); | ||
const { | ||
value: originalValue | ||
} = originalDescriptor; | ||
if (typeof originalValue === 'function') { | ||
const bound = FunctionBind(originalValue, rawWindow); | ||
ReflectDefineProperty(bound, 'name', ReflectGetOwnPropertyDescriptor(originalValue, 'name')); | ||
originalDescriptor.value = bound; | ||
} else { | ||
const { | ||
get: originalDescriptorGetter, | ||
set: originalDescriptorSetter | ||
} = originalDescriptor; | ||
let overwrittenValue = DEFAULT_OVERWRITTEN_VALUE; | ||
if (typeof originalDescriptorGetter === 'function') { | ||
originalDescriptor.get = function get() { | ||
return overwrittenValue === DEFAULT_OVERWRITTEN_VALUE ? ReflectApply(originalDescriptorGetter, rawWindow, emptyArray) : overwrittenValue; | ||
}; | ||
} | ||
} | ||
for (let i = 0, len = ALLOW_LIST_PATCHED.length; i < len; i += 1) { | ||
const key = ALLOW_LIST_PATCHED[i]; | ||
const originalDescriptor = ReflectGetOwnPropertyDescriptor(rawWindow, key); | ||
if (originalDescriptor) { | ||
ReflectSetPrototypeOf(originalDescriptor, null); | ||
const { get: originalDescriptorGetter, set: originalDescriptorSetter, } = originalDescriptor; | ||
let overwrittenValue = DEFAULT_OVERWRITTEN_VALUE; | ||
if (typeof originalDescriptorGetter === 'function') { | ||
originalDescriptor.get = function get() { | ||
if (overwrittenValue === DEFAULT_OVERWRITTEN_VALUE) { | ||
return getPatchedWindow(ReflectApply(originalDescriptorGetter, rawWindow, emptyArray)); | ||
} | ||
return overwrittenValue; | ||
}; | ||
} | ||
if (typeof originalDescriptorSetter === 'function') { | ||
originalDescriptor.set = function set(value) { | ||
overwrittenValue = value; | ||
}; | ||
} | ||
ReflectDefineProperty(patchedWindow, key, originalDescriptor); | ||
if (typeof originalDescriptorSetter === 'function') { | ||
originalDescriptor.set = function set(value) { | ||
overwrittenValue = value; | ||
}; | ||
} | ||
} | ||
ReflectDefineProperty(patchedWindow, key, originalDescriptor); | ||
} | ||
return patchedWindow; | ||
} | ||
// setInterval and clearInterval are part of WindowOrGlobalScope mixin, they are | ||
} | ||
for (let i = 0, len = ALLOW_LIST_PATCHED.length; i < len; i += 1) { | ||
const key = ALLOW_LIST_PATCHED[i]; | ||
const originalDescriptor = ReflectGetOwnPropertyDescriptor(rawWindow, key); | ||
if (originalDescriptor) { | ||
ReflectSetPrototypeOf(originalDescriptor, null); | ||
const { | ||
get: originalDescriptorGetter, | ||
set: originalDescriptorSetter | ||
} = originalDescriptor; | ||
let overwrittenValue = DEFAULT_OVERWRITTEN_VALUE; | ||
if (typeof originalDescriptorGetter === 'function') { | ||
originalDescriptor.get = function get() { | ||
if (overwrittenValue === DEFAULT_OVERWRITTEN_VALUE) { | ||
return getPatchedWindow(ReflectApply(originalDescriptorGetter, rawWindow, emptyArray)); | ||
} | ||
return overwrittenValue; | ||
}; | ||
} | ||
if (typeof originalDescriptorSetter === 'function') { | ||
originalDescriptor.set = function set(value) { | ||
overwrittenValue = value; | ||
}; | ||
} | ||
ReflectDefineProperty(patchedWindow, key, originalDescriptor); | ||
} | ||
} | ||
return patchedWindow; | ||
} // setInterval and clearInterval are part of WindowOrGlobalScope mixin, they are | ||
// not on Window.prototype. See https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope. | ||
const { decodeURIComponent: WindowStaticDecodeURIComponent, encodeURIComponent: WindowStaticEncodeURIComponent, fetch: WindowStaticFetch, open: WindowStaticOpen, setInterval: WindowStaticSetInterval, setTimeout: WindowStaticSetTimeout, } = window; | ||
const { | ||
decodeURIComponent: WindowStaticDecodeURIComponent, | ||
encodeURIComponent: WindowStaticEncodeURIComponent, | ||
fetch: WindowStaticFetch, | ||
open: WindowStaticOpen, | ||
setInterval: WindowStaticSetInterval, | ||
setTimeout: WindowStaticSetTimeout | ||
} = window; | ||
function getPatchedWindow(win) { | ||
let patchedContentWindow = null; | ||
if (win !== null) { | ||
patchedContentWindow = WeakMapGet(patchedWindowMap, win); | ||
if (!patchedContentWindow) { | ||
patchedContentWindow = createPatchedWindow(win); | ||
WeakMapSet(patchedWindowMap, win, patchedContentWindow); | ||
} | ||
let patchedContentWindow = null; | ||
if (win !== null) { | ||
patchedContentWindow = WeakMapGet(patchedWindowMap, win); | ||
if (!patchedContentWindow) { | ||
patchedContentWindow = createPatchedWindow(win); | ||
WeakMapSet(patchedWindowMap, win, patchedContentWindow); | ||
} | ||
return patchedContentWindow; | ||
} | ||
return patchedContentWindow; | ||
} | ||
function isWindowLike(value) { | ||
// fast check to narrow down when to do the slow check for window objects | ||
// window.top is unforgeable, this means this check should be safe from | ||
// user-intervention to try to bypass this check. | ||
return ObjectHasOwnProperty(value, 'top'); | ||
// fast check to narrow down when to do the slow check for window objects | ||
// window.top is unforgeable, this means this check should be safe from | ||
// user-intervention to try to bypass this check. | ||
return ObjectHasOwnProperty(value, 'top'); | ||
} | ||
function isWindow(value) { | ||
// slower check that must certainly detect a window object | ||
try { | ||
// window.self getter only works for a window object, otherwise it throws, | ||
// additionally, this works fine for a detached window as well, which is | ||
// important since it will guarantee that this check works also for iframes | ||
// that are disconnected, and could be connected later on, that should not | ||
// bypass this check. This check is is also equivalent to window.frames, and | ||
// here is the very simple spec for this getter: | ||
// https://html.spec.whatwg.org/multipage/window-object.html#dom-self | ||
WindowSelfGetter(value); | ||
return true; | ||
// eslint-disable-next-line no-empty | ||
} | ||
catch { } | ||
return false; | ||
// slower check that must certainly detect a window object | ||
try { | ||
// window.self getter only works for a window object, otherwise it throws, | ||
// additionally, this works fine for a detached window as well, which is | ||
// important since it will guarantee that this check works also for iframes | ||
// that are disconnected, and could be connected later on, that should not | ||
// bypass this check. This check is is also equivalent to window.frames, and | ||
// here is the very simple spec for this getter: | ||
// https://html.spec.whatwg.org/multipage/window-object.html#dom-self | ||
WindowSelfGetter(value); | ||
return true; // eslint-disable-next-line no-empty | ||
} catch (_unused) {} | ||
return false; | ||
} | ||
function WindowClearInterval(win, intervalID) { | ||
return ReflectApply(WindowStaticClearInterval, win, [intervalID]); | ||
return ReflectApply(WindowStaticClearInterval, win, [intervalID]); | ||
} | ||
function WindowLengthGetter(win) { | ||
return ReflectApply(WindowStaticLengthGetter, win, emptyArray); | ||
return ReflectApply(WindowStaticLengthGetter, win, emptyArray); | ||
} | ||
function WindowOpenerGetter(win) { | ||
return ReflectApply(WindowStaticOpenerGetter, win, emptyArray); | ||
return ReflectApply(WindowStaticOpenerGetter, win, emptyArray); | ||
} | ||
function WindowParentGetter(win) { | ||
return ReflectApply(WindowStaticParentGetter, win, emptyArray); | ||
return ReflectApply(WindowStaticParentGetter, win, emptyArray); | ||
} | ||
function WindowSelfGetter(win) { | ||
return ReflectApply(WindowStaticSelfGetter, win, emptyArray); | ||
return ReflectApply(WindowStaticSelfGetter, win, emptyArray); | ||
} | ||
function WindowSetInterval(win, ...args) { | ||
return ReflectApply(WindowStaticSetInterval, win, args); | ||
function WindowSetInterval(win) { | ||
for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) { | ||
args[_key5 - 1] = arguments[_key5]; | ||
} | ||
return ReflectApply(WindowStaticSetInterval, win, args); | ||
} | ||
@@ -471,24 +655,34 @@ | ||
const XhrProto = XhrCtor.prototype; | ||
const { send: XhrProtoSend } = XhrProto; | ||
const { | ||
send: XhrProtoSend | ||
} = XhrProto; | ||
const XhrProtoResponseTextGetter = ObjectLookupOwnGetter(XhrProto, 'responseText'); | ||
const XhrProtoStatusGetter = ObjectLookupOwnGetter(XhrProto, 'status'); | ||
const XhrProtoWithCredentialsSetter = ObjectLookupOwnSetter(XhrProto, 'withCredentials'); | ||
const { open: XhrProtoOpen } = XhrProto; | ||
function XhrOpen(xhr, requestMethod, url, async = true) { | ||
return ReflectApply(XhrProtoOpen, xhr, [requestMethod, url, async]); | ||
const { | ||
open: XhrProtoOpen | ||
} = XhrProto; | ||
function XhrOpen(xhr, requestMethod, url) { | ||
let async = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; | ||
return ReflectApply(XhrProtoOpen, xhr, [requestMethod, url, async]); | ||
} | ||
function XhrResponseTextGetter(xhr) { | ||
return ReflectApply(XhrProtoResponseTextGetter, xhr, emptyArray); | ||
return ReflectApply(XhrProtoResponseTextGetter, xhr, emptyArray); | ||
} | ||
function XhrSend(xhr) { | ||
return ReflectApply(XhrProtoSend, xhr, emptyArray); | ||
return ReflectApply(XhrProtoSend, xhr, emptyArray); | ||
} | ||
function XhrStatusGetter(xhr) { | ||
return ReflectApply(XhrProtoStatusGetter, xhr, emptyArray); | ||
return ReflectApply(XhrProtoStatusGetter, xhr, emptyArray); | ||
} | ||
function XhrWithCredentialsSetter(xhr, bool) { | ||
ReflectApply(XhrProtoWithCredentialsSetter, xhr, [bool]); | ||
ReflectApply(XhrProtoWithCredentialsSetter, xhr, [bool]); | ||
} | ||
export { AttrNameGetter, AttrNamespaceURIGetter, AttrOwnerElementGetter, AttrValueGetter, AttrValueSetter, BlobCtor, BlobSizeGetter, BlobSlice, BlobTypeGetter, CookieStoreProtoDelete, CookieStoreProtoGet, CookieStoreProtoGetAll, CookieStoreProtoSet, CustomElementRegistryProtoDefine, CustomElementRegistryProtoGet, DOMTokenListValueGetter, DocumentBodyGetter, DocumentCookieGetter, DocumentCookieSetter, DocumentCreateComment, DocumentCreateElement, DocumentCreateElementNS, DocumentFragmentGetElementById, DocumentGetElementById, DocumentHeadGetter, DocumentProtoExecCommand, ElementAttributesGetter, ElementClosest, ElementGetAttributeNode, ElementGetAttributeNodeNS, ElementInnerHTMLGetter, ElementInnerHTMLSetter, ElementOuterHTMLGetter, ElementOuterHTMLSetter, ElementProtoAttachShadow, ElementProtoInsertAdjacentHTML, ElementProtoSetAttribute, ElementProtoSetAttributeNS, ElementProtoSetAttributeNode, ElementQuerySelector, ElementRemoveAttributeNode, ElementSetAttribute, ElementSetAttributeNS, ElementSetAttributeNode, ElementSetAttributeNodeNS, EventCurrentTargetGetter, EventProtoComposedPath, EventTargetAddEventListener, HTMLAnchorElementHostnameGetter, HTMLAnchorElementHrefGetter, HTMLAnchorElementHrefSetter, HTMLAnchorElementPathnameGetter, HTMLAnchorElementProtocolGetter, HTMLElementDatasetGetter, HTMLElementInnerTextSetter, HTMLElementOuterTextSetter, HTMLElementStyleGetter, HTMLFrameElementContentDocumentGetter, HTMLFrameElementContentWindowGetter, HTMLIFrameElementContentDocumentGetter, HTMLIFrameElementContentWindowGetter, HTMLIFrameElementSrcSetter, HTMLLinkElementRelListSetter, HTMLLinkElementRelSetter, HTMLObjectElementContentDocumentGetter, HTMLObjectElementContentWindowGetter, HTMLScriptElementProtoSrcGetter, HTMLScriptElementProtoSrcSetter, HTMLTemplateElementContentGetter, MessageEventSourceGetter, NamedNodeMapProtoSetNamedItem, NodeAppendChild, NodeChildNodesGetter, NodeClone, NodeFirstChildGetter, NodeIsEqualNode, NodeNameGetter, NodeOwnerDocumentGetter, NodeTextContentSetter, RangeProtoCreateContextualFragment, RequestURLGetter, SVGElementDatasetGetter, 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, isSharedElement, isWindow, isWindowLike, nsCookieKey, nsCookieRootKey }; | ||
/*! version: 0.14.4 */ | ||
/*! version: 0.14.5 */ |
{ | ||
"name": "@locker/shared-dom", | ||
"version": "0.14.4", | ||
"version": "0.14.5", | ||
"license": "Salesforce Developer Agreement", | ||
@@ -18,3 +18,3 @@ "author": "Salesforce UI Security Team", | ||
"dependencies": { | ||
"@locker/shared": "0.14.4" | ||
"@locker/shared": "0.14.5" | ||
}, | ||
@@ -25,3 +25,3 @@ "files": [ | ||
], | ||
"gitHead": "775de69b0fe1bb6cc739abc304e56b552c1f85d2" | ||
"gitHead": "257009273b0c98354e0fafd9d4e81d16664bad2e" | ||
} |
89483
1380
+ Added@locker/shared@0.14.5(transitive)
- Removed@locker/shared@0.14.4(transitive)
Updated@locker/shared@0.14.5