mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-13 17:27:09 +00:00
Switch nwmatcher from thinking we're a DocumentFragment to thinking we're a proper Document.
This commit is contained in:
@@ -235,7 +235,7 @@ function getElementsByTagName(tagName) {
|
|||||||
const ElementExtensions = {
|
const ElementExtensions = {
|
||||||
nodeName: {
|
nodeName: {
|
||||||
get() {
|
get() {
|
||||||
return this.tagName;
|
return this.tagName.toUpperCase();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
insertBefore(child, referenceNode) {
|
insertBefore(child, referenceNode) {
|
||||||
@@ -279,7 +279,12 @@ const DocumentExtensions = {
|
|||||||
// nwmatcher requires that it at least report a correct nodeType of DOCUMENT_NODE.
|
// nwmatcher requires that it at least report a correct nodeType of DOCUMENT_NODE.
|
||||||
nodeType: {
|
nodeType: {
|
||||||
get() {
|
get() {
|
||||||
return 11;
|
return 9;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
nodeName: {
|
||||||
|
get() {
|
||||||
|
return '#document';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
createElement(name) {
|
createElement(name) {
|
||||||
@@ -295,10 +300,10 @@ const DocumentExtensions = {
|
|||||||
return node;
|
return node;
|
||||||
},
|
},
|
||||||
querySelector(sel) {
|
querySelector(sel) {
|
||||||
return this.$match.first(sel);
|
return this.$match.first(sel, this.documentElement);
|
||||||
},
|
},
|
||||||
querySelectorAll(sel) {
|
querySelectorAll(sel) {
|
||||||
return this.$match.select(sel);
|
return this.$match.select(sel, this.documentElement);
|
||||||
},
|
},
|
||||||
getElementsByTagName,
|
getElementsByTagName,
|
||||||
// nwmatcher uses inexistence of `document.addEventListener` to detect IE:
|
// nwmatcher uses inexistence of `document.addEventListener` to detect IE:
|
||||||
|
|||||||
Reference in New Issue
Block a user