Browse Source

Partial fixes for adoption agency

ns
J. King 3 years ago
parent
commit
fd01acfa5c
  1. 7
      lib/TreeBuilder.php
  2. 4
      tests/cases/TestTreeConstructor.php

7
lib/TreeBuilder.php

@ -3423,7 +3423,6 @@ class TreeBuilder {
$this->activeFormattingElementsList->removeSame($formattingElement);
return;
}
throw new NotImplementedException("NOT IMPLEMENTED");
# Let common ancestor be the element immediately above formatting element
# in the stack of open elements.
$commonAncestor = $this->stack[$stackIndex - 1] ?? null;
@ -3457,7 +3456,7 @@ class TreeBuilder {
# list of active formatting elements.
$nodeListPos = $this->activeFormattingElementsList->findSame($node);
if ($innerLoopCounter > 3 && $nodeListPos > -1) {
unset($this->activeFormattingElementsList[$nodeListPos]);
$this->activeFormattingElementsList->removeSame($node);
if ($bookmark > $nodeListPos) {
$bookmark--;
}
@ -3477,7 +3476,7 @@ class TreeBuilder {
# replace the entry for node in the stack of open elements with
# an entry for the new element, and let node be the new element.
$nodeToken = $this->activeFormattingElementsList[$nodeListPos]['token'];
$element = $this->createElementForToken($token, null, $commonAncestor);
$element = $this->createElementForToken($nodeToken, null, $commonAncestor);
$this->activeFormattingElementsList[$nodeListPos] = ['token' => $nodeToken, 'element' => $element];
$this->stack[$nodeIndex] = $element;
$node = $element;
@ -3522,7 +3521,7 @@ class TreeBuilder {
# elements, and insert the new element into the list of active
# formatting elements at the position of the aforementioned bookmark.
$this->activeFormattingElementsList->insert($formattingToken, $element, $bookmark);
unset($this->activeFormattingElementsList[$formattingElementIndex]);
$this->activeFormattingElementsList->removeSame($formattingElement);
# Remove formatting element from the stack of open elements, and
# insert the new element into the stack of open elements
# immediately below the position of furthest block in that stack.

4
tests/cases/TestTreeConstructor.php

@ -266,7 +266,7 @@ class TestTreeConstructor extends \PHPUnit\Framework\TestCase {
}
if (!$script) {
// scripting-dependent tests are skipped entirely since we will not support scripting
yield "$file #$index (line $pos)" => [$data, $exp, $errors, $fragment];
yield basename($file)." #$index (line $pos)" => [$data, $exp, $errors, $fragment];
}
$l++;
$index++;
@ -274,4 +274,4 @@ class TestTreeConstructor extends \PHPUnit\Framework\TestCase {
}
}
}
}
}

Loading…
Cancel
Save