Bug 1454233: Add a comment about why IsDocument() is the way it is. r=me
authorEmilio Cobos Álvarez <emilio@crisal.io>
Fri, 20 Apr 2018 03:56:02 +0200
changeset 785485 6bec96422fe4ba15e76247e7e8b83e506daf1f6d
parent 785484 cb757c8237f0ae635266eb247032bf9147eb4e38
child 785486 7549ebecdf7e78e3560382a2b25fddb34c0ba60f
push id107236
push userbmo:emilio@crisal.io
push dateFri, 20 Apr 2018 08:31:50 +0000
reviewersme
bugs1454233
milestone61.0a1
Bug 1454233: Add a comment about why IsDocument() is the way it is. r=me MozReview-Commit-ID: LYkYnKF9M2c
dom/base/nsINode.h
--- a/dom/base/nsINode.h
+++ b/dom/base/nsINode.h
@@ -448,16 +448,17 @@ public:
     return IsElement() || IsText();
   }
 
   /**
    * Returns true if this is a document node.
    */
   bool IsDocument() const
   {
+    // One less pointer-chase than checking NodeType().
     return !GetParentNode() && IsInUncomposedDoc();
   }
 
   /**
    * Return this node as a document. Asserts IsDocument().
    *
    * This is defined inline in nsIDocument.h.
    */