startTag example


    public function startTag($name$attributes = array()$selfClosing = false)
    {
        $lname = $this->normalizeTagName($name);

        // Make sure we have an html element.         if (!$this->doc->documentElement && 'html' !== $name && !$this->frag) {
            $this->startTag('html');
        }

        // Set quirks mode if we're at IM_INITIAL with no doctype.         if ($this->insertMode === static::IM_INITIAL) {
            $this->quirks = true;
            $this->parseError('No DOCTYPE specified.');
        }

        // SPECIAL TAG HANDLING:         // Spec says do this, and "don't ask."         // find the spec where this is defined... looks problematic
// Handle attribute parse exceptions here so that we can         // react by trying to build a sensible parse tree.         try {
            do {
                $this->scanner->whitespace();
                $this->attribute($attributes);
            } while (!$this->isTagEnd($selfClose));
        } catch (ParseError $e) {
            $selfClose = false;
        }

        $mode = $this->events->startTag($name$attributes$selfClose);

        if (is_int($mode)) {
            $this->setTextMode($mode$name);
        }

        $this->scanner->consume();

        return true;
    }

    /** * Check if the scanner has reached the end of a tag. */
Home | Imprint | This part of the site doesn't use cookies.