You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
disable_html_ns was added to handle non-namespace aware tools. A common example in many usages of this lib:
XPath expressions will always fail because, e.g. xmlns:p != p
The problem with this config option:
Rules are defined for non-Boolean attributes to be output with ="" but these do not kick in when the disable_html_ns option is set.
protected function nonBooleanAttribute(\DOMAttr $attr)
What does the spec say? Earlier versions of the HTML5 spec permitted the empty attribute syntax only for Boolean attributes. Later versions still don’t explicitly state that it is allowed for non-Boolean attributes, but they no longer say it is not (the specific clause, “This syntax is permitted only for boolean attributes,” has been removed).
validator.nu shows both <input disabled> and <input disabled=""> are valid (without namespace declarations).
Suggested changes
A config option to bypass the namespace tests and return return for anything listed in the OutputRules::nonBooleanAttributes
Based on the spec, the list if back to front. It should be listing attributes known as Boolean, rather than the other way round. Any unknown attribute should be classified as non-Boolean.
Item 1 above should be very simple to add and fully BC. Would you accept a PR for that?
The text was updated successfully, but these errors were encountered:
I hope to understand correctly, but your goal is to be able to define boolean attributes even when namespacing is disabled, right? (by probably having a list of tags with allowed boolean attributes, right?
disable_html_ns
was added to handle non-namespace aware tools. A common example in many usages of this lib:The problem with this config option:
Rules are defined for non-Boolean attributes to be output with
=""
but these do not kick in when thedisable_html_ns
option is set.html5-php/src/HTML5/Serializer/OutputRules.php
Line 371 in c24cd7e
What does the spec say?
Earlier versions of the HTML5 spec permitted the empty attribute syntax only for Boolean attributes. Later versions still don’t explicitly state that it is allowed for non-Boolean attributes, but they no longer say it is not (the specific clause, “This syntax is permitted only for boolean attributes,” has been removed).
validator.nu shows both
<input disabled>
and<input disabled="">
are valid (without namespace declarations).Suggested changes
A config option to bypass the namespace tests and return return for anything listed in the
OutputRules::nonBooleanAttributes
Based on the spec, the list if back to front. It should be listing attributes known as Boolean, rather than the other way round. Any unknown attribute should be classified as non-Boolean.
Item 1 above should be very simple to add and fully BC. Would you accept a PR for that?
The text was updated successfully, but these errors were encountered: