code: public function attrVal($default = null, $escape = true)
      {
          $val = $this->str($default, false);
          return $escape && $this->escaper ? $this->escaper->escapeHtmlAttr($val) : $val;
      }
docs: Returns val() as an escaped string that can be used inside HTML element attributes.
  
  @param mixed $default
  @param bool $escape
  @return string