开发者

What is the css selector for an element with a class and an attribute in sencha touch

I used to have a code that checks any previous element with a corresponding css class and an attribute which is...

var previousEl = el.prev('.line[@id]');
where line is a class and id is an attribute

this code worked in Ext but when I tried running the same code in sencha-touch, I get a "Error: SYNTAX_ERR: DOM Exception 12".

I checked the dom and I have verified that there is a previous sibling with the class and the attribute id.

Can somebody help me out as to why this selector do开发者_如何学Pythones not work anymore?

Thanks in advance.


Try dropping the @? They took it out from jQuery at some point of time, and reading the Sencha docs it would seem that they did the same in Ext JS.

var previousEl = el.prev('.line[id]');


unlike Ext JS which seems to have its own selector code DomQuery in sencha touch seems to rely on document.querySelectorAll

see the select method in http://dev.sencha.com/deploy/touch/docs/source/DomQuery.html#method-Ext.DomQuery-is

and that method is throwing "SYNTAX_ERR exception if the specified group of selectors is invalid." see https://developer.mozilla.org/En/DOM/Document.querySelectorAll

probably thats the exception you get. try to use selectors that make that function happy

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜