Skip to content

Commit ac53190

Browse files
committed
Merge pull request html-dnd#10 from sunyatasattva/allow-xpath
Allows the usage of XPath selectors to target elements
2 parents 68af6b4 + ff4ad63 commit ac53190

File tree

6 files changed

+138
-2
lines changed

6 files changed

+138
-2
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test/e2e/assets/*.js

lib/index.js

100644100755
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,23 @@ exports.code = util.format(multiline(function() {/*
1717
exports.codeForSelectors = util.format(multiline(function() {/*
1818
(function(selectorDraggable, selectorDroppable) {
1919
%s;
20+
2021
var draggable = document.querySelector(selectorDraggable);
2122
var droppable = document.querySelector(selectorDroppable);
23+
2224
dnd.simulate(draggable, droppable);
2325
})(arguments[0], arguments[1]);
2426
*/}), coreCode);
27+
28+
exports.codeForXPaths = util.format(multiline(function() {/*
29+
(function(selectorDraggable, selectorDroppable) {
30+
%s;
31+
32+
var draggable = document.evaluate(selectorDraggable, document, null,
33+
XPathResult.ORDERED_NODE_ITERATOR_TYPE, null).iterateNext();
34+
var droppable = document.evaluate(selectorDroppable, document, null,
35+
XPathResult.ORDERED_NODE_ITERATOR_TYPE, null).iterateNext();
36+
37+
dnd.simulate(draggable, droppable);
38+
})(arguments[0], arguments[1]);
39+
*/}), coreCode);

0 commit comments

Comments
 (0)