Skip to content

Commit 4e9783d

Browse files
committed
1 parent aa57e1a commit 4e9783d

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/DomNode.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* @inheritdoc
1212
*/
1313
class DomNode implements DomNodeInterface
14-
{// todo: validari
14+
{// todo: validari pe construct
1515
use DomElement;
1616
use QuerySelector;
1717

@@ -130,15 +130,18 @@ public function hasAttribute(string $name): bool
130130
return false;
131131
}
132132

133-
public function removeAttribute(string $name): self
133+
public function removeAttribute($attr): self
134134
{
135-
if ($name == '*') {
135+
if ($attr == '*') {
136136
$this->attrs = [];
137137
return $this;
138138
}
139139

140-
foreach ($this->attrs as $i => $attr) {
141-
if ($attr->getName() == $name) {
140+
foreach ($this->attrs as $i => $_attr) {
141+
if (is_string($attr) && $_attr->getName() == $attr) {
142+
unset($this->attrs[$i]);
143+
}
144+
elseif ($attr instanceof DomNodeAttrInterface && $_attr === $attr) {
142145
unset($this->attrs[$i]);
143146
}
144147
}

src/DomNodeAttr.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class DomNodeAttr implements DomNodeAttrInterface
1111

1212
protected $name;
1313
protected $value;
14-
protected $valueDelimiter = '"'; // todo
14+
protected $valueDelimiter = '"';
1515

1616
/**
1717
* DomNode Meta Data

0 commit comments

Comments
 (0)