summaryrefslogtreecommitdiff
path: root/Cydia.app/menes/menes.js
diff options
context:
space:
mode:
Diffstat (limited to 'Cydia.app/menes/menes.js')
-rw-r--r--Cydia.app/menes/menes.js45
1 files changed, 36 insertions, 9 deletions
diff --git a/Cydia.app/menes/menes.js b/Cydia.app/menes/menes.js
index 70c5c47..2ca5d7d 100644
--- a/Cydia.app/menes/menes.js
+++ b/Cydia.app/menes/menes.js
@@ -190,19 +190,46 @@ $.prototype = {
});
},
- append: function (html) {
+ append: function (children) {
+ if ($.type(children) == "string")
+ $.each(this, function (node) {
+ var doc = $.document(node);
+
+ // XXX: implement wrapper system
+ var div = doc.createElement("div");
+ div.innerHTML = children;
+
+ while (div.childNodes.length != 0) {
+ var child = div.childNodes[0];
+ node.appendChild(child);
+ }
+ });
+ else
+ $.each(this, function (node) {
+ $.each(children, function (child) {
+ node.appendChild(child);
+ });
+ });
+ },
+
+ xpath: function (expression) {
+ var value = $([]);
+
$.each(this, function (node) {
var doc = $.document(node);
+ var results = doc.evaluate(expression, node, null, XPathResult.ANY_TYPE, null);
+ var result;
+ while (result = results.iterateNext())
+ value.add([result]);
+ });
- // XXX: implement wrapper system
- var div = doc.createElement("div");
- div.innerHTML = html;
+ return value;
+ },
- while (div.childNodes.length != 0) {
- var child = div.childNodes[0];
- node.appendChild(child);
- }
- });
+ clone: function (deep) {
+ return $($.map(this, function (node) {
+ return node.cloneNode(deep);
+ }));
},
descendants: function (expression) {