createBySelector() public static method

Create new element node by CSS selector.
public static createBySelector ( string $selector, string $value = null, array $attributes = [] ) : Element
$selector string
$value string
$attributes array
return Element
Ejemplo n.º 1
0
 public function testCreateBySelector()
 {
     $element = Element::createBySelector('li.item.active', 'Foo', ['data-id' => 1]);
     $this->assertEquals('li', $element->tag);
     $this->assertEquals('Foo', $element->text());
     $this->assertEquals(['class' => 'item active', 'data-id' => 1], $element->attributes());
 }