@@ -75,7 +75,8 @@ _html2canvas.Util.getCSS = function (el, attribute) {
7575
7676 // If we're not dealing with a regular pixel number
7777 // but a number that has a weird ending, we need to convert it to pixels
78- if ( ! / ^ - ? \d + (?: p x ) ? $ / i. test ( val ) && / ^ - ? \d / . test ( val ) ) {
78+
79+ if ( ! / ^ - ? [ 0 - 9 ] + \. ? [ 0 - 9 ] * (?: p x ) ? $ / i. test ( val ) && / ^ - ? \d / . test ( val ) ) {
7980
8081 // Remember the original values
8182 left = style . left ;
@@ -94,7 +95,13 @@ _html2canvas.Util.getCSS = function (el, attribute) {
9495 }
9596
9697 }
98+
99+ if ( ! / ^ ( t h i n | m e d i u m | t h i c k ) $ / i. test ( val ) ) {
100+ return Math . round ( parseFloat ( val ) ) + "px" ;
101+ }
102+
97103 return val ;
104+
98105 }
99106
100107
@@ -104,7 +111,7 @@ _html2canvas.Util.getCSS = function (el, attribute) {
104111 if ( attribute === "backgroundPosition" ) {
105112
106113 val = ( val . split ( "," ) [ 0 ] || "0 0" ) . split ( " " ) ;
107-
114+
108115 val [ 0 ] = ( val [ 0 ] . indexOf ( "%" ) === - 1 ) ? toPX ( attribute + "X" , val [ 0 ] ) : val [ 0 ] ;
109116 val [ 1 ] = ( val [ 1 ] === undefined ) ? val [ 0 ] : val [ 1 ] ; // IE 9 doesn't return double digit always
110117 val [ 1 ] = ( val [ 1 ] . indexOf ( "%" ) === - 1 ) ? toPX ( attribute + "Y" , val [ 1 ] ) : val [ 1 ] ;
@@ -114,8 +121,7 @@ _html2canvas.Util.getCSS = function (el, attribute) {
114121 // IE 9>
115122 if ( attribute === "backgroundPosition" ) {
116123 // Older IE uses -x and -y
117- val = [ toPX ( attribute + "X" , el . currentStyle [ attribute + "X" ] ) , toPX ( attribute + "Y" , el . currentStyle [ attribute + "X" ] ) ] ;
118-
124+ val = [ toPX ( attribute + "X" , el . currentStyle [ attribute + "X" ] ) , toPX ( attribute + "Y" , el . currentStyle [ attribute + "Y" ] ) ] ;
119125 } else {
120126
121127 val = toPX ( attribute , el . currentStyle [ attribute ] ) ;
@@ -212,8 +218,9 @@ _html2canvas.Util.Children = function(el) {
212218 // $(el).contents() !== el.childNodes, Opera / IE have issues with that
213219 var children ;
214220 try {
215- children = $ ( el ) . contents ( ) ;
216- // children = (el.nodeName && el.nodeName.toUpperCase() === "IFRAME") ? el.contentDocument || el.contentWindow.document : Array.prototype.push.call([], el.childNodes );
221+ // children = $(el).contents();
222+ children = ( el . nodeName && el . nodeName . toUpperCase ( ) === "IFRAME" ) ? el . contentDocument || el . contentWindow . document : el . childNodes ;
223+
217224 } catch ( ex ) {
218225 h2clog ( "html2canvas.Util.Children failed with exception: " + ex . message ) ;
219226 children = [ ] ;
0 commit comments