hasAttribute() public method

Determine if an attribute exists on the element.
public hasAttribute ( string $name ) : boolean
$name string The attribute name
return boolean
Example #1
0
 public function testUnsetMagicMethod()
 {
     $element = new Element('input', null, ['name' => 'username']);
     $this->assertTrue($element->hasAttribute('name'));
     unset($element->name);
     $this->assertFalse($element->hasAttribute('name'));
 }
Example #2
0
 public function testUnsetMagicMethod()
 {
     $domElement = $this->createDomElement('input');
     $domElement->setAttribute("value", "test");
     $element = new Element($domElement);
     $this->assertTrue($element->hasAttribute("value"));
     unset($element->value);
     $this->assertFalse($element->hasAttribute("value"));
 }
Example #3
0
 public function testUnsetMagicMethod()
 {
     $node = $this->createNode('input');
     $node->setAttribute('value', 'test');
     $element = new Element($node);
     $this->assertTrue($element->hasAttribute('value'));
     unset($element->value);
     $this->assertFalse($element->hasAttribute('value'));
 }