【发布时间】:2013-08-04 12:50:31
【问题描述】:
jQuery 或 jQuery-UI 中的更改与插件不兼容 jquery.illuminate.0.7
插件jquery.illuminate.0.7 工作in chrome 30, firefox 22 and IE 10。它使用
- jquery_1.6.1.min.js
- jquery-ui_1.8.13.min.js
- jquery.illuminate.0.7.js
但是改变 jQuery 和 jQuery-UI 的版本是 causes the demo of the illuminate plugin to only work in chrome 30。演示使用
- jquery_1.9.1.js 和
- jquery-ui_1.10.3.js
- jquery.illuminate.0.7.js
在 Firefox 22 中会导致以下错误:
TypeError: $.css(...) is undefined pointing to jquery.illuminate.0.7.js:223
HTML 和 js 代码
<script>
window.onload = function(){
$("#illuminate").illuminate({
'intensity': '0.3',
'color': '#98cb00',
'blink': 'true',
'blinkSpeed': '1200',
'outerGlow': 'true',
'outerGlowSize': '30px',
'outerGlowColor': '#98cb00'
});
};
</script>
相关的html只是按钮
<button type="submit" class="btn" id="illuminate" >submit</button>
我尝试了什么
我查看了Illumination插件的源代码,看看错误发生在哪里。方法$.cssHooks.boxShadowBlur包含这个js:
$.cssHooks.boxShadowBlur = {
get: function ( elem, computed, extra ) {
return $.css(elem, support.boxShadow).split(rWhitespace)[5];
},
set: function( elem, value ) {
elem.style[ support.boxShadow ] =
insert_into($.css(elem, support.boxShadow), value, 5);
}
};
jquery still contains a matching function的github页面(见第111行):
jQuery.fn.extend({
css: function( name, value ) { ....
我的问题
- 在 jQuery.js 或 jQuery-ui 中是否发生了任何可能导致
$.css(...)失败的重大更改 - 如何使插件与最新(或至少 1.9.1)版本的 jquery 和 jquery-ui (1.10.3) 兼容
到目前为止的更新和指针
用户 Dave 询问我如何加载 javascript 库。我按以下顺序同步加载它们:
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script src="jquery.illuminate.0.7.js"></script>
用户Sumurai指出it could have to do with the deprecated curCSS。我在 jQuery 1.9.1 中找到了以下代码:
jQuery.extend({
// Add in style property hooks for overriding the default
// behavior of getting and setting a style property
cssHooks: {
opacity: {
get: function( elem, computed ) {
if ( computed ) {
// We should always get a number back from opacity
var ret = curCSS( elem, "opacity" );
return ret === "" ? "1" : ret;
}//if
}//get
}//opacity
},//cssHooks
// more properties for jQuery.extend ....
所以 jQuery 1.9.1 仍然使用curCSS 作为cssHooks.opacity。插件Illuminate向cssHooks添加了另一个属性:$.cssHooks.boxShadowBlur。但据我所知,这种方法与cssHooks.opacity 无关。因此curCSS 应该无效。
【问题讨论】:
-
我查看了照明插件
jquery.illuminate.0.7.js和jquery-ui-1.10.3的源代码,找不到curCSS的任何用途。只有在jquery_1.9.1.js中使用了curCSS。所以很难理解为什么会触发它。你能详细说明一下吗? -
如何加载脚本?同步?按什么顺序?
-
嗯,使用 FireBug 断点单步执行他们的代码,我突然想到我以前从未见过
$.css(elem,blah)语法。应该是$(elem).css(blah)。也许它使用的语法已被弃用? -
我认为它可能报告了 other .css 调用之一。除非您全部更改。
标签: javascript jquery jquery-ui jquery-plugins