add helpers
This commit is contained in:
parent
91b07f9cc7
commit
d7bb32b760
6 changed files with 76 additions and 110 deletions
|
@ -1,20 +1,7 @@
|
|||
define(['itemShortcuts', 'connectionManager', 'layoutManager', 'browser', 'registerElement'], function (itemShortcuts, connectionManager, layoutManager, browser) {
|
||||
define(['itemShortcuts', 'connectionManager', 'layoutManager', 'browser', 'dom', 'registerElement'], function (itemShortcuts, connectionManager, layoutManager, browser, dom) {
|
||||
|
||||
var ItemsContainerProtoType = Object.create(HTMLDivElement.prototype);
|
||||
|
||||
function parentWithAttribute(elem, name) {
|
||||
|
||||
while (!elem.getAttribute(name)) {
|
||||
elem = elem.parentNode;
|
||||
|
||||
if (!elem || !elem.getAttribute) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return elem;
|
||||
}
|
||||
|
||||
function onClick(e) {
|
||||
|
||||
var itemsContainer = this;
|
||||
|
@ -35,7 +22,7 @@
|
|||
var itemsContainer = this;
|
||||
|
||||
var target = e.target;
|
||||
var card = parentWithAttribute(target, 'data-id');
|
||||
var card = dom.parentWithAttribute(target, 'data-id');
|
||||
|
||||
if (card) {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue