public function href($href = null) { if ($href !== null) { $this->node->setAttribute('href', $href); } return $this->node->getAttribute('href'); }
public function testGetAttribute() { $node = new HtmlNode('a'); $node->getTag()->setAttributes(['href' => ['value' => 'http://google.com', 'doubleQuote' => false], 'class' => ['value' => 'outerlink rounded', 'doubleQuote' => true]]); $this->assertEquals('outerlink rounded', $node->getAttribute('class')); }
public function testSetAttribute() { $node = new HtmlNode('a'); $node->setAttribute('class', 'foo'); $this->assertEquals('foo', $node->getAttribute('class')); }