开发者

ASP.NET web forms creating non-standard HTML tags

开发者 https://www.devze.com 2023-04-03 17:15 出处:网络
I am reading this article about ASP.NET Web forms vs MVC frameworks and it states Developers do not开发者_StackOverflow have the control of the rendering HTML of web forms and Server controls that re

I am reading this article about ASP.NET Web forms vs MVC frameworks and it states

Developers do not开发者_StackOverflow have the control of the rendering HTML of web forms and Server controls that render html with mixed inline style and deprecated tags that does not follows standards

I am not sure if I follow what is been said here. If you agree with what is been state above, can you please elaborate specifically with some examples of what non-standard HTML tags are generated by web-forms. Also if they are non-standard HTML, how can it work in different browsers?


As you were asking for examples:

The border attribute of the html <img>-tag is now deprecated. It still works with most browsers, but you should solve this with CSS instead.

ASP.NET versions prior to 4.0 still render the <asp:image>-Control with a border="0" output.

See .NET Framework 4 Migration Issues:

In previous versions of ASP.NET, some controls emitted markup that you could not disable. By default, this type of markup is no longer generated in ASP.NET 4. The rendering changes affect the following controls:

  • The Image and ImageButton controls no longer render a border="0" attribute.
  • The BaseValidator class and validation controls that derive from it no longer render red text by default.
  • The HtmlForm control does not render a name attribute.
  • The Table control no longer renders a border="0" attribute.

Controls that are not designed for user input (for example, the Label control) no longer render the disabled="disabled" attribute if their Enabled property is set to false (or if they inherit this setting from a container control).


Deprecated tags are tags that were standard at one time, but when using newer standards are no longer valid.

It follows that web controls that were created at the time standard X was the newest, will not necessarily emit HTML that conforms to a newer standard Y.

0

精彩评论

暂无评论...
验证码 换一张
取 消