This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CSS 1中定义的选择器 | |
选择器 类型 说明 | |
E 类型选择器 选择指定类型的元素 | |
E#myid ID选择器 选择匹配E的元素,且匹配元素的id属性值等于myid。注意,E选择符可以省略,表示选择指定id属性 | |
等于myid的任意类型的元素 | |
E.warning 类选择器 选择匹配E的元素,且匹配元素的class属性值等于warning。注意,E选择符可以省略,表示选择指定 | |
class属性值等于warning的任意类型的任意多个元素 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<code>-webkit-transform:translate3d(0,0,0); |
###监听事件
1、绑定事件监听函数
function addEventHandler(target, type, func) {
if (target.addEventListener) {
// Chrome、FireFox、Opera、Safari、IE9.0
target.addEventListener(type, func, false);
###同源策略
同源策略,它是由Netscape提出的一个著名的安全策略。 现在所有支持JavaScript 的浏览器都会使用这个策略。 所谓同源是指,域名,协议,端口相同。 当一个浏览器的两个tab页中分别打开来 百度和谷歌的页面 当浏览器的百度tab页执行一个脚本的时候会检查这个脚本是属于哪个页面的, 即检查是否同源,只有和百度同源的脚本才会被执行。
###原理
平时在html
中写入一个img
标签,src
路径可以是任意域名下的图片,所以这个src
属性并不被同源策略所约束,所以可以获取任何服务器上脚本并执行。
var EventUtil = { addHandler: function(element, type, handler) { if (element.addEventListener) { element.addEventListener(type, handler, false); } else if (element.attactEvent) { element.attactEvent('on' + type, handler); } else { element['on' + type] = handler; }
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IE6下图片透明:_background-image:none;_filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src=''); |
//indexOf实现 // http://webreflection.blogspot.fr/2011/06/partial-polyfills.html function indexOf(value) { for (var i = this.length; i-- && this[i] !== value;) {} return i; } var arr = [0, 1, 2, 3, 4]; indexOf.call(arr, 4);
//If no name, and callback is a function, then figure out if it a
//CommonJS thing with dependencies.
if (!deps && isFunction(callback)) {
deps = [];
if (callback.length) {
callback
.toString()
.replace(commentRegExp, '')
.replace(cjsRequireRegExp, function (match, dep) {
OlderNewer