, value: any): string|undefined;
160 |
--------------------------------------------------------------------------------
/lib/utils/render-status.d.ts:
--------------------------------------------------------------------------------
1 | // tslint:disable:variable-name Describing an API that's defined elsewhere.
2 | // tslint:disable:no-any describes the API as best we are able today
3 |
4 | export {flush};
5 |
6 |
7 | /**
8 | * Flushes all `beforeNextRender` tasks, followed by all `afterNextRender`
9 | * tasks.
10 | */
11 | declare function flush(): void;
12 |
13 | export {beforeNextRender};
14 |
15 |
16 | /**
17 | * Enqueues a callback which will be run before the next render, at
18 | * `requestAnimationFrame` timing.
19 | *
20 | * This method is useful for enqueuing work that requires DOM measurement,
21 | * since measurement may not be reliable in custom element callbacks before
22 | * the first render, as well as for batching measurement tasks in general.
23 | *
24 | * Tasks in this queue may be flushed by calling `flush()`.
25 | */
26 | declare function beforeNextRender(context: any, callback: (...p0: any[]) => void, args?: any[]): void;
27 |
28 | export {afterNextRender};
29 |
30 |
31 | /**
32 | * Enqueues a callback which will be run after the next render, equivalent
33 | * to one task (`setTimeout`) after the next `requestAnimationFrame`.
34 | *
35 | * This method is useful for tuning the first-render performance of an
36 | * element or application by deferring non-critical work until after the
37 | * first paint. Typical non-render-critical work may include adding UI
38 | * event listeners and aria attributes.
39 | */
40 | declare function afterNextRender(context: any, callback: (...p0: any[]) => void, args?: any[]): void;
41 |
--------------------------------------------------------------------------------
/lib/utils/render-status.js:
--------------------------------------------------------------------------------
1 | /**
2 | @license
3 | Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7 | Code distributed by Google as part of the polymer project is also
8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9 | */
10 |
11 | /**
12 | * Module for scheduling flushable pre-render and post-render tasks.
13 | *
14 | * @summary Module for scheduling flushable pre-render and post-render tasks.
15 | */
16 |
17 | import './boot.js';
18 |
19 | let scheduled = false;
20 | let beforeRenderQueue = [];
21 | let afterRenderQueue = [];
22 |
23 | function schedule() {
24 | scheduled = true;
25 | // before next render
26 | requestAnimationFrame(function() {
27 | scheduled = false;
28 | flushQueue(beforeRenderQueue);
29 | // after the render
30 | setTimeout(function() {
31 | runQueue(afterRenderQueue);
32 | });
33 | });
34 | }
35 |
36 | function flushQueue(queue) {
37 | while (queue.length) {
38 | callMethod(queue.shift());
39 | }
40 | }
41 |
42 | function runQueue(queue) {
43 | for (let i=0, l=queue.length; i < l; i++) {
44 | callMethod(queue.shift());
45 | }
46 | }
47 |
48 | function callMethod(info) {
49 | const context = info[0];
50 | const callback = info[1];
51 | const args = info[2];
52 | try {
53 | callback.apply(context, args);
54 | } catch(e) {
55 | setTimeout(() => {
56 | throw e;
57 | });
58 | }
59 | }
60 |
61 | /**
62 | * Flushes all `beforeNextRender` tasks, followed by all `afterNextRender`
63 | * tasks.
64 | *
65 | * @return {void}
66 | */
67 | export function flush() {
68 | while (beforeRenderQueue.length || afterRenderQueue.length) {
69 | flushQueue(beforeRenderQueue);
70 | flushQueue(afterRenderQueue);
71 | }
72 | scheduled = false;
73 | }
74 |
75 |
76 | /**
77 | * Enqueues a callback which will be run before the next render, at
78 | * `requestAnimationFrame` timing.
79 | *
80 | * This method is useful for enqueuing work that requires DOM measurement,
81 | * since measurement may not be reliable in custom element callbacks before
82 | * the first render, as well as for batching measurement tasks in general.
83 | *
84 | * Tasks in this queue may be flushed by calling `flush()`.
85 | *
86 | * @param {*} context Context object the callback function will be bound to
87 | * @param {function(...*):void} callback Callback function
88 | * @param {!Array=} args An array of arguments to call the callback function with
89 | * @return {void}
90 | */
91 | export function beforeNextRender(context, callback, args) {
92 | if (!scheduled) {
93 | schedule();
94 | }
95 | beforeRenderQueue.push([context, callback, args]);
96 | }
97 |
98 | /**
99 | * Enqueues a callback which will be run after the next render, equivalent
100 | * to one task (`setTimeout`) after the next `requestAnimationFrame`.
101 | *
102 | * This method is useful for tuning the first-render performance of an
103 | * element or application by deferring non-critical work until after the
104 | * first paint. Typical non-render-critical work may include adding UI
105 | * event listeners and aria attributes.
106 | *
107 | * @param {*} context Context object the callback function will be bound to
108 | * @param {function(...*):void} callback Callback function
109 | * @param {!Array=} args An array of arguments to call the callback function with
110 | * @return {void}
111 | */
112 | export function afterNextRender(context, callback, args) {
113 | if (!scheduled) {
114 | schedule();
115 | }
116 | afterRenderQueue.push([context, callback, args]);
117 | }
118 |
119 |
--------------------------------------------------------------------------------
/lib/utils/resolve-url.d.ts:
--------------------------------------------------------------------------------
1 | // tslint:disable:variable-name Describing an API that's defined elsewhere.
2 |
3 | export {resolveUrl};
4 |
5 |
6 | /**
7 | * Resolves the given URL against the provided `baseUri'.
8 | *
9 | * Note that this function performs no resolution for URLs that start
10 | * with `/` (absolute URLs) or `#` (hash identifiers). For general purpose
11 | * URL resolution, use `window.URL`.
12 | *
13 | * @returns resolved URL
14 | */
15 | declare function resolveUrl(url: string, baseURI?: string|null): string;
16 |
17 | export {resolveCss};
18 |
19 |
20 | /**
21 | * Resolves any relative URL's in the given CSS text against the provided
22 | * `ownerDocument`'s `baseURI`.
23 | *
24 | * @returns Processed CSS text with resolved URL's
25 | */
26 | declare function resolveCss(cssText: string, baseURI: string): string;
27 |
28 | export {pathFromUrl};
29 |
30 |
31 | /**
32 | * Returns a path from a given `url`. The path includes the trailing
33 | * `/` from the url.
34 | *
35 | * @returns resolved path
36 | */
37 | declare function pathFromUrl(url: string): string;
38 |
--------------------------------------------------------------------------------
/lib/utils/resolve-url.js:
--------------------------------------------------------------------------------
1 | /**
2 | @license
3 | Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7 | Code distributed by Google as part of the polymer project is also
8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9 | */
10 | import './boot.js';
11 |
12 | let CSS_URL_RX = /(url\()([^)]*)(\))/g;
13 | let ABS_URL = /(^\/[^\/])|(^#)|(^[\w-\d]*:)/;
14 | let workingURL;
15 | let resolveDoc;
16 | /**
17 | * Resolves the given URL against the provided `baseUri'.
18 | *
19 | * Note that this function performs no resolution for URLs that start
20 | * with `/` (absolute URLs) or `#` (hash identifiers). For general purpose
21 | * URL resolution, use `window.URL`.
22 | *
23 | * @param {string} url Input URL to resolve
24 | * @param {?string=} baseURI Base URI to resolve the URL against
25 | * @return {string} resolved URL
26 | */
27 | export function resolveUrl(url, baseURI) {
28 | if (url && ABS_URL.test(url)) {
29 | return url;
30 | }
31 | if (url === '//') {
32 | return url;
33 | }
34 | // Lazy feature detection.
35 | if (workingURL === undefined) {
36 | workingURL = false;
37 | try {
38 | const u = new URL('b', 'http://a');
39 | u.pathname = 'c%20d';
40 | workingURL = (u.href === 'http://a/c%20d');
41 | } catch (e) {
42 | // silently fail
43 | }
44 | }
45 | if (!baseURI) {
46 | baseURI = document.baseURI || window.location.href;
47 | }
48 | if (workingURL) {
49 | try {
50 | return (new URL(url, baseURI)).href;
51 | } catch (e) {
52 | // Bad url or baseURI structure. Do not attempt to resolve.
53 | return url;
54 | }
55 | }
56 | // Fallback to creating an anchor into a disconnected document.
57 | if (!resolveDoc) {
58 | resolveDoc = document.implementation.createHTMLDocument('temp');
59 | resolveDoc.base = resolveDoc.createElement('base');
60 | resolveDoc.head.appendChild(resolveDoc.base);
61 | resolveDoc.anchor = resolveDoc.createElement('a');
62 | resolveDoc.body.appendChild(resolveDoc.anchor);
63 | }
64 | resolveDoc.base.href = baseURI;
65 | resolveDoc.anchor.href = url;
66 | return resolveDoc.anchor.href || url;
67 |
68 | }
69 |
70 | /**
71 | * Resolves any relative URL's in the given CSS text against the provided
72 | * `ownerDocument`'s `baseURI`.
73 | *
74 | * @param {string} cssText CSS text to process
75 | * @param {string} baseURI Base URI to resolve the URL against
76 | * @return {string} Processed CSS text with resolved URL's
77 | */
78 | export function resolveCss(cssText, baseURI) {
79 | return cssText.replace(CSS_URL_RX, function(m, pre, url, post) {
80 | return pre + '\'' +
81 | resolveUrl(url.replace(/["']/g, ''), baseURI) +
82 | '\'' + post;
83 | });
84 | }
85 |
86 | /**
87 | * Returns a path from a given `url`. The path includes the trailing
88 | * `/` from the url.
89 | *
90 | * @param {string} url Input URL to transform
91 | * @return {string} resolved path
92 | */
93 | export function pathFromUrl(url) {
94 | return url.substring(0, url.lastIndexOf('/') + 1);
95 | }
96 |
--------------------------------------------------------------------------------
/lib/utils/scope-subtree.d.ts:
--------------------------------------------------------------------------------
1 | // tslint:disable:variable-name Describing an API that's defined elsewhere.
2 |
3 | export {scopeSubtree};
4 |
5 |
6 | /**
7 | * Ensure that elements in a ShadowDOM container are scoped correctly.
8 | * This function is only needed when ShadyDOM is used and unpatched DOM APIs are used in third party code.
9 | * This can happen in noPatch mode or when specialized APIs like ranges or tables are used to mutate DOM.
10 | *
11 | * @returns Returns a new MutationObserver on `container` if `shouldObserve` is true.
12 | */
13 | declare function scopeSubtree(container: Element, shouldObserve?: boolean): MutationObserver|null;
14 |
--------------------------------------------------------------------------------
/lib/utils/scope-subtree.js:
--------------------------------------------------------------------------------
1 | /**
2 | @license
3 | Copyright (c) 2019 The Polymer Project Authors. All rights reserved.
4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7 | Code distributed by Google as part of the polymer project is also
8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9 | */
10 |
11 | import './boot.js';
12 | import {wrap} from './wrap.js';
13 |
14 | const ShadyDOM = window.ShadyDOM;
15 | const ShadyCSS = window.ShadyCSS;
16 |
17 | /**
18 | * Return true if node scope is correct.
19 | *
20 | * @param {!Element} node Node to check scope
21 | * @param {!Node} scope Scope reference
22 | * @return {boolean} True if node is in scope
23 | */
24 | function sameScope(node, scope) {
25 | return wrap(node).getRootNode() === scope;
26 | }
27 |
28 | /**
29 | * Ensure that elements in a ShadowDOM container are scoped correctly.
30 | * This function is only needed when ShadyDOM is used and unpatched DOM APIs are used in third party code.
31 | * This can happen in noPatch mode or when specialized APIs like ranges or tables are used to mutate DOM.
32 | *
33 | * @param {!Element} container Container element to scope
34 | * @param {boolean=} shouldObserve if true, start a mutation observer for added nodes to the container
35 | * @return {?MutationObserver} Returns a new MutationObserver on `container` if `shouldObserve` is true.
36 | */
37 | export function scopeSubtree(container, shouldObserve = false) {
38 | // If using native ShadowDOM, abort
39 | if (!ShadyDOM || !ShadyCSS) {
40 | return null;
41 | }
42 | // ShadyCSS handles DOM mutations when ShadyDOM does not handle scoping itself
43 | if (!ShadyDOM['handlesDynamicScoping']) {
44 | return null;
45 | }
46 | const ScopingShim = ShadyCSS['ScopingShim'];
47 | // if ScopingShim is not available, abort
48 | if (!ScopingShim) {
49 | return null;
50 | }
51 | // capture correct scope for container
52 | const containerScope = ScopingShim['scopeForNode'](container);
53 | const root = wrap(container).getRootNode();
54 |
55 | const scopify = (node) => {
56 | if (!sameScope(node, root)) {
57 | return;
58 | }
59 | // NOTE: native qSA does not honor scoped DOM, but it is faster, and the same behavior as Polymer v1
60 | const elements = Array.from(ShadyDOM['nativeMethods']['querySelectorAll'].call(node, '*'));
61 | elements.push(node);
62 | for (let i = 0; i < elements.length; i++) {
63 | const el = elements[i];
64 | if (!sameScope(el, root)) {
65 | continue;
66 | }
67 | const currentScope = ScopingShim['currentScopeForNode'](el);
68 | if (currentScope !== containerScope) {
69 | if (currentScope !== '') {
70 | ScopingShim['unscopeNode'](el, currentScope);
71 | }
72 | ScopingShim['scopeNode'](el, containerScope);
73 | }
74 | }
75 | };
76 |
77 | // scope everything in container
78 | scopify(container);
79 |
80 | if (shouldObserve) {
81 | const mo = new MutationObserver((mxns) => {
82 | for (let i = 0; i < mxns.length; i++) {
83 | const mxn = mxns[i];
84 | for (let j = 0; j < mxn.addedNodes.length; j++) {
85 | const addedNode = mxn.addedNodes[j];
86 | if (addedNode.nodeType === Node.ELEMENT_NODE) {
87 | scopify(addedNode);
88 | }
89 | }
90 | }
91 | });
92 | mo.observe(container, {childList: true, subtree: true});
93 | return mo;
94 | } else {
95 | return null;
96 | }
97 | }
--------------------------------------------------------------------------------
/lib/utils/style-gather.d.ts:
--------------------------------------------------------------------------------
1 | // tslint:disable:variable-name Describing an API that's defined elsewhere.
2 |
3 | import {DomModule} from '../elements/dom-module.js';
4 |
5 | import {resolveCss} from './resolve-url.js';
6 |
7 | export {stylesFromModules};
8 |
9 |
10 | /**
11 | * Returns a list of
15 |
16 |
17 |
18 | Perf is go.
19 |
20 |
21 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/test/smoke/alacarte-property-accessors.html:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
49 |
50 |
51 |
52 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/test/smoke/alacarte-property-effects-ordering.html:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
30 |
31 |
32 | [[limited]]
33 |
34 |
35 |
36 |
37 |
125 |
126 |
127 |
128 |
129 |
130 |
--------------------------------------------------------------------------------
/test/smoke/alacarte-property-effects.html:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
30 |
31 |
32 | [[limited]]
33 |
34 |
35 |
81 |
82 |
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/test/smoke/alacarte-template-stamp.html:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
31 |
32 |
33 |
34 |
35 |
36 |
90 |
91 |
92 |
93 |
94 |
95 |
--------------------------------------------------------------------------------
/test/smoke/behavior-mixin.html:
--------------------------------------------------------------------------------
1 | |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | behavior says: {{behaviorProp}}
21 | element says: {{prop}}
22 |
23 |
24 |
92 |
93 |
94 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/test/smoke/dirty-check.html:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 1 + [[foo]] = [[bar]]
21 |
22 |
23 |
24 |
51 |
52 |
53 |
54 |
55 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/test/smoke/disable-upgrade.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
17 |
18 |
19 |
20 |
21 |
30 | [[prop]]
31 |
32 |
33 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
67 | x-disabled without disable-upgrade
68 | Disabled
69 | x-disabled with disable-upgrade
70 | Disabled
71 | x-disabled with disable-upgrade
72 | Disabled
73 |
74 |
75 |
76 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
--------------------------------------------------------------------------------
/test/smoke/disabled-attr-gestures.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/test/smoke/dom-if.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
27 |
28 |
Child1
29 |
30 | Child2
31 |
32 |
33 |
34 |
35 |
36 |
37 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/test/smoke/gestures.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | Click on me \o/ 1
35 | Click on me \o/ 2
36 | Click on me \o/ 3
37 | Click on me \o/ 4
38 | Click on me \o/ 5
39 |
40 |
41 |
42 |
43 |
48 |
49 |
--------------------------------------------------------------------------------
/test/smoke/html-tag.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
54 |
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/test/smoke/label-click.html:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/test/smoke/passive-gestures.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
15 |
19 |
25 |
26 |
27 |
28 |
29 |
39 |
40 |
41 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/test/smoke/style-props/src/elements-defaults.js:
--------------------------------------------------------------------------------
1 | const $_documentContainer = document.createElement('div');
2 | $_documentContainer.setAttribute('style', 'display: none;');
3 |
4 | $_documentContainer.innerHTML = ``;
14 |
15 | document.head.appendChild($_documentContainer);
16 |
--------------------------------------------------------------------------------
/test/smoke/style-props/src/elements.js:
--------------------------------------------------------------------------------
1 | import './elements-defaults.js';
2 | import { Polymer } from '../../../../lib/legacy/polymer-fn.js';
3 | import { html } from '../../../../lib/utils/html-tag.js';
4 | Polymer({
5 | _template: html`
6 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 | `,
56 |
57 | is: 'x-s'
58 | });
59 | Polymer({
60 | _template: html`
61 |
96 |
97 |
98 |
99 |
100 |
101 | `,
102 |
103 | is: 'x-ss'
104 | });
105 |
--------------------------------------------------------------------------------
/test/smoke/style-props/src/settings.js:
--------------------------------------------------------------------------------
1 | import { Polymer } from '../../../../lib/legacy/polymer-fn.js';
2 | import { html } from '../../../../lib/utils/html-tag.js';
3 | const $_documentContainer = document.createElement('div');
4 | $_documentContainer.setAttribute('style', 'display: none;');
5 |
6 | $_documentContainer.innerHTML = `
7 |
8 |
30 |
31 | `;
32 |
33 | document.head.appendChild($_documentContainer);
34 | Polymer({
35 | _template: html`
36 |
60 |
61 | `,
62 |
63 | is: 'x-setting',
64 |
65 | listeners: {
66 | click: 'clickHandler'
67 | },
68 |
69 | ready: function() {
70 | this.setting = this.textContent;
71 | const obj = {
72 | '--setting-color': 'var(' + this.setting + ')'
73 | }
74 | this.updateStyles(obj);
75 | },
76 |
77 | clickHandler: function() {
78 | this.fire('setting-change', this.setting);
79 | }
80 | });
81 |
--------------------------------------------------------------------------------
/test/smoke/style-props/test.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | style properties
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
17 |
18 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/test/unit/array-selector-elements.js:
--------------------------------------------------------------------------------
1 | /**
2 | @license
3 | Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7 | Code distributed by Google as part of the polymer project is also
8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9 | */
10 | import { Polymer } from '../../lib/legacy/polymer-fn.js';
11 |
12 | Polymer({
13 | is: 'observe-el',
14 | observers: [
15 | 'singleChanged(singleSelected.*)',
16 | 'multiChanged(multiSelected.*)'
17 | ],
18 | singleChanged: function() {},
19 | multiChanged: function() {}
20 | });
21 |
--------------------------------------------------------------------------------
/test/unit/case-map.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
40 |
--------------------------------------------------------------------------------
/test/unit/class-properties.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
38 |
39 |
--------------------------------------------------------------------------------
/test/unit/custom-style-async-import.html:
--------------------------------------------------------------------------------
1 |
10 |
11 |
18 |
19 |
20 |
21 |
28 | x-client
29 |
30 |
36 |
37 |
--------------------------------------------------------------------------------
/test/unit/custom-style-async-import.js:
--------------------------------------------------------------------------------
1 | import { Polymer } from '../../lib/legacy/polymer-fn.js';
2 |
3 | const $_documentContainer = document.createElement('template');
4 |
5 | $_documentContainer.innerHTML = `
6 |
13 |
14 |
15 |
16 |
23 | x-client
24 |
25 | `;
26 |
27 | document.body.appendChild($_documentContainer.content);
28 |
29 | Polymer({
30 | is: 'x-client'
31 | });
32 |
--------------------------------------------------------------------------------
/test/unit/custom-style-async.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
32 |
33 |
34 |
35 |
41 |
42 |
43 |
44 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/test/unit/custom-style-import.js:
--------------------------------------------------------------------------------
1 | /**
2 | @license
3 | Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7 | Code distributed by Google as part of the polymer project is also
8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9 | */
10 |
11 | import './sub/style-import.js';
12 | const $_documentContainer = document.createElement('template');
13 | $_documentContainer.setAttribute('style', 'display: none;');
14 |
15 | $_documentContainer.innerHTML = `
16 |
17 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
43 | `;
44 |
45 | document.head.appendChild($_documentContainer.content);
46 |
--------------------------------------------------------------------------------
/test/unit/custom-style-late.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
28 |
29 |
30 |
31 |
32 |
39 |
40 |
41 |
42 |
43 |
44 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/test/unit/custom-style-scope-cache.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
27 |
28 |
29 |
30 |
36 | cache-element
37 |
38 |
44 |
45 |
46 |
47 |
48 |
49 |
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/test/unit/dom-bind-elements1.js:
--------------------------------------------------------------------------------
1 | /**
2 | @license
3 | Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7 | Code distributed by Google as part of the polymer project is also
8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9 | */
10 | import { Polymer } from '../../lib/legacy/polymer-fn.js';
11 |
12 | import { html } from '../../lib/utils/html-tag.js';
13 | Polymer({
14 | is: 'x-basic',
15 | properties: {
16 | notifyingvalue: {
17 | notify: true
18 | }
19 | }
20 | });
21 | Polymer({
22 | _template: html`
23 |
24 | `,
25 |
26 | is: 'x-content'
27 | });
28 | Polymer({
29 | _template: html`
30 |
31 | `,
32 |
33 | is: 'x-attach-dom-bind',
34 |
35 | attached: function() {
36 | var domBind = document.createElement('dom-bind');
37 | var template = document.createElement('template');
38 |
39 | domBind.appendChild(template);
40 |
41 | var span = document.createElement('span');
42 | span.innerHTML = '{{hello}}';
43 |
44 | template.content.appendChild(span);
45 | domBind.hello = 'hey';
46 |
47 | this.$.local.appendChild(domBind);
48 | }
49 | });
50 | Polymer({
51 | _template: html`
52 |
53 | `,
54 |
55 | is: 'x-compose'
56 | });
57 | Polymer({
58 | is: 'x-produce-a',
59 | properties: {
60 | bindToText: {
61 | notify: true,
62 | value: 'this text is bound'
63 | }
64 | }
65 | });
66 |
--------------------------------------------------------------------------------
/test/unit/dom-bind-elements2.js:
--------------------------------------------------------------------------------
1 | /**
2 | @license
3 | Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7 | Code distributed by Google as part of the polymer project is also
8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9 | */
10 | import { Polymer } from '../../lib/legacy/polymer-fn.js';
11 |
12 | Polymer({
13 | is: 'x-needs-host',
14 | attached: function() {
15 | if (!this.__dataHost) {
16 | throw "No dataHost at ready time";
17 | }
18 | this.config = this.__dataHost.getAttribute('config');
19 | }
20 | });
21 |
--------------------------------------------------------------------------------
/test/unit/dynamic-imports/async-import.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
--------------------------------------------------------------------------------
/test/unit/dynamic-imports/async.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
--------------------------------------------------------------------------------
/test/unit/dynamic-imports/dynamic-element.js:
--------------------------------------------------------------------------------
1 | /**
2 | @license
3 | Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7 | Code distributed by Google as part of the polymer project is also
8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9 | */
10 | import '../../../polymer-legacy.js';
11 |
12 | import { Polymer } from '../../../lib/legacy/polymer-fn.js';
13 | import { html } from '../../../lib/utils/html-tag.js';
14 | import { dom } from '../../../lib/legacy/polymer.dom.js';
15 | Polymer({
16 | _template: html`
17 | dynamic-element :
18 | `,
19 |
20 | is: 'dynamic-element',
21 |
22 | ready: function() {
23 | var url = this.resolveUrl('outer-element.html');
24 | this.importHref(url, function() {
25 | this.$.outer = document.createElement('outer-element');
26 | dom(this.root).appendChild(this.$.outer);
27 | this._hasContent = true;
28 | if (this._callback) {
29 | this._callback();
30 | }
31 | }, function() {
32 | assert.fail('failed to load import', url);
33 | });
34 | },
35 |
36 | whenDynamicContentReady: function(callback) {
37 | this._callback = callback;
38 | if (this._hasContent) {
39 | this._callback();
40 | }
41 | }
42 | });
43 |
--------------------------------------------------------------------------------
/test/unit/dynamic-imports/inner-element.js:
--------------------------------------------------------------------------------
1 | /**
2 | @license
3 | Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7 | Code distributed by Google as part of the polymer project is also
8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9 | */
10 | import '../../../polymer-legacy.js';
11 |
12 | import { Polymer } from '../../../lib/legacy/polymer-fn.js';
13 | import { html } from '../../../lib/utils/html-tag.js';
14 | Polymer({
15 | _template: html`
16 | inner-element
17 | `,
18 |
19 | is: 'inner-element'
20 | });
21 |
--------------------------------------------------------------------------------
/test/unit/dynamic-imports/outer-element.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | outer-element :
19 |
20 |
21 |
22 |
23 |
31 |
--------------------------------------------------------------------------------
/test/unit/events-elements.js:
--------------------------------------------------------------------------------
1 | /**
2 | @license
3 | Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7 | Code distributed by Google as part of the polymer project is also
8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9 | */
10 | import { Base } from '../../polymer-legacy.js';
11 |
12 | import { Polymer } from '../../lib/legacy/polymer-fn.js';
13 | import { html } from '../../lib/utils/html-tag.js';
14 | var EventLoggerImpl = {
15 | created: function() {
16 | this._handled = {};
17 | this._removed = [];
18 | },
19 | handle: function(e) {
20 | const order = e._handleOrder = e._handleOrder || [];
21 | order.push(this.localName);
22 | this._handled[e.currentTarget.localName] = e.type;
23 | },
24 | unlisten: function(node, eventName, handler) {
25 | this._removed.push({target: node.localName, event: eventName});
26 | Base.unlisten.call(this, node, eventName, handler);
27 | }
28 | };
29 | Polymer({
30 | is: 'x-listeners',
31 | behaviors: [EventLoggerImpl],
32 | listeners: {
33 | foo: 'handle',
34 | bar: 'missing'
35 | }
36 | });
37 | Polymer({
38 | _template: html`
39 |
40 | `,
41 |
42 | is: 'x-on',
43 | behaviors: [EventLoggerImpl]
44 | });
45 | Polymer({
46 | _template: html`
47 |
48 | `,
49 |
50 | is: 'x-order',
51 | behaviors: [EventLoggerImpl]
52 | });
53 | Polymer({
54 | _template: html`
55 |
56 | `,
57 |
58 | is: 'x-dynamic',
59 | behaviors: [EventLoggerImpl],
60 |
61 | setup: function() {
62 | this.listen(this, 'foo', 'handle');
63 | this.listen(this.$.inner, 'foo', 'handle');
64 | this.listen(this, 'bar', 'missing');
65 | this.listen(this.$.inner, 'bar', 'missing');
66 | },
67 |
68 | teardown: function() {
69 | this.unlisten(this, 'foo', 'handle');
70 | this.unlisten(this.$.inner, 'foo', 'handle');
71 | this.unlisten(this, 'bar', 'missing');
72 | this.unlisten(this.$.inner, 'bar', 'missing');
73 | }
74 | });
75 | Polymer({
76 | is: 'x-double',
77 | behaviors: [EventLoggerImpl],
78 | ready: function() {
79 | this.fooChanged = sinon.spy();
80 | },
81 | setup: function() {
82 | this.listen(this, 'foo', 'fooChanged');
83 | this.listen(this, 'foo', 'fooChanged');
84 | },
85 | teardown: function() {
86 | this.unlisten(this, 'foo', 'fooChanged');
87 | }
88 | });
89 |
--------------------------------------------------------------------------------
/test/unit/globals.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | {{bindings(are, cool)}}
35 |
36 |
59 |
60 |
61 |
62 |
63 |
110 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/test/unit/importHref.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/test/unit/logging.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
36 |
37 |
55 |
104 |
105 |
106 |
--------------------------------------------------------------------------------
/test/unit/multi-style.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
36 |
41 | foo
42 | bar
43 |
44 |
45 |
46 |
47 |
48 |
49 |
54 | zug
55 | zot
56 |
57 |
58 |
60 |
61 |
62 |
63 |
125 |
126 |
127 |
--------------------------------------------------------------------------------
/test/unit/path.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
82 |
--------------------------------------------------------------------------------
/test/unit/polymer-element-with-apply-import.js:
--------------------------------------------------------------------------------
1 | /**
2 | @license
3 | Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7 | Code distributed by Google as part of the polymer project is also
8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9 | */
10 | import { PolymerElement } from '../../polymer-element.js';
11 |
12 | import '@webcomponents/shadycss/entrypoints/apply-shim.js';
13 | import '../../lib/elements/custom-style.js';
14 | import { html } from '../../lib/utils/html-tag.js';
15 | class ApplyElement extends PolymerElement {
16 | static get template() {
17 | return html`
18 |
24 | `;
25 | }
26 |
27 | static get is() {return 'apply-element';}
28 | }
29 | customElements.define('apply-element', ApplyElement);
30 | class XOuter extends PolymerElement {
31 | static get template() {
32 | return html`
33 |
49 |
50 | `;
51 | }
52 |
53 | static get is() {return 'x-outer';}
54 | }
55 | customElements.define('x-outer', XOuter);
56 |
--------------------------------------------------------------------------------
/test/unit/polymer-element-with-apply.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
66 |
67 |
--------------------------------------------------------------------------------
/test/unit/shady-unscoped-style-import.js:
--------------------------------------------------------------------------------
1 | /**
2 | @license
3 | Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7 | Code distributed by Google as part of the polymer project is also
8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9 | */
10 |
11 | const $_documentContainer = document.createElement('template');
12 | $_documentContainer.setAttribute('style', 'display: none;');
13 |
14 | $_documentContainer.innerHTML = `
15 |
16 |
26 |
27 |
32 |
33 |
34 | `;
35 |
36 | document.head.appendChild($_documentContainer.content);
37 |
--------------------------------------------------------------------------------
/test/unit/shady-unscoped-style.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
29 |
30 |
31 |
32 |
33 |
34 |
43 | Happy: green
44 | Happy: yellow
45 | Happy: orange
46 |
47 |
48 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
67 | Happy: green
68 | Happy: yellow
69 | Happy: orange
70 |
71 |
72 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
117 |
118 |
119 |
--------------------------------------------------------------------------------
/test/unit/styling-cross-scope-unknown-host.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
33 |
34 |
35 |
45 |
46 |
47 |
48 |
55 | x-foo
56 |
57 |
63 |
64 |
65 |
66 |
67 |
72 |
73 |
74 |
84 |
85 |
86 |
127 |
128 |
129 |
130 |
--------------------------------------------------------------------------------
/test/unit/styling-import-host2.css:
--------------------------------------------------------------------------------
1 | /*
2 | @license
3 | Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7 | Code distributed by Google as part of the polymer project is also
8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9 | */
10 | :host {
11 | display: block;
12 | border: 2px solid black;
13 | }
--------------------------------------------------------------------------------
/test/unit/styling-import-shared-styles.js:
--------------------------------------------------------------------------------
1 | /**
2 | @license
3 | Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7 | Code distributed by Google as part of the polymer project is also
8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9 | */
10 |
11 | const $_documentContainer = document.createElement('template');
12 | $_documentContainer.setAttribute('style', 'display: none;');
13 |
14 | $_documentContainer.innerHTML = `
15 |
20 |
21 |
22 |
23 |
28 |
29 | `;
30 |
31 | document.head.appendChild($_documentContainer.content);
32 |
--------------------------------------------------------------------------------
/test/unit/styling-only-with-template.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
30 |
31 |
32 |
33 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
55 |
56 |
79 |
80 |
--------------------------------------------------------------------------------
/test/unit/sub/resolveurl-elements.js:
--------------------------------------------------------------------------------
1 | /**
2 | @license
3 | Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
4 | This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5 | The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 | The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7 | Code distributed by Google as part of the polymer project is also
8 | subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9 | */
10 | import { html } from '../../../lib/utils/html-tag.js';
11 |
12 | import { PolymerElement } from '../../../polymer-element.js';
13 | import { DomModule } from '../../../lib/elements/dom-module.js';
14 | import { Polymer } from '../../../lib/legacy/polymer-fn.js';
15 | import { pathFromUrl } from '../../../lib/utils/resolve-url.js';
16 |
17 | const $_documentContainer = document.createElement('template');
18 | $_documentContainer.setAttribute('style', 'display: none;');
19 | const baseAssetPath = pathFromUrl(import.meta.url);
20 | $_documentContainer.innerHTML = ``;
21 | document.head.appendChild($_documentContainer.content);
22 |
23 | class PR extends PolymerElement {
24 | static get template() {
25 | return html`
26 |
33 |
34 |
35 | Foo
36 |
37 |
38 |
39 |
40 |
41 | Foo
42 | Foo
43 |
44 | Foo
45 | Foo
46 | Foo
47 | `;
48 | }
49 | static get is() { return 'p-r'; }
50 | static get importMeta() {
51 | return import.meta;
52 | }
53 | }
54 | customElements.define(PR.is, PR);
55 |
56 | const PRHybrid = Polymer({
57 | is: 'p-r-hybrid',
58 | _template: PR.template,
59 | importMeta: import.meta
60 | });
61 |
62 | class PRAp extends PolymerElement {
63 | static get is() { return 'p-r-ap'; }
64 | }
65 | customElements.define(PRAp.is, PRAp);
66 |
--------------------------------------------------------------------------------
/test/unit/sub/style-import.js:
--------------------------------------------------------------------------------
1 | import { pathFromUrl } from '../../../lib/utils/resolve-url.js';
2 |
3 | const $_documentContainer = document.createElement('template');
4 | $_documentContainer.setAttribute('style', 'display: none;');
5 | const baseAssetPath = pathFromUrl(import.meta.url);
6 | $_documentContainer.innerHTML = `
7 |
8 |
15 |
16 |
17 |
18 |
23 |
24 | `;
25 |
26 | document.head.appendChild($_documentContainer.content);
27 |
--------------------------------------------------------------------------------
/test/unit/sub/x-sub.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | test
4 |
5 |
12 |
--------------------------------------------------------------------------------
/test/unit/sub/x-test.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | sub
4 |
5 |
11 |
12 |
--------------------------------------------------------------------------------
/test/unit/template-stamp.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | a
25 |
26 | b
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
49 |
50 |
97 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/test/unit/wct-browser-config.js:
--------------------------------------------------------------------------------
1 | window.WCT = {
2 | environmentScripts: [
3 | 'stacky/lib/parsing.js',
4 | 'stacky/lib/formatting.js',
5 | 'stacky/lib/normalization.js',
6 | 'mocha/mocha.js',
7 | 'chai/chai.js',
8 | '@polymer/sinonjs/sinon.js',
9 | 'accessibility-developer-tools/dist/js/axs_testing.js',
10 | '@polymer/test-fixture/test-fixture.js'
11 | ]
12 | };
13 |
--------------------------------------------------------------------------------
/util/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "node": true
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/util/gen-changelog.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # @license
4 | # Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
5 | # This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
6 | # The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
7 | # The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
8 | # Code distributed by Google as part of the polymer project is also
9 | # subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
10 | #
11 |
12 | PRETTY="- %s ([commit](https://github.com/Polymer/polymer/commit/%h))%n"
13 | start="$1"
14 | end="$2"
15 |
16 | enddate=`git log -1 ${end} --pretty="%ai" | cut -d ' ' -f 1`
17 |
18 | old=""
19 | if [ -e CHANGELOG.md ]; then
20 | old="`sed -e '1,2d' CHANGELOG.md`"
21 | fi
22 |
23 | cat > CHANGELOG.md < blankRx.test(dom5.getTextContent(t)));
34 |
35 | class MinimalDocTransform extends Transform {
36 | constructor() {
37 | super({objectMode: true});
38 | }
39 | _transform(file, enc, cb) {
40 | let doc = parse5.parse(String(file.contents), {locationInfo: true});
41 | let vulc = dom5.query(doc, p.AND(p.hasTagName('div'), p.hasAttr('by-polymer-bundler'), p.hasAttr('hidden')));
42 | let charset = dom5.query(doc, p.AND(p.hasTagName('meta'), p.hasAttrValue('charset', 'UTF-8')));
43 |
44 | if (charset) {
45 | dom5.remove(charset);
46 | }
47 |
48 | dom5.removeNodeSaveChildren(vulc);
49 |
50 | let scripts = dom5.queryAll(doc, p.hasTagName('script'));
51 | let collector = scripts[0];
52 | let contents = [dom5.getTextContent(collector)];
53 | for (let i = 1, s; i < scripts.length; i++) {
54 | s = scripts[i];
55 | dom5.remove(s);
56 | contents.push(dom5.getTextContent(s));
57 | }
58 | dom5.setTextContent(collector, contents.join(''));
59 |
60 | onlyOneLicense(doc);
61 |
62 | dom5.removeFakeRootElements(doc);
63 |
64 | dom5.nodeWalkAll(doc, isBlankNode).forEach((t) => dom5.remove(t));
65 |
66 | file.contents = new Buffer(parse5.serialize(doc));
67 |
68 | cb(null, file);
69 | }
70 | }
71 |
72 | module.exports = () => new MinimalDocTransform();
73 |
--------------------------------------------------------------------------------
/util/travis-sauce-test.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | #
3 | # @license
4 | # Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
5 | # This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
6 | # The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
7 | # The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
8 | # Code distributed by Google as part of the polymer project is also
9 | # subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
10 | #
11 | set -x
12 | node ./node_modules/.bin/polymer test --npm --module-resolution=node -s 'windows 10/microsoftedge@15' -s 'windows 10/microsoftedge@17' -s 'windows 8.1/internet explorer@11' -s 'macos 10.13/safari@11' -s 'macos 10.13/safari@12' -s 'macos 10.13/safari@13' -s 'Linux/chrome@41'
--------------------------------------------------------------------------------
/wct.conf.json:
--------------------------------------------------------------------------------
1 | {
2 | "suites": ["test/runner.html"],
3 | "environmentImports": [
4 | "test-fixture/test-fixture.html"
5 | ],
6 | "plugins": {
7 | "local": {
8 | "browserOptions": {
9 | "chrome": [
10 | "headless",
11 | "disable-gpu",
12 | "no-sandbox"
13 | ]
14 | }
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------