summaryrefslogtreecommitdiff
path: root/frontend/beta/js/Clipperz/YUI/DomQuery.js
Unidiff
Diffstat (limited to 'frontend/beta/js/Clipperz/YUI/DomQuery.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/beta/js/Clipperz/YUI/DomQuery.js22
1 files changed, 10 insertions, 12 deletions
diff --git a/frontend/beta/js/Clipperz/YUI/DomQuery.js b/frontend/beta/js/Clipperz/YUI/DomQuery.js
index 4ad4193..6e54b6c 100644
--- a/frontend/beta/js/Clipperz/YUI/DomQuery.js
+++ b/frontend/beta/js/Clipperz/YUI/DomQuery.js
@@ -1,214 +1,212 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26/* 24/*
27 * yui-ext 0.40 25 * yui-ext 0.40
28 * Copyright(c) 2006, Jack Slocum. 26 * Copyright(c) 2006, Jack Slocum.
29 */ 27 */
30 28
31/** 29/**
32 * @class Ext.DomQuery 30 * @class Ext.DomQuery
33 * Provides high performance selector/xpath processing by compiling queries into reusable functions. 31 * Provides high performance selector/xpath processing by compiling queries into reusable functions.
34 * New pseudo classes and matchers can be plugged. It works on HTML and XML documents (if a content node is passed in). 32 * New pseudo classes and matchers can be plugged. It works on HTML and XML documents (if a content node is passed in).
35 * @singleton 33 * @singleton
36 */ 34 */
37Ext.DomQuery = function(){ 35Ext.DomQuery = function(){
38 var cache = {}, simpleCache = {}, valueCache = {}; 36 var cache = {}, simpleCache = {}, valueCache = {};
39 var nonSpace = /\S/; 37 var nonSpace = /\S/;
40 var trimRe = /^\s*(.*?)\s*$/; 38 var trimRe = /^\s*(.*?)\s*$/;
41 var tplRe = /\{(\d+)\}/g; 39 var tplRe = /\{(\d+)\}/g;
42 var modeRe = /^(\s?[\/>]\s?|\s|$)/; 40 var modeRe = /^(\s?[\/>]\s?|\s|$)/;
43 var clsRes = {}; 41 var clsRes = {};
44 42
45 function child(p, index){ 43 function child(p, index){
46 var i = 0; 44 var i = 0;
47 var n = p.firstChild; 45 var n = p.firstChild;
48 while(n){ 46 while(n){
49 if(n.nodeType == 1){ 47 if(n.nodeType == 1){
50 i++; 48 i++;
51 if(i == index){ 49 if(i == index){
52 return n; 50 return n;
53 } 51 }
54 } 52 }
55 n = n.nextSibling; 53 n = n.nextSibling;
56 } 54 }
57 return null; 55 return null;
58 }; 56 };
59 57
60 function next(d){ 58 function next(d){
61 var n = d.nextSibling; 59 var n = d.nextSibling;
62 while(n && n.nodeType != 1){ 60 while(n && n.nodeType != 1){
63 n = n.nextSibling; 61 n = n.nextSibling;
64 } 62 }
65 return n; 63 return n;
66 }; 64 };
67 65
68 function prev(d){ 66 function prev(d){
69 var n = d.previousSibling; 67 var n = d.previousSibling;
70 while(n && n.nodeType != 1){ 68 while(n && n.nodeType != 1){
71 n = n.previousSibling; 69 n = n.previousSibling;
72 } 70 }
73 return n; 71 return n;
74 }; 72 };
75 73
76 function clean(d){ 74 function clean(d){
77 var n = d.firstChild, ni = -1; 75 var n = d.firstChild, ni = -1;
78 while(n){ 76 while(n){
79 var nx = n.nextSibling; 77 var nx = n.nextSibling;
80 if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){ 78 if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){
81 d.removeChild(n); 79 d.removeChild(n);
82 }else{ 80 }else{
83 n.nodeIndex = ++ni; 81 n.nodeIndex = ++ni;
84 } 82 }
85 n = nx; 83 n = nx;
86 } 84 }
87 return this; 85 return this;
88 }; 86 };
89 87
90 function byClassName(c, a, v){ 88 function byClassName(c, a, v){
91 if(!v){ 89 if(!v){
92 return c; 90 return c;
93 } 91 }
94 var re = clsRes[v]; 92 var re = clsRes[v];
95 if(!re){ 93 if(!re){
96 re = new RegExp('(?:^|\\s)(?:' + v + ')(?:\\s|$)'); 94 re = new RegExp('(?:^|\\s)(?:' + v + ')(?:\\s|$)');
97 clsRes[v] = re; 95 clsRes[v] = re;
98 } 96 }
99 var r = []; 97 var r = [];
100 for(var i = 0, ci; ci = c[i]; i++){ 98 for(var i = 0, ci; ci = c[i]; i++){
101 if(re.test(ci.className)){ 99 if(re.test(ci.className)){
102 r[r.length] = ci; 100 r[r.length] = ci;
103 } 101 }
104 } 102 }
105 return r; 103 return r;
106 }; 104 };
107 105
108 function convert(c){ 106 function convert(c){
109 if(c.slice){ 107 if(c.slice){
110 return c; 108 return c;
111 } 109 }
112 var r = []; 110 var r = [];
113 for(var i = 0, l = c.length; i < l; i++){ 111 for(var i = 0, l = c.length; i < l; i++){
114 r[r.length] = c[i]; 112 r[r.length] = c[i];
115 } 113 }
116 return r; 114 return r;
117 }; 115 };
118 116
119 function attrValue(n, attr){ 117 function attrValue(n, attr){
120 if(!n.tagName && typeof n.length != 'undefined'){ 118 if(!n.tagName && typeof n.length != 'undefined'){
121 n = n[0]; 119 n = n[0];
122 } 120 }
123 if(!n){ 121 if(!n){
124 return null; 122 return null;
125 } 123 }
126 if(attr == 'for'){ 124 if(attr == 'for'){
127 return n.htmlFor; 125 return n.htmlFor;
128 } 126 }
129 if(attr == 'class' || attr == 'className'){ 127 if(attr == 'class' || attr == 'className'){
130 return n.className; 128 return n.className;
131 } 129 }
132 return n.getAttribute(attr) || n[attr]; 130 return n.getAttribute(attr) || n[attr];
133 131
134 }; 132 };
135 133
136 function getNodes(ns, mode, tagName){ 134 function getNodes(ns, mode, tagName){
137 var result = [], cs; 135 var result = [], cs;
138 if(!ns){ 136 if(!ns){
139 return result; 137 return result;
140 } 138 }
141 mode = mode ? mode.replace(trimRe, '$1') : ''; 139 mode = mode ? mode.replace(trimRe, '$1') : '';
142 tagName = tagName || '*'; 140 tagName = tagName || '*';
143 if(ns.tagName || ns == document){ 141 if(ns.tagName || ns == document){
144 ns = [ns]; 142 ns = [ns];
145 } 143 }
146 if(mode != '/' && mode != '>'){ 144 if(mode != '/' && mode != '>'){
147 for(var i = 0, ni; ni = ns[i]; i++){ 145 for(var i = 0, ni; ni = ns[i]; i++){
148 cs = ni.getElementsByTagName(tagName); 146 cs = ni.getElementsByTagName(tagName);
149 result = concat(result, cs); 147 result = concat(result, cs);
150 } 148 }
151 }else{ 149 }else{
152 for(var i = 0, ni; ni = ns[i]; i++){ 150 for(var i = 0, ni; ni = ns[i]; i++){
153 var cn = ni.getElementsByTagName(tagName); 151 var cn = ni.getElementsByTagName(tagName);
154 for(var j = 0, cj; cj = cn[j]; j++){ 152 for(var j = 0, cj; cj = cn[j]; j++){
155 if(cj.parentNode == ni){ 153 if(cj.parentNode == ni){
156 result[result.length] = cj; 154 result[result.length] = cj;
157 } 155 }
158 } 156 }
159 } 157 }
160 158
161 } 159 }
162 return result; 160 return result;
163 }; 161 };
164 162
165 function concat(a, b){ 163 function concat(a, b){
166 if(b.slice){ 164 if(b.slice){
167 return a.concat(b); 165 return a.concat(b);
168 } 166 }
169 for(var i = 0, l = b.length; i < l; i++){ 167 for(var i = 0, l = b.length; i < l; i++){
170 a[a.length] = b[i]; 168 a[a.length] = b[i];
171 } 169 }
172 return a; 170 return a;
173 } 171 }
174 172
175 function byTag(cs, tagName){ 173 function byTag(cs, tagName){
176 if(cs.tagName || cs == document){ 174 if(cs.tagName || cs == document){
177 cs = [cs]; 175 cs = [cs];
178 } 176 }
179 if(!tagName){ 177 if(!tagName){
180 return cs; 178 return cs;
181 } 179 }
182 var r = []; tagName = tagName.toLowerCase(); 180 var r = []; tagName = tagName.toLowerCase();
183 for(var i = 0, ci; ci = cs[i]; i++){ 181 for(var i = 0, ci; ci = cs[i]; i++){
184 if(ci.nodeType == 1 && ci.tagName.toLowerCase()==tagName){ 182 if(ci.nodeType == 1 && ci.tagName.toLowerCase()==tagName){
185 r[r.length] = ci; 183 r[r.length] = ci;
186 } 184 }
187 } 185 }
188 return r; 186 return r;
189 }; 187 };
190 188
191 function byId(cs, attr, id){ 189 function byId(cs, attr, id){
192 if(cs.tagName || cs == document){ 190 if(cs.tagName || cs == document){
193 cs = [cs]; 191 cs = [cs];
194 } 192 }
195 if(!id){ 193 if(!id){
196 return cs; 194 return cs;
197 } 195 }
198 var r = []; 196 var r = [];
199 for(var i = 0, l = cs.length; i < l; i++){ 197 for(var i = 0, l = cs.length; i < l; i++){
200 var ci = cs[i]; 198 var ci = cs[i];
201 if(ci && ci.id == id){ 199 if(ci && ci.id == id){
202 r[r.length] = ci; 200 r[r.length] = ci;
203 } 201 }
204 } 202 }
205 return r; 203 return r;
206 }; 204 };
207 205
208 function byAttribute(cs, attr, value, op, custom){ 206 function byAttribute(cs, attr, value, op, custom){
209 var r = [], st = custom=='{'; 207 var r = [], st = custom=='{';
210 var f = Ext.DomQuery.operators[op]; 208 var f = Ext.DomQuery.operators[op];
211 for(var i = 0, l = cs.length; i < l; i++){ 209 for(var i = 0, l = cs.length; i < l; i++){
212 var a; 210 var a;
213 if(st){ 211 if(st){
214 a = Ext.DomQuery.getStyle(cs[i], attr); 212 a = Ext.DomQuery.getStyle(cs[i], attr);