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报告帖子。


原文地址:https://www.cnblogs.com/waw/p/3987939.html