ComputersProgramming

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?

It happens that you write the program code, like everything and works correctly, but it will not hurt to check. So, let's say we created an HTML page. When we remember about the validator, it means that we are interested in how competently it is made from the point of view of the adopted standard (the better, the more correctly and on more computers it will work).

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:

  1. Strict according to the latest standard.
  2. Transitional.
  3. Strict.
  4. 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

Even when checking a small document, the code validator can find many programmer errors. Is it necessary to eliminate them all? No. Most technical errors are not critical, the most that they can do is slow down the site a little. Although, if this parameter is valuable to you, you can not ignore them. Also it should be noted that some errors can appear already at the moment of compilation by PHP-interpreter.

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

In order not to spray their efforts on various programs, many developers have chosen an Internet validator. What is it and how does it help? Such services are usually already configured to check all three components (RSS feeds, CSS and HTML). Their multifunctionality is worthy of praise. But it's better to check the correctness of compiling HTML separately once more. If we talk about the advantages of online services, it should be noted that there is no need to copy all the code. It is enough to enter the address of the site, and in a moment errors will be displayed. There are also extensions for browsers that can also partially or completely check whether the open page corresponds to accepted standards.

What is included in the validation?

This process is divided into several parts:

  1. The search for syntax errors.
  2. 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.
  3. 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.
  4. 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

What does this give in practice? In comparison with what is used in real applications, the validator shows extraordinary requirements. Of course, he can show some errors that interfere with normal work, but try to please him completely - still should not be. It is also often pointed out that it is not always easy to check for extraneous elements. But they also include custom attributes that are not recognized by standards, but are used by developers to facilitate production processes.

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

In the end, I want to say that everyone chooses independently whether to use the validator or not. Within the framework of the article, the features and nuances of this step were described, and the solution remains for the reader.

Similar articles

 

 

 

 

Trending Now

 

 

 

 

Newest

Copyright © 2018 en.delachieve.com. Theme powered by WordPress.