function translateFragment(element) {
element = element || document.documentElement;
// check all translatable children (= w/ a `data-l10n-id' attribute)
var children = getTranslatableChildren(element);
var elementCount = children.length;
for (var i = 0; i < elementCount; i++) {
translateElement(children[i]);
}
// translate element itself if necessary
translateElement(element);
}
in webL10n should be able to translate a documentFragment, I think, and is exposed as translate in the public API.
But the last call to translateElement(element) fails in such a case as it is not possible to getAttributes of a documentFragment. What about encapsulating it in a test to not call it on documentFragment elements?
Hi,
The function
in webL10n should be able to translate a documentFragment, I think, and is exposed as
translate
in the public API.But the last call to
translateElement(element)
fails in such a case as it is not possible togetAttributes
of a documentFragment. What about encapsulating it in a test to not call it on documentFragment elements?