Bug 1363053 - Use Node.ELEMENT_NODE instead of magic number
This patch removes the magic number and instead uses the ELEMENT_NODE
constant which exists on all objects of the Node prototype chain.
We already test that obj has a nodeType own property.
MozReview-Commit-ID: If9HIkBjCyN
--- a/testing/marionette/evaluate.js
+++ b/testing/marionette/evaluate.js
@@ -260,17 +260,17 @@ evaluate.toJSON = function (obj, seenEls
}
// Array, NodeList, HTMLCollection, et al.
else if (element.isCollection(obj)) {
return [...obj].map(el => evaluate.toJSON(el, seenEls));
}
// HTMLElement
- else if ("nodeType" in obj && obj.nodeType == 1) {
+ else if ("nodeType" in obj && obj.nodeType == obj.ELEMENT_NODE) {
let uuid = seenEls.add(obj);
return element.makeWebElement(uuid);
}
// custom JSON representation
else if (typeof obj["toJSON"] == "function") {
let unsafeJSON = obj.toJSON();
return evaluate.toJSON(unsafeJSON, seenEls);