压缩javascript和css
This document is for establishing build standard for JavaScript and CSS compression
The objective for this document is to establish a companywide JavaScript and CSS compression standard that can be shared crossing multiple SharePoint product development projects. This is the first draft
Overview
Our SharePoint development involves many client side scripts programming style sheet design. In order to improve JavaScript and CSS loading performance and protect our work from copying, we need to establish a standard way to make our script and css shorter and hard to read. Following steps will help you to understand how to do it without knowing all implementation details.
Step 1: Build Compression Environment
System Requirement: Windows XP/Server 2003 Virtual Environment.
Software: JDK 1.4+, yuicompressor-2.4.2.jar
Step 2: JavaScript Naming Standard
1) JavaScript Naming Standard: name-x.y.z.js
2) Compressed JavaScript Naming Standard: name-x.y.x.min.js
Step 3: Compress a JavaScript
Usage: java -jar yuicompressor-2.4.2.jar myfile-x.y.z.js -o myfile-x.y.z.min.js
java -jar yuicompressor-x.y.z.jar [options] [input file]
Global Options
-h, --help Displays this information
--type <js|css> Specifies the type of the input file
--charset <charset> Read the input file using <charset>
--line-break <column> Insert a line break after the specified column number
-v, --verbose Display informational messages and warnings
-o <file> Place the output into <file>. Defaults to stdout.
JavaScript
相关文档:
WPF的WebBrowser和WinForm的WebBrowser有一定区别。
要向其中注入javascript脚本,经过本人试验,下面一条路可以走通:
mshtml.HTMLDocument htmlDoc = Browser.Document as mshtml.HTMLDocument;
var head = htmlDoc.getElementsByTagName("head").Cast<HTMLHeadElement>().First();
var script = (IHTMLS ......
1.把对象的所有引用都设置为null,可以强制性的废除对象(即通知存储单元收集程序销毁对象来释放内存)。这是个好习惯。
2.Array类即数组类,可以如下定义:
var aColors=new Array();
aColors[0]="blue";
aC ......
注:"elm"代表某个DOM元素,"xxx"代表某个CSS属性
一、elm.style.xxx 只能获取内联样式里的值
要想获得正确的css值:
IE:elm.currentStyle[xxx]
W3C标准:document.defaultView.getComputedStyle(elm,"")[xxx]
注意:用IE方法返回值可能不是数字,而是auto;用w3c的方法总是会返回数字+单位
三、offsetLeft
......
1.获取URL
获取url的方法,直接用location就可以了,window.location或window.loation.href也可以。
2.分析URL
运用location获取的url的属性为object,要对其进行字符串的分析操作,需要先将其转换为字符串。
用location来进行处理,首先将其转换为字符串,用函数toString(),URL.toString();
附一些URL参数
完整的U ......
JavaScript拥有内置对象和自定义对象,事实上各种数据类型的变量都属于一种对象,变量在声明和赋值后马上拥有对应的方法和对象。
1.JavaScript内置对象的种类
JavaScript对象依照建立方式不同可分为使用变量声明的隐性对象和使用new命令对立对象副本的显性对象。
隐性对象(Implicit[im'plisit] Object ......