mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
parent
19c7788617
commit
cc29cab671
2 changed files with 10 additions and 4 deletions
|
@ -95,7 +95,9 @@ var DomElement = new function() {
|
|||
},
|
||||
|
||||
getStyles: function(el) {
|
||||
var view = el && el.ownerDocument.defaultView;
|
||||
// If el is a document (nodeType == 9), use it directly
|
||||
var doc = el && el.nodeType !== 9 ? el.ownerDocument : el,
|
||||
view = doc && doc.defaultView;
|
||||
return view && view.getComputedStyle(el, '');
|
||||
},
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ new function() {
|
|||
for (var i = 0, l = nodes.length; i < l; i++) {
|
||||
var childNode = nodes[i],
|
||||
child;
|
||||
if (childNode.nodeType == 1 && (child = importSVG(childNode))) {
|
||||
if (childNode.nodeType === 1 && (child = importSVG(childNode))) {
|
||||
// When adding CompoundPaths to other CompoundPaths,
|
||||
// we need to "unbox" them first:
|
||||
if (clip && child instanceof CompoundPath) {
|
||||
|
@ -148,7 +148,7 @@ new function() {
|
|||
stops = [];
|
||||
for (var i = 0, l = nodes.length; i < l; i++) {
|
||||
var child = nodes[i];
|
||||
if (child.nodeType == 1)
|
||||
if (child.nodeType === 1)
|
||||
stops.push(applyAttributes(new GradientStop(), child));
|
||||
}
|
||||
var isRadial = type === 'radialgradient',
|
||||
|
@ -172,6 +172,10 @@ new function() {
|
|||
// NOTE: All importers are lowercase, since jsdom is using uppercase
|
||||
// nodeNames still.
|
||||
var importers = {
|
||||
'#document': function(node) {
|
||||
return importSVG(node.childNodes[0]);
|
||||
},
|
||||
|
||||
// http://www.w3.org/TR/SVG/struct.html#Groups
|
||||
g: importGroup,
|
||||
// http://www.w3.org/TR/SVG/struct.html#NewDocument
|
||||
|
@ -486,7 +490,7 @@ new function() {
|
|||
var type = node.nodeName.toLowerCase(),
|
||||
importer = importers[type],
|
||||
item = importer && importer(node, type),
|
||||
data = node.getAttribute('data-paper-data');
|
||||
data = type !== '#document' && node.getAttribute('data-paper-data');
|
||||
// See importGroup() for an explanation of this filtering:
|
||||
if (item && !(item instanceof Group))
|
||||
item = applyAttributes(item, node);
|
||||
|
|
Loading…
Reference in a new issue