Skip to content

Commit

Permalink
build attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
asika32764 committed Dec 10, 2024
1 parent fef1fc8 commit a420142
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions packages/dom/src/DOMElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,13 @@ public function createChild(string $name, array $attributes = [], $content = nul
*
* @return string
*/
#[\Deprecated(message: 'Use HTMLElement::buildAttributes() instead.')]
public static function buildAttributes(array|NativeDOMElement $attributes, ?string $type = null): string
{
if ($type === null || $type === static::HTML) {
return HTMLElement::buildAttributes($attributes);
}

if ($attributes instanceof NativeDOMElement) {
$attributes = array_map(
fn(DOMAttr $attr) => $attr->value,
Expand Down
8 changes: 4 additions & 4 deletions packages/dom/src/HTMLElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ public function render(bool $formatOutput = false): string
throw new \LogicException('Please attach Element to a Document before render it.');
}

$formatOutputBak = $this->ownerDocument->formatOutput;

$this->ownerDocument->formatOutput = $formatOutput;
// $formatOutputBak = $this->ownerDocument->formatOutput;
//
// $this->ownerDocument->formatOutput = $formatOutput;

$result = HTML5Factory::saveHtml($this);

$this->ownerDocument->formatOutput = $formatOutputBak;
// $this->ownerDocument->formatOutput = $formatOutputBak;

return $result;
}
Expand Down

0 comments on commit a420142

Please sign in to comment.