From: aurium Date: Wed, 26 Aug 2009 15:32:53 +0000 (+0000) Subject: adding getElementById() to inkex X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8c4c85b9333c69d14cec9099eecbb4cc2dac2153;p=inkscape.git adding getElementById() to inkex --- diff --git a/share/extensions/inkex.py b/share/extensions/inkex.py index 2ae5d6c21..665575c6b 100755 --- a/share/extensions/inkex.py +++ b/share/extensions/inkex.py @@ -166,6 +166,14 @@ class Effect: for node in self.document.xpath(path, namespaces=NSS): self.selected[i] = node + def getElementById(self, id): + path = '//*[@id="%s"]' % id + el_list = self.document.xpath(path, namespaces=NSS) + if el_list: + return el_list[0] + else: + return None + def getdocids(self): docIdNodes = self.document.xpath('//@id', namespaces=NSS) for m in docIdNodes: