Comment nodes shouldn't be considered for translation

VERIFIED FIXED in Firefox 32

Status

()

defect
VERIFIED FIXED
5 years ago
5 years ago

People

(Reporter: Felipe, Assigned: Felipe)

Tracking

Trunk
Firefox 32
Points:
---
Dependency tree / graph
Bug Flags:
firefox-backlog +

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [translation] p=1 s=it-32c-31a-30b.2 [qa-])

Attachments

(1 attachment)

Comment nodes are nsGenericDOMDataNodes with textual content, so they were returning true for HasTextForTranslation, but that should be obviously false. (More generally, any non-text node).

This was not causing any problems in the translation itself, and they are already replaced with placeholders in a later step of the process. However, it causes otherwise-empty nodes to be unnecessarily considered for translation. E.g:

<div><!-- Comment --></div>

Which would be sent to the translation service as "<div><br></div>", while it doesn't need to be sent at all.
Attachment #8428193 - Flags: review?(bugs)
Flags: firefox-backlog+
Comment on attachment 8428193 [details] [diff] [review]
Comment nodes shouldn't be considered for translation

Hmm, this is a bit too strict.
CDATA nodes are filtered out.
So

CDATA_SECTION_NODE
if (NodeType() != nsIDOMNode::TEXT_NODE && NodeType() != nsIDOMNode::CDATA_SECTION_NOD) {
Attachment #8428193 - Flags: review?(bugs) → review+
Marco, please add this bug to the current iteration
Whiteboard: [translation] p=1 [qa-]
Flags: needinfo?(mmucci)
Added to Iteration 32.2
Flags: needinfo?(mmucci)
Whiteboard: [translation] p=1 [qa-] → [translation] p=1 s=it-32c-31a-30b.2 [qa-]
https://hg.mozilla.org/mozilla-central/rev/a311f34398c2
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 32
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.