I’ve been playing with yiisoft/html and it seems the order you write the following works/doesn’t work as expected
Does the documentation point out that the order you write these matters? I am using this inside of a WordPress project, sorry I haven’t made a bare minimum example that excludes everything else.
Div::tag()
->id('my-id')
->class('my-class')
->attributes(['tabindex' => '-1'])
->content('My content')
->render();
Outputs:
<div tabindex="-1">My content</div>
Whereas this
Div::tag()
->id('my-id')
->attributes(['tabindex' => '-1'])
->class('my-class')
->content('My content')
->render();
Outputs:
<div class="my-class" tabindex="-1">My content</div>
And lastly:
Div::tag()
->attributes(['tabindex' => '-1'])
->id('my-id')
->class('my-class')
->content('My content')
->render();
Outputs:
<div id="my-id" class="my-class" tabindex="-1">My content</div>
All I have in my composer.json is.
{
"require": {
"yiisoft/html": "^3.11"
}
}