public function attributes() { if (!$this->node instanceof DOMElement) { return null; } $attributes = []; foreach ($this->node->attributes as $name => $attr) { $attributes[$name] = $attr->value; } return $attributes; }
public function testAttributes() { $attributes = ['type' => 'text', 'name' => 'username']; $element = new Element('input', null, $attributes); $this->assertEquals($attributes, $element->attributes()); }