我一直在为使用 HTML5 Rock 的幻灯片代码的客户端制作一个小型幻灯片/公共显示器。我遇到了一个 DOM 异常 12 - 一个据说与 CSS 选择器有关的语法错误 - 在胡闹的时候......但我无法将其追溯到我在代码中所做的任何更改。我想这可能是我添加功能时发现的东西。
我已将其追溯到这个对象(此处为实时版本):
var SlideShow = function(slides) {
this._slides = (slides || []).map(function(el, idx) {
return new Slide(el, idx);
});
var h = window.location.hash;
try {
this.current = h;
} catch (e) { /* squeltch */ }
this.current = (!this.current) ? "landing-slide" : this.current.replace('#', '');
if (!query('#' + this.current)) {
// if this happens is very likely that someone is coming from
// a link with the old permalink format, i.e. #slide24
alert('The format of the permalinks have recently changed. If you are coming ' +
'here from an old external link it\'s very likely you will land to the wrong slide');
this.current = "landing-slide";
}
var _t = this;
doc.addEventListener('keydown',
function(e) { _t.handleKeys(e); }, false);
doc.addEventListener('touchstart',
function(e) { _t.handleTouchStart(e); }, false);
doc.addEventListener('touchend',
function(e) { _t.handleTouchEnd(e); }, false);
window.addEventListener('popstate',
function(e) { if (e.state) { _t.go(e.state, true); } }, false);
};
( main.jsSlideShow()
中的第 521 行)的实例化:
var slideshow = new SlideShow(queryAll('.slide'));
调用queryAll('.slide')
返回一个包含所有幻灯片的数组,其中包含.slide
. queryAll('.slide')
但是,当作为实例化的参数传递时SlideShow()
,它会返回DOM Exception 12
错误。
有人见过这个吗?