wlxml: Node.find
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 6 Aug 2014 11:56:08 +0000 (13:56 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Thu, 14 Aug 2014 14:26:14 +0000 (16:26 +0200)
src/wlxml/wlxml.js

index cb43f07..40ab196 100644 (file)
@@ -106,6 +106,16 @@ $.extend(WLXMLElementNode.prototype, WLXMLDocumentNodeMethods, smartxml.ElementN
             return child.is(query);
         }.bind(this));
     },
+    find: function(query) {
+        var doc = this.document;
+        return this._$.find('*')
+            .map(function() {
+                return doc.createDocumentNode(this);
+            })
+            .filter(function() {
+                return this.is(query);
+            });
+    },
 
     _getXMLDOMToDump: function() {
         var DOM = this._$.clone(true, true),