Skip to content

Commit 7c0b893

Browse files
committed
Added support for "data-html2canvas-ignore" attribute
1 parent 084bf4b commit 7c0b893

3 files changed

Lines changed: 14 additions & 12 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@
99
image.jpg
1010
/.project
1111
/.settings/
12+
node_modules/
1213
.envrc
14+
tests/selenium.js
1315
*.sublime-workspace

readme.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,33 @@ html2canvas
22
===========
33

44
#### JavaScript HTML renderer ####
5-
5+
66
This script allows you to take "screenshots" of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM and as such may not be 100% accurate to the real representation as it does not make an actual screenshot, but builds the screenshot based on the information available on the page.
77

88

99
###How does it work?###
10-
The script renders the current page as a canvas image, by reading the DOM and the different styles applied to the elements. However, as many elements are displayed differently on different browsers and operating systems (such as form elements such as radio buttons or checkboxes) as well as
10+
The script renders the current page as a canvas image, by reading the DOM and the different styles applied to the elements. However, as many elements are displayed differently on different browsers and operating systems (such as form elements such as radio buttons or checkboxes) as well as
1111

12-
It does <b>not require any rendering from the server</b>, as the whole image is created on the <b>clients browser</b>. However, for browsers without <code>canvas</code> support alternatives such as <a href="http://flashcanvas.net/">flashcanvas</a> or <a href="http://excanvas.sourceforge.net/">ExplorerCanvas</a> are necessary to create the image.
12+
It does <b>not require any rendering from the server</b>, as the whole image is created on the <b>clients browser</b>. However, for browsers without <code>canvas</code> support alternatives such as <a href="http://flashcanvas.net/">flashcanvas</a> or <a href="http://excanvas.sourceforge.net/">ExplorerCanvas</a> are necessary to create the image.
1313

1414
Additionally, to render <code>iframe</code> content or images situated outside of the <a href="http://en.wikipedia.org/wiki/Same_origin_policy">same origin policy</a> a proxy will be necessary to load the content to the users browser.
1515

1616
The script is still in a very experimental state, so I don't recommend using it in a production environment nor start building applications with it yet, as there will be still major changes made. However, please do test it out and report your findings, especially if something should be working, but is displaying it incorrectly.
17-
17+
1818
###Browser compatibility###
1919

2020
The script should work fine on the following browsers:
2121

2222
* Firefox 3.5+
23-
* Google Chrome
23+
* Google Chrome
2424
* Newer versions of Opera (exactly how new is yet to be determined)
2525
* >=IE9 (Older versions compatible with the use of flashcanvas)
26-
26+
2727
Note that the compatibility will most likely be increased in future builds, as many of the current restrictions have at least partial work arounds, which can be used with older browser versions.
2828

2929
###So what isn't included yet?###
30-
31-
There are still a lot of CSS properties missing, including most CSS3 properties such as <code>text-shadow</code>, <code>box-radius</code> etc. as well as all elements created by the browser, such as radio and checkbox buttons and list icons. I will compile a full list of supported elements and CSS properties soon.
30+
31+
There are still a lot of CSS properties missing, including most CSS3 properties such as <code>text-shadow</code>, <code>box-radius</code> etc. as well as all elements created by the browser, such as radio and checkbox buttons and list icons. I will compile a full list of supported elements and CSS properties soon.
3232
There is no support for <code>frame</code> and <code>object</code> content such as Flash.
3333

3434
### Usage ###
@@ -39,13 +39,13 @@ To access the created canvas, provide the `onrendered` event in the options whic
3939

4040
html2canvas( [ document.body ], {
4141
onrendered: function( canvas ) {
42-
/* canvas is the actual canvas element,
43-
to append it to the page call for example
42+
/* canvas is the actual canvas element,
43+
to append it to the page call for example
4444
document.body.appendChild( canvas );
4545
*/
4646
}
4747
});
48-
48+
4949

5050
### Examples ###
5151

src/Parse.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,7 @@ _html2canvas.Parse = function ( images, options ) {
12711271
function parseElement (el, stack) {
12721272

12731273
// skip hidden elements and their children
1274-
if (getCSS(el, 'display') !== "none" && getCSS(el, 'visibility') !== "hidden") {
1274+
if (getCSS(el, 'display') !== "none" && getCSS(el, 'visibility') !== "hidden" && !el.hasAttribute("data-html2canvas-ignore")) {
12751275

12761276
stack = renderElement(el, stack) || stack;
12771277

0 commit comments

Comments
 (0)