Include webodf-specified formatting properties by default

Every existing use of this function will return better data if the system
defaults are included.
This commit is contained in:
Philip Peitsch
2014-01-24 18:12:08 +11:00
parent bce2aba230
commit 030df7432b
+4 -6
View File
@@ -310,7 +310,7 @@ odf.Formatting = function Formatting() {
* Returns a JSON representation of the style attributes of a given style element, also containing attributes
* inherited from it's ancestry - up to and including the default style for the family.
* @param {!Element} styleNode
* @param {!boolean=} includeSystemDefault
* @param {!boolean=} includeSystemDefault True by default. Specify false to suppress inclusion of system defaults
* @return {!Object.<string,!Object.<string,string>>}
*/
function getInheritedStyleAttributes(styleNode, includeSystemDefault) {
@@ -344,12 +344,10 @@ odf.Formatting = function Formatting() {
}
// Last incorporate attributes from the built-in default style
if (includeSystemDefault) {
if (includeSystemDefault !== false) {
propertiesMap = getSystemDefaultStyleAttributes(styleFamily);
if (propertiesMap) {
// All child properties should override any matching parent properties
inheritedPropertiesMap = utils.mergeObjects(propertiesMap, inheritedPropertiesMap);
}
// All child properties should override any matching parent properties
inheritedPropertiesMap = utils.mergeObjects(propertiesMap, inheritedPropertiesMap);
}
return inheritedPropertiesMap;