Skip to content

Commit 877367d

Browse files
committed
Merge branch 'arrix-child_textnodes' into develop
2 parents a7d3e9c + fd888bd commit 877367d

3 files changed

Lines changed: 30 additions & 3 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ server.js
1616
chromedriver.log
1717
*.baseline
1818
*.iml
19-
.idea/
19+
.idea/
20+
.DS_Store

src/Parse.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,8 +1077,12 @@ _html2canvas.Parse = function (images, options) {
10771077
function init() {
10781078
var stack = renderElement(element, null);
10791079

1080-
Array.prototype.slice.call(element.children, 0).forEach(function(childElement) {
1081-
parseElement(childElement, stack);
1080+
_html2canvas.Util.Children(element).forEach(function(node) {
1081+
if (node.nodeType === 1) {
1082+
parseElement(node, stack);
1083+
} else if (node.nodeType === 3) {
1084+
renderText(element, node, stack);
1085+
}
10821086
});
10831087

10841088
stack.backgroundColor = getCSS(document.documentElement, "backgroundColor");

tests/cases/child-textnodes.html

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Inline text in the top element</title>
5+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
6+
<script type="text/javascript" src="../test.js"></script>
7+
<style>
8+
span {
9+
color:blue;
10+
}
11+
p {
12+
background-color: green;
13+
}
14+
</style>
15+
16+
</head>
17+
<body>
18+
Some inline text <span> followed by text in span </span> followed by more inline text.
19+
<p>Then a block level element.</p>
20+
Then more inline text.
21+
</body>
22+
</html>

0 commit comments

Comments
 (0)