function runFilter(PHPTAL_Dom_Element $el)
 {
     $f = new PHPTAL_PreFilter_Normalize();
     // assertNull checks for "void" functions
     $this->assertNull($f->setPHPTAL($this->newPHPTAL()));
     $this->assertNull($f->filterDOM($el));
 }
Exemple #2
0
 /**
  * Consistent sorting of attributes might give slightly better gzip performance
  */
 protected function normalizeAttributes(PHPTAL_Dom_Element $element)
 {
     parent::normalizeAttributes($element);
     $attrs_by_qname = array();
     foreach ($element->getAttributeNodes() as $attrnode) {
         // safe, as there can't be two attrs with same qname
         $attrs_by_qname[$attrnode->getQualifiedName()] = $attrnode;
     }
     if (count($attrs_by_qname) > 1) {
         uksort($attrs_by_qname, array($this, 'compareQNames'));
         $element->setAttributeNodes(array_values($attrs_by_qname));
     }
 }