• bugzilla_firefox


    //本来要给火狐提交bug的,发现复现不鸟,我勒个去
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>无标题文档</title>
    </head>
    <style>
    html,body{
    	100%;
    	height:100%;
    }
    body{
    	position:relative
    }
    section{
    	position:absolute
    }
    .s1{
    	left:10px;
    }
    .s2{
    	left:40px;
    }
    .s3{
    	left:80px
    }
    input{
    	display:none;
    	outline:none
    }
    </style>
    <body>
    <section class="s1">
    	11
    </section>
    <section class="s2">
    	11
    </section>
    <section class="s3">
    	11
    </section>
    <input type="text">
    <script>
    var Drag = function( e ){
    	this.e = typeof e === "string" ? document.getElementById(e) : e;
    	this.initDrag();
    }
    Drag.prototype = {
    	zIndex : 0,
    	constructor : Drag,
    	initDrag : function(){
    		this.e.addEventListener("mousedown",this.ev.bind(this));
    	},
    	ev : function(e){
    		switch(e.type){
    			case "mousedown":
    				this.dx = e.clientX - this.e.offsetLeft;
    				this.dy = e.clientY - this.e.offsetTop;
    				this.e.zIndex = this.zIndex++;
    				this.fn = this.ev.bind(this);
    				document.addEventListener("mousemove",this.fn);
    				document.addEventListener("mouseup",this.fn);
    			break;
    			case "mousemove":		
    				this.e.style.left = e.clientX - this.dx + "px";
    				this.e.style.top = e.clientY - this.dy + "px";			
    			break;
    			case "mouseup":
    				document.removeEventListener("mouseup",this.fn)
    				document.removeEventListener("mousemove",this.fn)
    			break;
    		};
    		e.cancelBubble = true;
    		e.defaultPrevented = true;
    		e.stopPropagation();
    		e.preventDefault();
    		return 
    	}
    };
    Array.prototype.slice.call(document.querySelectorAll("section"),null).forEach(function(e,i){
    	new Drag(e);
    	e.addEventListener("mouseup",function(){
    		var css = Object.create( window.getComputedStyle(e,null) ),
    			t = parseInt(css.top) + "px",
    			l = parseInt(css.left) + "px";
    		/************************************/
    		e.style.left = 0;
    		e.style.top = 0;
    		/************************************/
    		console.log( window.getComputedStyle(e,null).left )
    		console.log( window.getComputedStyle(e,null).top )
    		e.style.left = l
    		e.style.top = t
    	});
    });
    </script>
    </body>
    </html>
    

      

  • 相关阅读:
    -lpopt is not found while cross compiling for aarch64
    设置进程的cpu亲和性
    在ARM64位开发板上兼容ARM32位的可执行程序
    ARM开发板上查看动态库或者可执行程序的依赖关系
    交叉编译tmux
    使用PSCI机制的SMP启动分析
    将qemu使用的设备树dump出来
    故障review的一些总结
    理解Compressed Sparse Column Format (CSC)
    统计分析工程的依赖项
  • 原文地址:https://www.cnblogs.com/diligenceday/p/3580323.html
Copyright © 2020-2023  润新知