diff --git a/browser/components/translation/TranslationDocument.jsm b/browser/components/translation/TranslationDocument.jsm index ee580907d0f8..54ab73b3a897 100644 --- a/browser/components/translation/TranslationDocument.jsm +++ b/browser/components/translation/TranslationDocument.jsm @@ -6,8 +6,6 @@ var EXPORTED_SYMBOLS = [ "TranslationDocument" ]; -const TEXT_NODE = Ci.nsIDOMNode.TEXT_NODE; - ChromeUtils.import("resource://services-common/async.js"); Cu.importGlobalProperties(["DOMParser"]); @@ -141,7 +139,7 @@ this.TranslationDocument.prototype = { let wasLastItemPlaceholder = false; for (let child of item.nodeRef.childNodes) { - if (child.nodeType == TEXT_NODE) { + if (child.nodeType == child.TEXT_NODE) { let x = child.nodeValue.trim(); if (x != "") { item.original.push(x); @@ -409,7 +407,7 @@ function regenerateTextFromOriginalHelper(item) { function parseResultNode(item, node) { item.translation = []; for (let child of node.childNodes) { - if (child.nodeType == TEXT_NODE) { + if (child.nodeType == child.TEXT_NODE) { item.translation.push(child.nodeValue); } else if (child.localName == "br") { item.translation.push(TranslationItem_NodePlaceholder); @@ -558,7 +556,7 @@ function swapTextForItem(item, target) { // text change instead of two (while also leaving the page closer to // its original state). while (curNode && - curNode.nodeType == TEXT_NODE && + curNode.nodeType == curNode.TEXT_NODE && curNode.nodeValue.trim() == "") { curNode = curNode.nextSibling; } @@ -608,7 +606,7 @@ function swapTextForItem(item, target) { // targetItem for those nodes are handled. while (curNode && - (curNode.nodeType != TEXT_NODE || + (curNode.nodeType != curNode.TEXT_NODE || curNode.nodeValue.trim() == "")) { curNode = curNode.nextSibling; } @@ -617,7 +615,7 @@ function swapTextForItem(item, target) { // Finally, if it's a text item, we just need to find the next // text node to use. Text nodes don't need to be reordered, so // the first one found can be used. - while (curNode && curNode.nodeType != TEXT_NODE) { + while (curNode && curNode.nodeType != curNode.TEXT_NODE) { curNode = curNode.nextSibling; } @@ -654,7 +652,7 @@ function swapTextForItem(item, target) { function getNextSiblingSkippingEmptyTextNodes(startSibling) { let item = startSibling.nextSibling; while (item && - item.nodeType == TEXT_NODE && + item.nodeType == item.TEXT_NODE && item.nodeValue.trim() == "") { item = item.nextSibling; } @@ -664,7 +662,7 @@ function getNextSiblingSkippingEmptyTextNodes(startSibling) { function clearRemainingNonEmptyTextNodesFromElement(startSibling) { let item = startSibling; while (item) { - if (item.nodeType == TEXT_NODE && + if (item.nodeType == item.TEXT_NODE && item.nodeValue != "") { item.nodeValue = ""; } diff --git a/browser/extensions/formautofill/FormAutofillHeuristics.jsm b/browser/extensions/formautofill/FormAutofillHeuristics.jsm index 4781da40b6fc..8ea7ba3853d7 100644 --- a/browser/extensions/formautofill/FormAutofillHeuristics.jsm +++ b/browser/extensions/formautofill/FormAutofillHeuristics.jsm @@ -326,7 +326,7 @@ var LabelUtils = { return; } - if (el.nodeType == Ci.nsIDOMNode.TEXT_NODE || el.childNodes.length == 0) { + if (el.nodeType == el.TEXT_NODE || el.childNodes.length == 0) { let trimmedText = el.textContent.trim(); if (trimmedText) { strings.push(trimmedText); @@ -336,7 +336,7 @@ var LabelUtils = { for (let node of el.childNodes) { let nodeType = node.nodeType; - if (nodeType != Ci.nsIDOMNode.ELEMENT_NODE && nodeType != Ci.nsIDOMNode.TEXT_NODE) { + if (nodeType != node.ELEMENT_NODE && nodeType != node.TEXT_NODE) { continue; } _extractLabelStrings(node); diff --git a/browser/modules/ContextMenu.jsm b/browser/modules/ContextMenu.jsm index 59f533a73c03..8211b6e7e662 100644 --- a/browser/modules/ContextMenu.jsm +++ b/browser/modules/ContextMenu.jsm @@ -336,7 +336,7 @@ class ContextMenu { let depth = 1; while (node && depth > 0) { // See if this node is text. - if (node.nodeType == Ci.nsIDOMNode.TEXT_NODE) { + if (node.nodeType == node.TEXT_NODE) { // Add this text to our collection. text += " " + node.data; } else if (node instanceof this.content.HTMLImageElement) { @@ -535,7 +535,7 @@ class ContextMenu { // Media related cache info parent needs for saving let contentType = null; let contentDisposition = null; - if (aEvent.composedTarget.nodeType == Ci.nsIDOMNode.ELEMENT_NODE && + if (aEvent.composedTarget.nodeType == aEvent.composedTarget.ELEMENT_NODE && aEvent.composedTarget instanceof Ci.nsIImageLoadingContent && aEvent.composedTarget.currentURI) { disableSetDesktopBg = this._disableSetDesktopBackground(aEvent.composedTarget); @@ -711,7 +711,7 @@ class ContextMenu { context.shouldDisplay = true; - if (node.nodeType == Ci.nsIDOMNode.DOCUMENT_NODE || + if (node.nodeType == node.DOCUMENT_NODE || // Don't display for XUL element unless