Changing the boolean logic of tag attributes
s1lver opened this issue · comments
Maybe it's worth changing the logic for working with boolean when creating tag attributes?
What steps will reproduce the problem?
echo Html::submitButton(
'Test',
[
'disabled' => true,
]
);
<button type="submit" disabled="">Test</button>
For disabled
attribute it is correct https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled
Let's take this example:
echo Html::submitButton(
'Test',
[
'name' => 'Test[test1]',
'value' => true,
'disabled' => false,
]
);
<button type="submit" name="Test[test1]" value="">Test</button>
For this option it will no longer work correctly (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#value)
What is the expected result?
<button type="submit" name="Test[test1]" value="1">Test</button>
or
<button type="submit" disabled="1">Test</button>
What do you get instead?
<button type="submit" name="Test[test1]" value="">Test</button>
or
<button type="submit" disabled="">Test</button>
Additional info
Q | A |
---|---|
Yii version | 2.0.* |
PHP version | >= 5.* |
Operating system | All |
Good idea. Do you have time for a pull request.
ok, ill do it