Closed Bug 902363 Opened 11 years ago Closed 11 years ago

mozL10n.localize() may clear an entire element instead of just the first text node

Categories

(Firefox OS Graveyard :: Gaia::L10n, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: kaze, Assigned: kaze)

References

Details

Attachments

(1 file)

Consider the following paragraph:

  <p id="test"> This is a test <button>foo</button> </p>

This adds a `data-l10n-id="message"' attribute to #test and keeps the <button> element:

  mozL10n.localize(document.querySelector('#test'), 'message');

This should clear the `data-l10n-id="message"` attribute and the first text node:

  mozL10n.localize(document.querySelector('#test'), 'message');

but it also clears the <button> element, which is not expected.
Assignee: nobody → kaze
(In reply to Fabien Cazenave [:kaze] from comment #0)
> This should clear the `data-l10n-id="message"` attribute and the first text
> node:
> 
>   mozL10n.localize(document.querySelector('#test'), 'message');
> 
> but it also clears the <button> element, which is not expected.

Gosh, I need some PTO. *This* should clear the l10n-id attribute and the first text node:

>   mozL10n.localize(document.querySelector('#test'));

Sorry for the confusion (again).
Depends on: 882591
Comment on attachment 786830 [details]
link to pull request

comments on github

please ask me for review again once it's ready :)
Attachment #786830 - Flags: review?(felash)
Comment on attachment 786830 [details]
link to pull request

Comments addressed.
Attachment #786830 - Flags: review?(felash)
Blocks: 886715
Comment on attachment 786830 [details]
link to pull request

r=me with the last comment (that you can decide to keep or not)
Attachment #786830 - Flags: review?(felash) → review+
Merged on master:
https://github.com/mozilla-b2g/gaia/commit/e5154bdd600179bccf1931d0775354cddb31cf43
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Component: Gaia → Gaia::L10n
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: