protected function _compactBuffer($startPos, $endPos, $type) { $compactBuffer = array(); $before = static::kEndOfFileMarker; $html = $this->_SegmentedString->substr($startPos, $endPos - $startPos); foreach ($this->_buffer as $i => $state) { if ($before !== $state) { $before = $compactBuffer[$i] = $state; } } switch ($type) { case HTMLToken::Uninitialized: case HTMLToken::EndOfFile: case HTMLToken::Character: case HTMLToken::Comment: $this->_Token->setData($html); break; } if ($this->_debug) { $this->_Token->setHtmlOrigin($html); $this->_Token->setState($compactBuffer); } else { if ($type === HTMLToken::DOCTYPE) { $this->_Token->setHtmlOrigin($html); } } $this->_Token->clean(); }