mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
fully remove regex; simplify whitespace check
jshint complained about case statements w/o break (boo)
This commit is contained in:
parent
b81d7473e3
commit
7f1cbc70a8
13
src/Core.js
13
src/Core.js
@ -32,7 +32,7 @@ _html2canvas.Util.backgroundImage = function (src) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
_html2canvas.Util.parseBackgroundImage = function (value) {
|
_html2canvas.Util.parseBackgroundImage = function (value) {
|
||||||
var rxBackgroundImage = /([a-z\-]+)\((("[^"]+)|([^)]+))\)/i,
|
var whitespace = ' \r\n\t',
|
||||||
method, definition, prefix, prefix_i, block, results = [],
|
method, definition, prefix, prefix_i, block, results = [],
|
||||||
c, mode = 0, numParen = 0;
|
c, mode = 0, numParen = 0;
|
||||||
|
|
||||||
@ -62,15 +62,10 @@ _html2canvas.Util.parseBackgroundImage = function (value) {
|
|||||||
appendResult();
|
appendResult();
|
||||||
for(var i = 0, ii = value.length; i<ii; i++) {
|
for(var i = 0, ii = value.length; i<ii; i++) {
|
||||||
c = value[i];
|
c = value[i];
|
||||||
|
if(mode === 0 && whitespace.indexOf( c ) > -1){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
switch(c) {
|
switch(c) {
|
||||||
case ' ':
|
|
||||||
case '\t':
|
|
||||||
case '\n':
|
|
||||||
case '\r':
|
|
||||||
if(mode == 0){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
case '(':
|
case '(':
|
||||||
if(mode === 0) {
|
if(mode === 0) {
|
||||||
mode = 1;
|
mode = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user