source: trip-planner-front/node_modules/@angular/compiler/esm2015/src/selector.js@ fa375fe

Last change on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 52.5 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { getHtmlTagDefinition } from './ml_parser/html_tags';
9const _SELECTOR_REGEXP = new RegExp('(\\:not\\()|' + // 1: ":not("
10 '(([\\.\\#]?)[-\\w]+)|' + // 2: "tag"; 3: "."/"#";
11 // "-" should appear first in the regexp below as FF31 parses "[.-\w]" as a range
12 // 4: attribute; 5: attribute_string; 6: attribute_value
13 '(?:\\[([-.\\w*\\\\$]+)(?:=([\"\']?)([^\\]\"\']*)\\5)?\\])|' + // "[name]", "[name=value]",
14 // "[name="value"]",
15 // "[name='value']"
16 '(\\))|' + // 7: ")"
17 '(\\s*,\\s*)', // 8: ","
18'g');
19/**
20 * A css selector contains an element name,
21 * css classes and attribute/value pairs with the purpose
22 * of selecting subsets out of them.
23 */
24export class CssSelector {
25 constructor() {
26 this.element = null;
27 this.classNames = [];
28 /**
29 * The selectors are encoded in pairs where:
30 * - even locations are attribute names
31 * - odd locations are attribute values.
32 *
33 * Example:
34 * Selector: `[key1=value1][key2]` would parse to:
35 * ```
36 * ['key1', 'value1', 'key2', '']
37 * ```
38 */
39 this.attrs = [];
40 this.notSelectors = [];
41 }
42 static parse(selector) {
43 const results = [];
44 const _addResult = (res, cssSel) => {
45 if (cssSel.notSelectors.length > 0 && !cssSel.element && cssSel.classNames.length == 0 &&
46 cssSel.attrs.length == 0) {
47 cssSel.element = '*';
48 }
49 res.push(cssSel);
50 };
51 let cssSelector = new CssSelector();
52 let match;
53 let current = cssSelector;
54 let inNot = false;
55 _SELECTOR_REGEXP.lastIndex = 0;
56 while (match = _SELECTOR_REGEXP.exec(selector)) {
57 if (match[1 /* NOT */]) {
58 if (inNot) {
59 throw new Error('Nesting :not in a selector is not allowed');
60 }
61 inNot = true;
62 current = new CssSelector();
63 cssSelector.notSelectors.push(current);
64 }
65 const tag = match[2 /* TAG */];
66 if (tag) {
67 const prefix = match[3 /* PREFIX */];
68 if (prefix === '#') {
69 // #hash
70 current.addAttribute('id', tag.substr(1));
71 }
72 else if (prefix === '.') {
73 // Class
74 current.addClassName(tag.substr(1));
75 }
76 else {
77 // Element
78 current.setElement(tag);
79 }
80 }
81 const attribute = match[4 /* ATTRIBUTE */];
82 if (attribute) {
83 current.addAttribute(current.unescapeAttribute(attribute), match[6 /* ATTRIBUTE_VALUE */]);
84 }
85 if (match[7 /* NOT_END */]) {
86 inNot = false;
87 current = cssSelector;
88 }
89 if (match[8 /* SEPARATOR */]) {
90 if (inNot) {
91 throw new Error('Multiple selectors in :not are not supported');
92 }
93 _addResult(results, cssSelector);
94 cssSelector = current = new CssSelector();
95 }
96 }
97 _addResult(results, cssSelector);
98 return results;
99 }
100 /**
101 * Unescape `\$` sequences from the CSS attribute selector.
102 *
103 * This is needed because `$` can have a special meaning in CSS selectors,
104 * but we might want to match an attribute that contains `$`.
105 * [MDN web link for more
106 * info](https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors).
107 * @param attr the attribute to unescape.
108 * @returns the unescaped string.
109 */
110 unescapeAttribute(attr) {
111 let result = '';
112 let escaping = false;
113 for (let i = 0; i < attr.length; i++) {
114 const char = attr.charAt(i);
115 if (char === '\\') {
116 escaping = true;
117 continue;
118 }
119 if (char === '$' && !escaping) {
120 throw new Error(`Error in attribute selector "${attr}". ` +
121 `Unescaped "$" is not supported. Please escape with "\\$".`);
122 }
123 escaping = false;
124 result += char;
125 }
126 return result;
127 }
128 /**
129 * Escape `$` sequences from the CSS attribute selector.
130 *
131 * This is needed because `$` can have a special meaning in CSS selectors,
132 * with this method we are escaping `$` with `\$'.
133 * [MDN web link for more
134 * info](https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors).
135 * @param attr the attribute to escape.
136 * @returns the escaped string.
137 */
138 escapeAttribute(attr) {
139 return attr.replace(/\\/g, '\\\\').replace(/\$/g, '\\$');
140 }
141 isElementSelector() {
142 return this.hasElementSelector() && this.classNames.length == 0 && this.attrs.length == 0 &&
143 this.notSelectors.length === 0;
144 }
145 hasElementSelector() {
146 return !!this.element;
147 }
148 setElement(element = null) {
149 this.element = element;
150 }
151 /** Gets a template string for an element that matches the selector. */
152 getMatchingElementTemplate() {
153 const tagName = this.element || 'div';
154 const classAttr = this.classNames.length > 0 ? ` class="${this.classNames.join(' ')}"` : '';
155 let attrs = '';
156 for (let i = 0; i < this.attrs.length; i += 2) {
157 const attrName = this.attrs[i];
158 const attrValue = this.attrs[i + 1] !== '' ? `="${this.attrs[i + 1]}"` : '';
159 attrs += ` ${attrName}${attrValue}`;
160 }
161 return getHtmlTagDefinition(tagName).isVoid ? `<${tagName}${classAttr}${attrs}/>` :
162 `<${tagName}${classAttr}${attrs}></${tagName}>`;
163 }
164 getAttrs() {
165 const result = [];
166 if (this.classNames.length > 0) {
167 result.push('class', this.classNames.join(' '));
168 }
169 return result.concat(this.attrs);
170 }
171 addAttribute(name, value = '') {
172 this.attrs.push(name, value && value.toLowerCase() || '');
173 }
174 addClassName(name) {
175 this.classNames.push(name.toLowerCase());
176 }
177 toString() {
178 let res = this.element || '';
179 if (this.classNames) {
180 this.classNames.forEach(klass => res += `.${klass}`);
181 }
182 if (this.attrs) {
183 for (let i = 0; i < this.attrs.length; i += 2) {
184 const name = this.escapeAttribute(this.attrs[i]);
185 const value = this.attrs[i + 1];
186 res += `[${name}${value ? '=' + value : ''}]`;
187 }
188 }
189 this.notSelectors.forEach(notSelector => res += `:not(${notSelector})`);
190 return res;
191 }
192}
193/**
194 * Reads a list of CssSelectors and allows to calculate which ones
195 * are contained in a given CssSelector.
196 */
197export class SelectorMatcher {
198 constructor() {
199 this._elementMap = new Map();
200 this._elementPartialMap = new Map();
201 this._classMap = new Map();
202 this._classPartialMap = new Map();
203 this._attrValueMap = new Map();
204 this._attrValuePartialMap = new Map();
205 this._listContexts = [];
206 }
207 static createNotMatcher(notSelectors) {
208 const notMatcher = new SelectorMatcher();
209 notMatcher.addSelectables(notSelectors, null);
210 return notMatcher;
211 }
212 addSelectables(cssSelectors, callbackCtxt) {
213 let listContext = null;
214 if (cssSelectors.length > 1) {
215 listContext = new SelectorListContext(cssSelectors);
216 this._listContexts.push(listContext);
217 }
218 for (let i = 0; i < cssSelectors.length; i++) {
219 this._addSelectable(cssSelectors[i], callbackCtxt, listContext);
220 }
221 }
222 /**
223 * Add an object that can be found later on by calling `match`.
224 * @param cssSelector A css selector
225 * @param callbackCtxt An opaque object that will be given to the callback of the `match` function
226 */
227 _addSelectable(cssSelector, callbackCtxt, listContext) {
228 let matcher = this;
229 const element = cssSelector.element;
230 const classNames = cssSelector.classNames;
231 const attrs = cssSelector.attrs;
232 const selectable = new SelectorContext(cssSelector, callbackCtxt, listContext);
233 if (element) {
234 const isTerminal = attrs.length === 0 && classNames.length === 0;
235 if (isTerminal) {
236 this._addTerminal(matcher._elementMap, element, selectable);
237 }
238 else {
239 matcher = this._addPartial(matcher._elementPartialMap, element);
240 }
241 }
242 if (classNames) {
243 for (let i = 0; i < classNames.length; i++) {
244 const isTerminal = attrs.length === 0 && i === classNames.length - 1;
245 const className = classNames[i];
246 if (isTerminal) {
247 this._addTerminal(matcher._classMap, className, selectable);
248 }
249 else {
250 matcher = this._addPartial(matcher._classPartialMap, className);
251 }
252 }
253 }
254 if (attrs) {
255 for (let i = 0; i < attrs.length; i += 2) {
256 const isTerminal = i === attrs.length - 2;
257 const name = attrs[i];
258 const value = attrs[i + 1];
259 if (isTerminal) {
260 const terminalMap = matcher._attrValueMap;
261 let terminalValuesMap = terminalMap.get(name);
262 if (!terminalValuesMap) {
263 terminalValuesMap = new Map();
264 terminalMap.set(name, terminalValuesMap);
265 }
266 this._addTerminal(terminalValuesMap, value, selectable);
267 }
268 else {
269 const partialMap = matcher._attrValuePartialMap;
270 let partialValuesMap = partialMap.get(name);
271 if (!partialValuesMap) {
272 partialValuesMap = new Map();
273 partialMap.set(name, partialValuesMap);
274 }
275 matcher = this._addPartial(partialValuesMap, value);
276 }
277 }
278 }
279 }
280 _addTerminal(map, name, selectable) {
281 let terminalList = map.get(name);
282 if (!terminalList) {
283 terminalList = [];
284 map.set(name, terminalList);
285 }
286 terminalList.push(selectable);
287 }
288 _addPartial(map, name) {
289 let matcher = map.get(name);
290 if (!matcher) {
291 matcher = new SelectorMatcher();
292 map.set(name, matcher);
293 }
294 return matcher;
295 }
296 /**
297 * Find the objects that have been added via `addSelectable`
298 * whose css selector is contained in the given css selector.
299 * @param cssSelector A css selector
300 * @param matchedCallback This callback will be called with the object handed into `addSelectable`
301 * @return boolean true if a match was found
302 */
303 match(cssSelector, matchedCallback) {
304 let result = false;
305 const element = cssSelector.element;
306 const classNames = cssSelector.classNames;
307 const attrs = cssSelector.attrs;
308 for (let i = 0; i < this._listContexts.length; i++) {
309 this._listContexts[i].alreadyMatched = false;
310 }
311 result = this._matchTerminal(this._elementMap, element, cssSelector, matchedCallback) || result;
312 result = this._matchPartial(this._elementPartialMap, element, cssSelector, matchedCallback) ||
313 result;
314 if (classNames) {
315 for (let i = 0; i < classNames.length; i++) {
316 const className = classNames[i];
317 result =
318 this._matchTerminal(this._classMap, className, cssSelector, matchedCallback) || result;
319 result =
320 this._matchPartial(this._classPartialMap, className, cssSelector, matchedCallback) ||
321 result;
322 }
323 }
324 if (attrs) {
325 for (let i = 0; i < attrs.length; i += 2) {
326 const name = attrs[i];
327 const value = attrs[i + 1];
328 const terminalValuesMap = this._attrValueMap.get(name);
329 if (value) {
330 result =
331 this._matchTerminal(terminalValuesMap, '', cssSelector, matchedCallback) || result;
332 }
333 result =
334 this._matchTerminal(terminalValuesMap, value, cssSelector, matchedCallback) || result;
335 const partialValuesMap = this._attrValuePartialMap.get(name);
336 if (value) {
337 result = this._matchPartial(partialValuesMap, '', cssSelector, matchedCallback) || result;
338 }
339 result =
340 this._matchPartial(partialValuesMap, value, cssSelector, matchedCallback) || result;
341 }
342 }
343 return result;
344 }
345 /** @internal */
346 _matchTerminal(map, name, cssSelector, matchedCallback) {
347 if (!map || typeof name !== 'string') {
348 return false;
349 }
350 let selectables = map.get(name) || [];
351 const starSelectables = map.get('*');
352 if (starSelectables) {
353 selectables = selectables.concat(starSelectables);
354 }
355 if (selectables.length === 0) {
356 return false;
357 }
358 let selectable;
359 let result = false;
360 for (let i = 0; i < selectables.length; i++) {
361 selectable = selectables[i];
362 result = selectable.finalize(cssSelector, matchedCallback) || result;
363 }
364 return result;
365 }
366 /** @internal */
367 _matchPartial(map, name, cssSelector, matchedCallback) {
368 if (!map || typeof name !== 'string') {
369 return false;
370 }
371 const nestedSelector = map.get(name);
372 if (!nestedSelector) {
373 return false;
374 }
375 // TODO(perf): get rid of recursion and measure again
376 // TODO(perf): don't pass the whole selector into the recursion,
377 // but only the not processed parts
378 return nestedSelector.match(cssSelector, matchedCallback);
379 }
380}
381export class SelectorListContext {
382 constructor(selectors) {
383 this.selectors = selectors;
384 this.alreadyMatched = false;
385 }
386}
387// Store context to pass back selector and context when a selector is matched
388export class SelectorContext {
389 constructor(selector, cbContext, listContext) {
390 this.selector = selector;
391 this.cbContext = cbContext;
392 this.listContext = listContext;
393 this.notSelectors = selector.notSelectors;
394 }
395 finalize(cssSelector, callback) {
396 let result = true;
397 if (this.notSelectors.length > 0 && (!this.listContext || !this.listContext.alreadyMatched)) {
398 const notMatcher = SelectorMatcher.createNotMatcher(this.notSelectors);
399 result = !notMatcher.match(cssSelector, null);
400 }
401 if (result && callback && (!this.listContext || !this.listContext.alreadyMatched)) {
402 if (this.listContext) {
403 this.listContext.alreadyMatched = true;
404 }
405 callback(this.selector, this.cbContext);
406 }
407 return result;
408 }
409}
410//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VsZWN0b3IuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6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Q1RPUl9SRUdFWFAgPSBuZXcgUmVnRXhwKFxuICAgICcoXFxcXDpub3RcXFxcKCl8JyArICAgICAgICAgICAgICAgLy8gMTogXCI6bm90KFwiXG4gICAgICAgICcoKFtcXFxcLlxcXFwjXT8pWy1cXFxcd10rKXwnICsgIC8vIDI6IFwidGFnXCI7IDM6IFwiLlwiL1wiI1wiO1xuICAgICAgICAvLyBcIi1cIiBzaG91bGQgYXBwZWFyIGZpcnN0IGluIHRoZSByZWdleHAgYmVsb3cgYXMgRkYzMSBwYXJzZXMgXCJbLi1cXHddXCIgYXMgYSByYW5nZVxuICAgICAgICAvLyA0OiBhdHRyaWJ1dGU7IDU6IGF0dHJpYnV0ZV9zdHJpbmc7IDY6IGF0dHJpYnV0ZV92YWx1ZVxuICAgICAgICAnKD86XFxcXFsoWy0uXFxcXHcqXFxcXFxcXFwkXSspKD86PShbXFxcIlxcJ10/KShbXlxcXFxdXFxcIlxcJ10qKVxcXFw1KT9cXFxcXSl8JyArICAvLyBcIltuYW1lXVwiLCBcIltuYW1lPXZhbHVlXVwiLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gXCJbbmFtZT1cInZhbHVlXCJdXCIsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBcIltuYW1lPSd2YWx1ZSddXCJcbiAgICAgICAgJyhcXFxcKSl8JyArICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gNzogXCIpXCJcbiAgICAgICAgJyhcXFxccyosXFxcXHMqKScsICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyA4OiBcIixcIlxuICAgICdnJyk7XG5cbi8qKlxuICogVGhlc2Ugb2Zmc2V0cyBzaG91bGQgbWF0Y2ggdGhlIG1hdG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y5saXN0Q29udGV4dC5hbHJlYWR5TWF0Y2hlZCkpIHtcbiAgICAgIGNvbnN0IG5vdE1hdGNoZXIgPSBTZWxlY3Rvck1hdGNoZXIuY3JlYXRlTm90TWF0Y2hlcih0aGlzLm5vdFNlbGVjdG9ycyk7XG4gICAgICByZXN1bHQgPSAhbm90TWF0Y2hlci5tYXRjaChjc3NTZWxlY3RvciwgbnVsbCk7XG4gICAgfVxuICAgIGlmIChyZXN1bHQgJiYgY2FsbGJhY2sgJiYgKCF0aGlzLmxpc3RDb250ZXh0IHx8ICF0aGlzLmxpc3RDb250ZXh0LmFscmVhZHlNYXRjaGVkKSkge1xuICAgICAgaWYgKHRoaXMubGlzdENvbnRleHQpIHtcbiAgICAgICAgdGhpcy5saXN0Q29udGV4dC5hbHJlYWR5TWF0Y2hlZCA9IHRydWU7XG4gICAgICB9XG4gICAgICBjYWxsYmFjayh0aGlzLnNlbGVjdG9yLCB0aGlzLmNiQ29udGV4dCk7XG4gICAgfVxuICAgIHJldHVybiByZXN1bHQ7XG4gIH1cbn1cbiJdfQ==
Note: See TracBrowser for help on using the repository browser.