On 10/15/13 17:35, Friedrich wrote:
> In webodf/lib/odf/OdfContainer.js:
>
>> +                        // skip it if the declarations are equal, otherwise insert with a new, unused name
>> +                        if (!n.isEqualNode(targetFontFaceDeclsMap[fontFaceName]) ){
>> +                            newFontFaceName = unusedKey(fontFaceName, targetFontFaceDeclsMap, sourceFontFaceDeclsMap);
>> +                            n.setAttributeNS(stylens, "style:name", newFontFaceName);
>> +                            // copy with a new name
>> +                            targetFontFaceDeclsRootElement.appendChild(n);
>> +                            targetFontFaceDeclsMap[newFontFaceName] = /**@type{!Element}*/(n);
>> +                            delete sourceFontFaceDeclsMap[fontFaceName];
>> +                            // note name change
>> +                            fontFaceNameChangeMap[fontFaceName] = newFontFaceName;
>> +                        }
>> +                    } else {
>> +                        // move over
>> +                        // perhaps one day it could also be checked if there is an equal declaration
>> +                        // with a different name, but that has yet to be seen in real life
>> +                        targetFontFaceDeclsRootElement.appendChild(n);
>
> There is a tiny diff:
> targetFontFaceDeclsMap[newFontFaceName] = /*@type
> <https://github.com/type>{!Element}*/(n);
> vs.
> targetFontFaceDeclsMap[fontFaceName] = /*@type
> <https://github.com/type>{!Element}*/(n);
>
> Also the first clause has another additional guard, so the other two
> commands are not in any case.
>
> Duplicating seems the easiest code, but perhaps there is a better
> pattern for this?

Indeed, it's not exactly equal. This is fine then. I got code blindness.
So it's good to merge now.

Cheers,
Jos