Fix:SvgImport apply attributes to item #1416

This commit is contained in:
sapics 2018-10-02 16:06:34 +09:00
parent 53897d7498
commit cce5b24e9a

View file

@ -496,7 +496,7 @@ new function() {
// First see if the given attribute is defined. // First see if the given attribute is defined.
var attr = node.attributes[name], var attr = node.attributes[name],
value = attr && attr.value; value = attr && attr.value;
if (!value) { if (!value && node.style) {
// Fallback to using styles. See if there is a style, either set // Fallback to using styles. See if there is a style, either set
// directly on the object or applied to it through CSS rules. // directly on the object or applied to it through CSS rules.
// We also need to filter out inheritance from their parents. // We also need to filter out inheritance from their parents.
@ -520,7 +520,6 @@ new function() {
* @param {Item} item the item to apply the style and attributes to * @param {Item} item the item to apply the style and attributes to
*/ */
function applyAttributes(item, node, isRoot) { function applyAttributes(item, node, isRoot) {
if (node.style) {
// SVG attributes can be set both as styles and direct node // SVG attributes can be set both as styles and direct node
// attributes, so we need to handle both. // attributes, so we need to handle both.
var parent = node.parentNode, var parent = node.parentNode,
@ -538,7 +537,6 @@ new function() {
item = value !== undefined item = value !== undefined
&& apply(item, value, name, node, styles) || item; && apply(item, value, name, node, styles) || item;
}); });
}
return item; return item;
} }