Without this fix, clicking element without direct text child element but
with children containing text nodes resulted in selecting this
child text element (while visual indication for the user was that the
requested element was selected).
if(byBrowser && byBrowser.parent().sameNode(nodeToLand)) {
return byBrowser;
}
- return e.getVerticallyFirstTextElement();
+ return e.getVerticallyFirstTextElement({considerChildren: false});
}.bind(this);
var _markAsCurrent = function(element) {
if(element instanceof documentElement.DocumentTextElement) {
return toret;
},
- getVerticallyFirstTextElement: function() {
+ getVerticallyFirstTextElement: function(params) {
var toret;
+
+ params = _.extend({
+ considerChildren: true
+ }, params);
+
this.children().some(function(child) {
if(child instanceof documentElement.DocumentTextElement) {
toret = child;
return true; // break
- } else {
+ } else if(params.considerChildren) {
toret = child.getVerticallyFirstTextElement();
if(toret) {
return true; // break