惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - Franky
N
Netflix TechBlog - Medium
Google Online Security Blog
Google Online Security Blog
月光博客
月光博客
量子位
酷 壳 – CoolShell
酷 壳 – CoolShell
V
V2EX
腾讯CDC
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
M
MIT News - Artificial intelligence
Vercel News
Vercel News
The GitHub Blog
The GitHub Blog
Hugging Face - Blog
Hugging Face - Blog
博客园 - 【当耐特】
Apple Machine Learning Research
Apple Machine Learning Research
aimingoo的专栏
aimingoo的专栏
博客园 - 三生石上(FineUI控件)
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
MongoDB | Blog
MongoDB | Blog
H
Help Net Security
The Cloudflare Blog
Blog — PlanetScale
Blog — PlanetScale
F
Full Disclosure
G
Google Developers Blog
罗磊的独立博客
Jina AI
Jina AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Y
Y Combinator Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
J
Java Code Geeks
A
About on SuperTechFans
IT之家
IT之家
大猫的无限游戏
大猫的无限游戏
S
SegmentFault 最新的问题
有赞技术团队
有赞技术团队
GbyAI
GbyAI
雷峰网
雷峰网
T
The Blog of Author Tim Ferriss
The Register - Security
The Register - Security
U
Unit 42
D
Docker
Martin Fowler
Martin Fowler
L
LINUX DO - 热门话题
NISL@THU
NISL@THU
阮一峰的网络日志
阮一峰的网络日志
C
Cybersecurity and Infrastructure Security Agency CISA
博客园_首页
Google DeepMind News
Google DeepMind News

博客园 - Chatterley

关于分层和职责 验证码的安全效果 Sea@35还是挺适合初玩游戏的人 无题国庆 google.cn的设计? Microsoft Academic Address 注册openid来遨游网络 缓存有关的几篇文章 product@35 wordpress mu无法显示中文问题的解决方法 Zend framework 1.0.0下载 PHP扩展入门的好文章 microformats Windows SharePoint Services Skills 第17界Jolt大奖 产品开发和商业系统开发 走了,想回头,却不能回头 Ajax界面 工作流开发的一篇好文章
wpmu中使用jquery的bug
Chatterley · 2007-10-11 · via 博客园 - Chatterley

今天修改wordpressmu遇到一个关于使用Jquery的bug,在IE下,老显示js有错误。bug显示信息为:Error:expected identifier, string or number。
我于是找到了dashboardswitcher.php里的一段js:
jQuery( function($) {
var switchTime;
var w = false;
var h = $( '#blog-title' )
 .css({
  background: 'transparent url( ../wp-content/mu-plugins/bullet_arrow_down.gif ) no-repeat scroll 100% .2em;',
  padding: '0 25px 2px 5px',
  cursor: 'pointer',
  border: '1px solid #14568a',//这里多了一个","
 })
 .parent().css( { position: 'relative' }).end()
 .append( $('#switchermenu') )
 .hover( function() {
  $(this).css({ border: '1px solid #1a70b4'});
  switchTime = window.setTimeout( function() {
   $('#switchermenu').fadeIn('fast').css( 'top', h ).find('a').width( w = w ? w : $('#switchermenu').width() );
  }, 300 );
 }, function() {
  window.clearTimeout( switchTime );
  $(this).css({ border: '1px solid #14568a' }) ;
  $('#switchermenu').hide();
 })
 .height() - 3;
});

jQuery还真是强大,既然一句话就实现了,包括样式变化,以及switchermenu的显示和隐藏等功能。正为jquery震撼,难怪说jquery改变了js的编码风格。
我在这段代码中找了半天,没有看出什么问题。可能是由于太相信wpmu了,一直只在自己添加的代码里找。外加,没有太在意wpmu中的小细节。而且,它在fireFox下一切都正常。正在无奈的情况下发现了多了一个“,”,呵呵,得意……又找到一个wpmu的bug。原来FF应该可以智能补差,例如<br >它会补充</br>,而对空的变量则会忽略。而IE则没有那么智能,原本期望“,”后有个变量,则自然出现错误。
一个小小的“,”,就可以看出两个browser的智能差距,没用过IE7,不知道它是不是也变智能了。