Merge pull request #168 from EspadaV8/feature/boolean-attributes

[5.2] Support boolean attributes
This commit is contained in:
Matt Lantz authored and GitHub committed 2017-05-20 13:59:53 -04:00
commit fffe7ff53d
2 files changed
+19 -4

No files matched your search

+6 -4
View File
@@ -441,11 +441,13 @@ class HtmlBuilder
*/
protected function attributeElement($key, $value)
{
// For numeric keys we will assume that the key and the value are the same
// as this will convert HTML attributes such as "required" to a correct
// form like required="required" instead of using incorrect numerics.
// For numeric keys we will assume that the value is a boolean attribute
// where the presence of the attribute represents a true value and the
// absence represents a false value.
// This will convert HTML attributes such as "required" to a correct
// form instead of using incorrect numerics.
if (is_numeric($key)) {
$key = $value;
return $value;
}
// Treat boolean attributes as HTML properties