Skip to content

Commit 10d969a

Browse files
author
Clemens Prerovsky
committed
fixed a bug in the ui that would not execute formatting if the wrong part of the button was clicked
1 parent de53f26 commit 10d969a

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

demo/aloha-bootstrap-ui/aloha-bootstrap-ui.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,21 @@
8080
*/
8181
function parseAction(element) {
8282
var action = {};
83-
var match = element.className.match(/aloha-action-(\w+)(-(\w+))?/);
83+
var match;
84+
85+
Dom.childAndParentsUntil(element, function (element) {
86+
if (element.className) {
87+
match = element.className.match(/aloha-action-(\w+)(-(\w+))?/);
88+
}
89+
if (match || Dom.hasClass(element, 'aloha-toolbar')) {
90+
return true;
91+
} else {
92+
return false;
93+
}
94+
});
8495

8596
if (match) {
97+
console.log(match[1], match[3]);
8698
action[match[1]] = match[3] || true;
8799
}
88100

src/dom/traversing.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,8 @@ define([
390390
/**
391391
* Starting with the given node, traverses up the given node's ancestors,
392392
* collecting each parent node, until the first ancestor that causes the
393-
* given predicate function to return true.
393+
* given predicate function to return true. The given node is *not* passed
394+
* to the predicate (@see childAndParents).
394395
*
395396
* @param {Node} node
396397
* @param {function(Node):boolean} pred

0 commit comments

Comments
 (0)