Change record status: 
Project: 
Introduced in branch: 
8.x
Description: 

Drupal 7

drupal_html_class($foo)
drupal_html_id($foo)
drupal_clean_css_identifier($foo)

Drupal 8

use Drupal\Component\Utility\Html;

Html::getClass($foo);
Html::getId($foo);
Html::cleanCssIdentifier($foo);
Impacts: 
Module developers

Comments

pingwin4eg’s picture

Correction: D7's drupal_html_id() is equivalent to D8's Html::getUniqueId() method. The Html::getId() does not guarantee uniqueness of resulting ID.