Computers, Programming
Validator - what is it? Why do I need a micro-markup validator?
Let's talk about code verification tools. A special tool that is created for this purpose is called a format validator. As an example, HTML will be used. The validator for this markup language is perfectly suited to explain the principle and give an example.
Why is it needed?
We set the conditions
The strictness with which the page will be checked is prescribed in the tag. If you do not specify it, then it will be investigated in the most careful way, and in the report the validator will indicate all the errors and waste from the standards. Also keep in mind that the test will be conducted according to HTML5 rules. To specify a different version or to mitigate the search for deviations, use this tag. By the way, in addition to the HTML version, there is also a CSS validator. It will allow you to verify the construction of a cascading style sheet and its compliance with the latest standard. This chance, if you are interested in this topic, it is better not to neglect.
Directions for verifying the DOCTYPE tag
At the moment there are such types of verification:
- Strict according to the latest standard.
- Transitional.
- Strict.
- With frames.
By the way, it is always desirable to specify a DOCTYPE. After all, if you do not do this, different browsers that have different settings will show the page in different ways. And the desired file will be very ugly displayed. It should be noted that this only affects the visual component, while the performance is not affected.
About bugs, say a word
Other elements
The fact that the HTML validator checks the code is, of course, good. Are there any features regarding RSS feeds and cascading CSS tables? Yes, there are validators for them. Remember: they only check compliance with the code standards. And what is written there - they do not care. Therefore, if you are primarily interested in the quality of the page and the site, you need to check them.
Online Check
What is included in the validation?
- The search for syntax errors.
- The nesting of tags is checked. They always close in the reverse order of how they came off. And if something is wrong - you will be notified.
- Check for compliance with the specified Document Type Definition. Automation scans and determines whether everything is correct (tags, attributes) is written about the version of markup language that is declared.
- Check for foreign elements. It searches for what exists in fact in the code, but is not in the Document Type Definition.
It is necessary to understand that these are all logical tests. In this case, it is not important how the validator is implemented. What does this mean in practice? If at least one check fails, the code will not be considered valid. In the end, each serious program will deduce recommendations on what needs to be corrected (and can even tell how to do it).
Arguments for
The main reason why the micro-markup validator is needed is to provide cross-browser compatibility for the site or its separate page. The fact is that every program that helps you browse the Internet, has its own parser. Therefore, a single way to be sure that the code will function correctly in all browsers is to drive it through the validator. What else does it give?
The fact is that each browser has its own mechanism for correlating errors in the program code. Therefore, it is possible that he will be able to correct the situation with the invalid program, or it can aggravate everything. These were the arguments for, but there are also against.
So, it is worth noting that the micro-resolution validator is very strict. And browsers can fix some bugs themselves. Therefore, if in the first place is the task of correct operation, the appearance can be partially ignored.
Feedback using the validator
If you have doubts about the aesthetics of the appearance of the page, then they are in vain. So, if you specify Doctype, the browser parser will be switched to a certain mode. That's just it does not lead to the fact that it will be loaded, and the code will be checked for compliance with it. Therefore, the browser parsers are already preconfigured that there will be a certain lack of validity of the code. So with custom attributes: they are successfully recognized and processed. An example is the ARIA technology. It works with attributes that supplement the semantic value of the code, thereby swearing the validator. What is it: good or bad? On the one hand, the code works and provides special features. And on the other - deviation from the standards. But in the case of ARIA, this is quite justified.
Conclusion
Similar articles
Trending Now