script: Early return in CompareDocumentPosition to deindent most of the function.

Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
Emilio Cobos Álvarez 2017-08-17 09:48:29 +02:00
parent ee94e2b7c0
commit ccd469ce61
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -2365,8 +2365,9 @@ impl NodeMethods for Node {
fn CompareDocumentPosition(&self, other: &Node) -> u16 { fn CompareDocumentPosition(&self, other: &Node) -> u16 {
if self == other { if self == other {
// step 2. // step 2.
0 return 0
} else { }
let mut lastself = Root::from_ref(self); let mut lastself = Root::from_ref(self);
let mut lastother = Root::from_ref(other); let mut lastother = Root::from_ref(other);
for ancestor in self.ancestors() { for ancestor in self.ancestors() {
@ -2413,7 +2414,6 @@ impl NodeMethods for Node {
} }
unreachable!() unreachable!()
} }
}
// https://dom.spec.whatwg.org/#dom-node-contains // https://dom.spec.whatwg.org/#dom-node-contains
fn Contains(&self, maybe_other: Option<&Node>) -> bool { fn Contains(&self, maybe_other: Option<&Node>) -> bool {