2008年7月7日星期一

浅谈Gecko关键部分之五认识HTML、DOM、CSS、XML、XHTML、SVG等标准

在了解Gecko内核是如何响应用户输入的Web地址,如何渲染、显示包含文字、图片、动画甚至视频的画面给用户的整个过程之后,假如我们深思一下,Gecko内核为什么要这样解析、渲染这个Web地址对应的内容?为什么不那样解析?它在解析、渲染的时候会受到约束吗?它可以自由发挥吗?答案是肯定,它所受的约束也就是我们熟知的W3C标准,它是尽可能按照标准来办事的,当然标准当中也肯定有未尽之事,所以它也有一定的自由发挥空间。正是有了如此众多的W3C标准,让我们的互联网应用是如此的丰富多彩,IE、Safari、Opera等浏览器都基本按照标准办事,所以我们编写的符合标准的Web页面可以在如此多的浏览器上被解析、渲染显示出来,并且效果基本一致。标准也就是协议,所以我们要想深入的了解Gecko内核,必须深入的了解它所支持的标准。下面初略的介绍一下HTML、DOM、CSS、XML、XHTML、SVG等标准。

一、HTML
HTML, an initialism of HyperText Markup Language, is the predominant markup language for web pages. It provides a means to describe the structure of text-based information in a document — by denoting certain text as links, headings, paragraphs, lists, and so on — and to supplement that text with interactive forms, embedded images, and other objects. HTML is written in the form of tags, surrounded by angle brackets. HTML can also describe, to some degree, the appearance and semantics of a document, and can include embedded scripting language code (such as JavaScript) which can affect the behavior of Web browsers and other HTML processors.

具体可参考
HTML Wiki
HTML 4.01 Specification
HTML 5 Specification

二、
DOM

The Document Object Model (DOM) is a platform- and language-independent standard object model for representing HTML or XML and related formats.

A web browser is not obliged to use DOM in order to render an HTML document. However, the DOM is required by JavaScript scripts that wish to inspect or modify a web page dynamically. In other words, the Document Object Model is the way JavaScript sees its containing HTML page and browser state.

具体可参考
DOM Wiki
DOM2 Html Specification

三、CSS
Cascading Style Sheets (CSS) is a stylesheet language used to describe the presentation of a document written in a markup language. Its most common application is to style web pages written in HTML and XHTML, but the language can be applied to any kind of XML document, including SVG and XUL.

具体可参考
CSS Wiki
CSS Specification

四、XML
The Extensible Markup Language (XML) is a general-purpose specification for creating custom markup languages.[1] It is classified as an extensible language because it allows its users to define their own elements. Its primary purpose is to facilitate the sharing of structured data across different information systems, particularly via the Internet,[2] and it is used both to encode documents and to serialize data. In the latter context, it is comparable with other text-based serialization languages such as JSON and YAML.[3]

具体可参考
XML Wiki
XML Specification

五、XHTML
The Extensible Hypertext Markup Language, or XHTML, is a markup language that has the same depth of expression as HTML, but also conforms to XML syntax.

具体可参考
XHTML Wiki
XHTML Specification

六、SVG
Scalable Vector Graphics (SVG) is an XML specification and file format for describing two-dimensional vector graphics, both static and animated. SVG can be purely declarative or may include scripting. Images can contain hyperlinks using outbound simple XLinks.[2] It is an open standard created by the W3C's SVG Working Group.

具体可参考
SVG Wiki
SVG Tiny1.2 Specification

七、总结
面对如此众多的W3C标准,特别是W3C上发布的标准文档,我们往往会看得云里雾里,毕竟这些标准文档是所谓的专家学者所写,够严谨全面的。为了便于日常运用,我们只要把握两条即可1、懂得其基本用途及主要要素; 2、必要时刻需仔细研读之,定会收获众多,她们就像我们的良师益友,平时没事的时候可常习之。




没有评论: