zoukankan      html  css  js  c++  java
  • JQuery UI中的Tabs与base元素摩擦的BUG

    JQuery UI中的Tabs与base元素冲突的BUG
      以前一直使用jquery-ui-1.8,最近打算试一下目前最新的版本1.11。但对于Tabs,页面是乱的,怎么也不正常。折腾了好几个小时,最后发现页面中使用的base元素,对Tabs有破坏性的影响。
      没有想清楚具体的原因,先记下来再说吧。

      到了晚上,又想起这个问题。这个问题实在讨厌,我的系统中所有页面中都使用了base元素,不解决这个冲突实在是不爽。经过几个小时的跟踪调试,终于发现的问题所在:
      新版本的jquery UI中,Tabs的代码存在一处错误,注意代码片断的第22行。

    	_isLocal: (function() {
    		var rhash = /#.*$/;
    
    		return function( anchor ) {
    			var anchorUrl, locationUrl;
    
    			// support: IE7
    			// IE7 doesn't normalize the href property when set via script (#9317)
    			anchor = anchor.cloneNode( false );
    
    			anchorUrl = anchor.href.replace( rhash, "" );
    			locationUrl = location.href.replace( rhash, "" );
    
    			// decoding may throw an error if the URL isn't UTF-8 (#9518)
    			try {
    				anchorUrl = decodeURIComponent( anchorUrl );
    			} catch ( error ) {}
    			try {
    				locationUrl = decodeURIComponent( locationUrl );
    			} catch ( error ) {}
    			
    			return anchor.hash.length > 1 || anchorUrl === locationUrl;//原来为&&
    		};
    



      发现这个BUG很兴奋,专门注册了个账号,去jquery UI的论坛上发了个BUG报告帖子。


  • 相关阅读:
    第3周 实践项目2 建设”顺序表“算法库(可参考为模板)
    第3周实践项目3 求集合并集
    【luogu 2529】【SHOI 2001】击鼓传花
    【BZOJ 3270】博物馆
    【BZOJ 2337】XOR和路径
    浅谈期望dp
    【codeforces 24D】Broken Robot
    【POJ 1463】Strategic game
    【POJ 3585】Accumulation Degree
    【luogu 3146/3147】248/262144
  • 原文地址:https://www.cnblogs.com/waw/p/3987939.html
Copyright © 2011-2022 走看看