From 92375857256ea0b3102f9b42fefe71a3cc1c1015 Mon Sep 17 00:00:00 2001 From: surikat Date: Tue, 26 Jan 2016 16:44:05 +0100 Subject: [PATCH] add getAncestor method --- Markup.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Markup.php b/Markup.php index c43d152..9f69d82 100644 --- a/Markup.php +++ b/Markup.php @@ -1518,5 +1518,13 @@ function __clone(){ } } } + function getAncestor(){ + $ancestor = $this; + do{ + $ancestor = $ancestor->parent; + } + while($ancestor->parent); + return $ancestor; + } } Markup::initialize(); \ No newline at end of file