New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid logging warning for missing value for some html attributes such as defer #160
Comments
|
thanks for the quick feedback.
agree that ti is a possible workaround on our side. Not a very maintainable one.
I think not but I'm not an expert of html. for "do not want to invest time for the moment', do you mean for implementing it? or also for reviewing potential Pull Request?
I think it would be incorrect as the defer is a boolean based the html specification. |
PRs are always welcome, as long as they don't break anything :) |
I think implementing "boolean" attributes would actually be a breaking change if it would be the default behaviour. So I think it would need some way to "opt-in". The html mime type might be one way to do that but I would expect test to break when it's always enabled for those mime types. Maybe it would be possible to tweak error handlers so that they get an optional 3rd argument with a well defined data to understand the issue, so that the error handler would also be able to resolve the issue. In this specific case they could even return (or tweak) the attribute value, but I'm not sure if that would also be possible for other error cases. Just thinking out loud here, for anybody that would try to implement it. |
I actually decided to no longer log a warning for missing attribute values at all in the context of HTML documents as part of #338, which as been released as part of https://github.com/xmldom/xmldom/releases/tag/0.9.0-beta.1 (available under the dist-tag I is still using the attribute name as the fallback value in that case. PS: It would now be straight forward to add logic to use a boolean value for some values when being in HTML mode. |
The language in the warning is rather bizarre:
What on earth is "missed value" or "instead2!!" supposed to mean? |
When using this kind of notation:
<script defer src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"></script>
a warning is logged:
[xmldom warning] attribute "defer" missed value!! "defer" instead2!!
based on html specification https://html.spec.whatwg.org/#attr-script-defer this notation is valid.
So when the mimetype is
text/html
, I think that there is no warniogn log.The text was updated successfully, but these errors were encountered: