Skip to content
This repository has been archived by the owner on Mar 6, 2019. It is now read-only.

Commit

Permalink
adding objects to document list
Browse files Browse the repository at this point in the history
  • Loading branch information
shancarter committed Sep 24, 2014
1 parent b30820e commit dd3629b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
15 changes: 13 additions & 2 deletions svg-crowbar-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
function initialize() {
var documents = [window.document],
SVGSources = [];
iframes = document.querySelectorAll("iframe");
iframes = document.querySelectorAll("iframe"),
objects = document.querySelectorAll("object");

// add empty svg element
var emptySvg = window.document.createElementNS(prefix.svg, 'svg');
Expand All @@ -34,6 +35,16 @@
}
});

[].forEach.call(objects, function(el) {
try {
if (el.contentDocument) {
documents.push(el.contentDocument);
}
} catch(err) {
console.log(err)
}
});

documents.forEach(function(doc) {
var newSources = getSources(doc, emptySvgDeclarationComputed);
// because of prototype on NYT pages
Expand Down Expand Up @@ -198,7 +209,7 @@


function setInlineStyles(svg, emptySvgDeclarationComputed) {

function explicitlySetStyle (element) {
var cSSStyleDeclarationComputed = getComputedStyle(element);
var i, len, key, value;
Expand Down
15 changes: 13 additions & 2 deletions svg-crowbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
function initialize() {
var documents = [window.document],
SVGSources = [];
iframes = document.querySelectorAll("iframe");
iframes = document.querySelectorAll("iframe"),
objects = document.querySelectorAll("object");

[].forEach.call(iframes, function(el) {
try {
Expand All @@ -28,6 +29,16 @@
}
});

[].forEach.call(objects, function(el) {
try {
if (el.contentDocument) {
documents.push(el.contentDocument);
}
} catch(err) {
console.log(err)
}
});

documents.forEach(function(doc) {
var styles = getStyles(doc);
var newSources = getSources(doc, styles);
Expand Down Expand Up @@ -230,4 +241,4 @@
return styles;
}

})();
})();

0 comments on commit dd3629b

Please sign in to comment.