- if (!Ext.DomQuery.isXml(root)) {
- try {
- var cs = root.querySelectorAll(path);
- return Ext.Array.toArray(cs);
- }
- catch (ex) {}
+ /*
+ * Safari 3.x can't handle uppercase or unicode characters when in quirks mode.
+ */
+ if (!Ext.DomQuery.isXml(root) && !(Ext.isSafari3 && !Ext.isStrict)) {
+ try {
+ /*
+ * This checking here is to "fix" the behaviour of querySelectorAll
+ * for non root document queries. The way qsa works is intentional,
+ * however it's definitely not the expected way it should work.
+ * More info: http://ejohn.org/blog/thoughts-on-queryselectorall/
+ *
+ * We only modify the path for single selectors (ie, no multiples),
+ * without a full parser it makes it difficult to do this correctly.
+ */
+ var isDocumentRoot = root.nodeType === 9,
+ _path = path,
+ _root = root;
+
+ if (!isDocumentRoot && path.indexOf(',') === -1 && !startIdRe.test(path)) {
+ _path = '#' + Ext.id(root) + ' ' + path;
+ _root = root.parentNode;
+ }
+ return Ext.Array.toArray(_root.querySelectorAll(_path));
+ }
+ catch (e) {
+ }