Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. NodeElement.php

function NodeElement::hasClass

Checks whether an element has a named CSS class.

Parameters

string $className Name of the class:

Return value

bool

File

vendor/behat/mink/src/Element/NodeElement.php, line 152

Class

NodeElement
Page element node.

Namespace

Behat\Mink\Element

Code

public function hasClass(string $className) {
    $class = $this->getAttribute('class');
    if ($class === null) {
        return false;
    }
    $classes = preg_split('/\\s+/', $class);
    if ($classes === false) {
        $classes = [];
    }
    return in_array($className, $classes);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal