Right now
$tagBuilder->addAttribute('attr', NULL); // ->getAttribute('attr') returns NULL, and ->render() results attr=""
$tagBuilder->addAttribute('attr', TRUE); // ->getAttribute('attr') returns 'attr', and ->render() results attr="attr"
$tagBuilder->addAttribute('attr', FALSE); // ->getAttribute('attr') returns NULL as the attribute has been removed, and ->render() results nothing.
I think it's a little messing. What I expected are:
$tagBuilder->addAttribute('attr', NULL); // removes the attribute, and ->render() results nothing
$tagBuilder->addAttribute('attr', TRUE); // ->getAttribute('attr') returns TRUE, and ->render() results attr or attr="attr"
$tagBuilder->addAttribute('attr', FALSE); // ->getAttribute('attr') returns FALSE, and ->render() results nothing or maybe attr="".
So for ->render(), considering the output for HTML5 and XHTML, I think it's better to introduce a new property and affect the final result according to its value.
Thanks!
Right now
$tagBuilder->addAttribute('attr', NULL); //
->getAttribute('attr')returnsNULL, and->render()resultsattr=""$tagBuilder->addAttribute('attr', TRUE); //
->getAttribute('attr')returns'attr', and->render()resultsattr="attr"$tagBuilder->addAttribute('attr', FALSE); //
->getAttribute('attr')returnsNULLas the attribute has been removed, and->render()results nothing.I think it's a little messing. What I expected are:
$tagBuilder->addAttribute('attr', NULL); // removes the attribute, and
->render()results nothing$tagBuilder->addAttribute('attr', TRUE); //
->getAttribute('attr')returnsTRUE, and->render()resultsattrorattr="attr"$tagBuilder->addAttribute('attr', FALSE); //
->getAttribute('attr')returnsFALSE, and->render()results nothing or maybeattr="".So for
->render(), considering the output forHTML5andXHTML, I think it's better to introduce a new property and affect the final result according to its value.Thanks!