← All changes
|
vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php
+8
-10
3.0.0
→
3.2.90
View file →
| @@ -1,10 +1,10 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -namespace WindPressPackages\Masterminds\HTML5\Parser; | |
| 3 | +namespace WindPressDeps\Masterminds\HTML5\Parser; | |
| 4 | 4 | |
| 5 | -use WindPressPackages\Masterminds\HTML5\Elements; | |
| 6 | -use WindPressPackages\Masterminds\HTML5\InstructionProcessor; | |
| 5 | +use WindPressDeps\Masterminds\HTML5\Elements; | |
| 6 | +use WindPressDeps\Masterminds\HTML5\InstructionProcessor; | |
| 7 | 7 | /** |
| 8 | 8 | * Create an HTML5 DOM tree from events. |
| 9 | 9 | * |
| 10 | 10 | * This attempts to create a DOM from events emitted by a parser. This |
| @@ -120,9 +120,9 @@ | ||
| 120 | 120 | // documents, and attempting to up-convert any older DTDs to HTML5. |
| 121 | 121 | $dt = $impl->createDocumentType('html'); |
| 122 | 122 | // $this->doc = \DOMImplementation::createDocument(NULL, 'html', $dt); |
| 123 | 123 | $this->doc = $impl->createDocument(null, '', $dt); |
| 124 | - $this->doc->encoding = (!empty($options['encoding'])) ? $options['encoding'] : 'UTF-8'; | |
| 124 | + $this->doc->encoding = !empty($options['encoding']) ? $options['encoding'] : 'UTF-8'; | |
| 125 | 125 | } |
| 126 | 126 | $this->errors = array(); |
| 127 | 127 | $this->current = $this->doc; |
| 128 | 128 | // ->documentElement; |
| @@ -167,10 +167,8 @@ | ||
| 167 | 167 | * Provide an instruction processor. |
| 168 | 168 | * |
| 169 | 169 | * This is used for handling Processor Instructions as they are |
| 170 | 170 | * inserted. If omitted, PI's are inserted directly into the DOM tree. |
| 171 | - * | |
| 172 | - * @param InstructionProcessor $proc | |
| 173 | 171 | */ |
| 174 | 172 | public function setInstructionProcessor(InstructionProcessor $proc) |
| 175 | 173 | { |
| 176 | 174 | $this->processor = $proc; |
| @@ -287,9 +285,9 @@ | ||
| 287 | 285 | } |
| 288 | 286 | try { |
| 289 | 287 | $prefix = ($pos = strpos($lname, ':')) ? substr($lname, 0, $pos) : ''; |
| 290 | 288 | if (\false !== $needsWorkaround) { |
| 291 | - $xml = "<{$lname} xmlns=\"{$needsWorkaround}\" " . ((strlen($prefix) && isset($this->nsStack[0][$prefix])) ? "xmlns:{$prefix}=\"" . $this->nsStack[0][$prefix] . '"' : '') . '/>'; | |
| 289 | + $xml = "<{$lname} xmlns=\"{$needsWorkaround}\" " . (strlen($prefix) && isset($this->nsStack[0][$prefix]) ? "xmlns:{$prefix}=\"" . $this->nsStack[0][$prefix] . '"' : '') . '/>'; | |
| 292 | 290 | $frag = new \DOMDocument('1.0', 'UTF-8'); |
| 293 | 291 | $frag->loadXML($xml); |
| 294 | 292 | $ele = $this->doc->importNode($frag->documentElement, \true); |
| 295 | 293 | } else if (!isset($this->nsStack[0][$prefix]) || '' === $prefix && isset($this->options[self::OPT_DISABLE_HTML_NS]) && $this->options[self::OPT_DISABLE_HTML_NS]) { |
| @@ -307,11 +305,11 @@ | ||
| 307 | 305 | // When we add some namespacess, we have to track them. Later, when "endElement" is invoked, we have to remove them. |
| 308 | 306 | // When we are on a void tag, we do not need to care about namesapce nesting. |
| 309 | 307 | if ($pushes > 0 && !Elements::isA($name, Elements::VOID_TAG)) { |
| 310 | 308 | // PHP tends to free the memory used by DOM, |
| 311 | - // to avoid spl_object_hash collisions whe have to avoid garbage collection of $ele storing it into $pushes | |
| 309 | + // to avoid spl_object_id collisions we have to avoid garbage collection of $ele storing it into $pushes | |
| 312 | 310 | // see https://bugs.php.net/bug.php?id=67459 |
| 313 | - $this->pushes[spl_object_hash($ele)] = array($pushes, $ele); | |
| 311 | + $this->pushes[spl_object_id($ele)] = array($pushes, $ele); | |
| 314 | 312 | } |
| 315 | 313 | foreach ($attributes as $aName => $aVal) { |
| 316 | 314 | // xmlns attributes can't be set |
| 317 | 315 | if ('xmlns' === $aName) { |
| @@ -402,9 +400,9 @@ | ||
| 402 | 400 | // Special case handling for SVG. |
| 403 | 401 | if ($this->insertMode === static::IM_IN_SVG) { |
| 404 | 402 | $lname = Elements::normalizeSvgElement($lname); |
| 405 | 403 | } |
| 406 | - $cid = spl_object_hash($this->current); | |
| 404 | + $cid = spl_object_id($this->current); | |
| 407 | 405 | // XXX: HTML has no parent. What do we do, though, |
| 408 | 406 | // if this element appears in the wrong place? |
| 409 | 407 | if ('html' === $lname) { |
| 410 | 408 | return; |