-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Closed
Description
I will be submitting a PR for improving and making the Html::addCssClass more intelligent and more practical to use for all use cases - similar or better than jquery addClass.
Enhancements:
- Parse the original
$options['class']correctly irrespective of whitespaces (tabs, newlines or spaces) - Parse the
$classparam correctly irrespective of whitespaces (tabs, newlines or spaces) - If the
$classproperty is separated by spaces... it will validate each class separately already added and - Intelligently do not append css class if it already exists irrespective of the whitespace
Current Implementation
Example
$options = ['class' => ' kartik']; // note the whitespace
Html::addCssClass($options, ' hide kartik robot');
Html::addCssClass($options, "\tkartik hide fancy box holy");Output
// generated output
$options['class'] = ' kartik hide kartik robot kartik hide fancy box holy';Proposed Implementation (After PR Change)
Example
$options = ['class' => ' kartik']; // note the whitespace
Html::addCssClass($options, ' hide kartik robot');
Html::addCssClass($options, "\tkartik hide fancy box holy");Output
// generated output
$options['class'] = 'kartik hide robot fancy box holy';Metadata
Metadata
Assignees
Labels
No labels