Skip to content

Commit

Permalink
searche matches on all textNodes, not only first child
Browse files Browse the repository at this point in the history
  • Loading branch information
docteurklein committed Oct 5, 2015
1 parent 0a35069 commit 9378714
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Resources/public/js/translator.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,17 @@ Knp.Translator = Ext.extend(Ext.util.Observable, {
var self = this;

// node content
if(node.firstChild !== null && node.firstChild.nodeType === 3) { // Node.TEXT_NODE === 3
var content = node.firstChild.nodeValue;
var result = this.checkTranslatableText(content, node);
if(false !== result) {
node.firstChild.nodeValue = result;
Ext.each(node.childNodes, function(childNode) {
if(childNode.nodeType === 3) {
var content = childNode.nodeValue;
var result = self.checkTranslatableText(content, node);
if(false !== result) {
childNode.nodeValue = result;
}
}
}
});

// node attributes
var matched = false;
Ext.each(node.attributes, function(attribute) {
var result = self.checkTranslatableText(attribute.value, node);
if(false !== result) {
Expand Down

0 comments on commit 9378714

Please sign in to comment.