Failed to execute 'querySelectorAll' on &#

2019-08-04 13:25发布

I am trying for using Ext.dom.Query.Select method to find all divs which having class name square and highlightedReactangle.Same method was working with extjs 4 , but after up grading to extjs 5 it start throwing error.

Uncaught SyntaxError: Failed to execute 'querySelectorAll' on 'Element': 'div:any(div.square|div.highlightedReactangle|div.highlightedReactangleIE|div.pin|div.redCircleCount|div.stampPreviewCls)' is not a valid selector.

The statement I'm using to find related div is,

this.el.select("div:any(div.square|div.highlightedReactangle|div.highlightedReactangleIE|div.pin|div.redCircleCount|div.stampPreviewCls)", true);

what exactely I'm missing ?

1条回答
你好瞎i
2楼-- · 2019-08-04 14:10

what exactely I'm missing ?

From version 5, when select is called on Element (versus explicitly using Ext.dom.Query.select), Ext JS uses the native querySelectorAll method which requires valid CSS selectors. As the error message suggests, your selector is not a valid one.

In version 4, Ext JS used Ext.dom.Query.select for processing select calls on Elements. That method is more "liberal" than querySelectorAll. It will work in version 5 as well, so you can just use:

Ext.dom.Query.select(your_selector, this.el.dom)
查看更多
登录 后发表回答