显示标签为“HTML”的博文。显示所有博文
显示标签为“HTML”的博文。显示所有博文

2008年7月29日星期二

浅谈Gecko关键部分之十XUL

Gecko内核作为一个功能强大的浏览器内核,其提出XUL(XML User Interface Language),并且由该语言来实现整个浏览器Firefox界面部分,XUL的实现从另个角度扩充了浏览器内核渲染引擎的内涵,因为它不仅仅可渲染HTML,同时可以象渲染HTML一样渲染xul,这样将XUL与HTML同等看待的浏览器内核实在独无仅有,从这个角度讲Gecko内核的渲染机制比IE、Webkit、Opera等浏览器内核要强大好多倍,因为它们目前本身仅仅支持HTML的渲染。虽然windows推出的XAML、adobe推出的Flex/Laszlo、yahoo widgets等都具有类似功能,但毕竟还没有与浏览器完全整合在一起。这样看来XUL作为Gecko内核的一部分具有根本而独特的作用,那就让我们抽时间来好好了解了解这个XUL。

一、什么是XUL?
XUL (XML User Interface Language) is Mozilla's XML-based language that lets you build feature-rich cross platform applications that can run connected or disconnected from the Internet. These applications are easily customized with alternative text, graphics and layout so they can be readily branded or localized for various markets.

二、XUL的实现机制
为了充分的达到利用XML+JS来实现图形界面程序,XUL作为一门类似HTML的语言,其中定义了一组标签、事件处理机制、渲染方式等,这些定义没有得到W3C等国际标准组织确认,仅由Mozilla组织定义并实现,解析处理一个xul文件的过程与处理html文件的主要过程是类似的,只不过在content、layout等方面有较大的不同,同时xul文件中可以嵌入html标签,将xul标签与html标签完全融为一体来处理,其主要处理过程完全类似浅谈Gecko关键部分之四The life of an html http Request中所描述的。

关于XUL具体定义的标签、CSS、事件处理等等,内容非常庞大,可具体参考下面提供的参考资源。

三、参考资源
WIKI XUL
Mozilla developer center-xul
XUL Reference
The Joy Of Xul
Xul Overlay
XUL Tutorial
XUL PLANET

WIKI XAML
WIKI Adobe Flex
WIKI Yahoo! Widget

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、必要时刻需仔细研读之,定会收获众多,她们就像我们的良师益友,平时没事的时候可常习之。