ie8响应js'未定义'为null或不是对象
ie8 respond.js 'undefined' is null or not an object
我正在使用responsd.js(该库为+1),我得到了对象的以下函数并出错:
translate = function (styles, href, media) {
// here I got 'undefined' error in IE 8
var qs = styles.match(/@media[^'{]+'{([^'{'}]*'{[^'}'{]*'})+/gi),
ql = qs && qs.length || 0;
//try to get CSS path
href = href.substring(0, href.lastIndexOf("/"));
var repUrls = function (css) {
return css.replace(/(url'()['"]?([^'/')'"][^:')'"]+)['"]?('))/g, "$1" + href + "$2$3");
},
useMedia = !ql && media;
//if path exists, tack on trailing slash
if (href.length) {
href += "/";
}
//if no internal queries exist, but media attr does, use that
//note: this currently lacks support for situations where a media attr is specified on a link AND
//its associated stylesheet has internal CSS media queries.
//In those cases, the media attribute will currently be ignored.
if (useMedia) {
ql = 1;
}
for (var i = 0; i < ql; i++) {
var fullq, thisq, eachq, eql;
//media attr
if (useMedia) {
fullq = media;
rules.push(repUrls(styles));
}
//parse for styles
else {
fullq = qs[i].match(/@media *([^'{]+)'{(['S's]+?)$/) && RegExp.$1;
rules.push(RegExp.$2 && repUrls(RegExp.$2));
}
eachq = fullq.split(",");
eql = eachq.length;
for (var j = 0; j < eql; j++) {
thisq = eachq[j];
mediastyles.push({
media: thisq.split("(")[0].match(/(only's+)?([a-zA-Z]+)'s?/) && RegExp.$2 || "all",
rules: rules.length - 1,
hasquery: thisq.indexOf("(") > -1,
minw: thisq.match(/'('s*min'-width's*:'s*('s*[0-9'.]+)(px|em)'s*')/) && parseFloat(RegExp.$1) + (RegExp.$2 || ""),
maxw: thisq.match(/'('s*max'-width's*:'s*('s*[0-9'.]+)(px|em)'s*')/) && parseFloat(RegExp.$1) + (RegExp.$2 || "")
});
}
}
applyMedia();
},
还有其他解决办法吗?我试过不同的。。。
我在第121行遇到了类似的问题(Respond.js1.3.0)。一个空的样式表导致了这个问题,删除它解决了这个问题。
没有足够的信息来判断你的情况是否完全相同,但你可以试着看看它是否有帮助。
相关文章:
- 谷歌地图API-“;toGeoJson”;返回几何体为null的对象
- 验证对象是否为null Javascript/Angularjs
- 对象为null或IE9中存在未定义错误
- 如何计算一个对象中五个属性中有多少是非null的
- Microsoft JScript运行时错误:无法获取属性'的值;样式':对象为null或未定义
- javascript对象显示为null,但object.properties返回数据
- global.getElementById('..')为null或不是对象
- IE8错误:为null或不是对象,但仍然可以跟踪/控制台注销
- AJAX请求中的JSON对象为Null或空
- Highcharts无法设置属性'的值;要点':对象为null或未定义
- ui.selectmenu投掷'this.newelement.0'为null或不是对象
- 添加到序列化数组中的复杂对象在服务器端始终为 null
- 什么是 ClojureScript 类似地将不存在的对象值设置为 JavaScript 中的 null
- Javascript:将类/对象引用设置为 NULL,内存中的子对象/类会发生什么
- 为什么引用 = null 不会影响引用的对象
- 类型错误:'null'不是对象(正在评估'响应.productType')
- IE错误:无法设置属性'的值;样式':对象为null或未定义
- 我的代码给了我一条错误消息:GetElementById()为null或不是对象
- IE8对象当对象包含null值时应出现错误
- 为iframe获取对象null.使用jsdom和所需选项创建iframe