瀏覽代碼

:octocat: don't add empty class attributes

smiley 8 年之前
父節點
當前提交
c877a58c77
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      src/Output/QRMarkup.php

+ 3 - 1
src/Output/QRMarkup.php

@@ -94,7 +94,9 @@ class QRMarkup extends QROutputAbstract{
 					}
 					}
 					elseif($from >= 0){
 					elseif($from >= 0){
 						$svg .= '<rect x="'.($from * $this->options->scale).'" y="'.($y * $this->options->scale)
 						$svg .= '<rect x="'.($from * $this->options->scale).'" y="'.($y * $this->options->scale)
-						        .'" width="'.($this->options->scale * $count).'" height="'.$this->options->scale.'" class="'.$this->options->cssClass.'" fill="'.$value.'"/>'.$this->options->eol;
+						        .'" width="'.($this->options->scale * $count).'" height="'.$this->options->scale.'" fill="'.$value.'"'
+						        .(trim($this->options->cssClass) !== '' ? ' class="'.$this->options->cssClass.'"' :'').' />'
+						        .$this->options->eol;
 
 
 						// reset count
 						// reset count
 						$from  = -1;
 						$from  = -1;