Skip to content

Commit

Permalink
Merge branch 'master' into 5262-kschaaf-legacy-undefined-3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpschaaf committed Aug 28, 2018
2 parents 8d4e04b + dae727a commit c3912b9
Show file tree
Hide file tree
Showing 14 changed files with 1,739 additions and 3,237 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ before_script:
script:
- npm run generate-types
- node ./node_modules/.bin/polymer test --npm --module-resolution=node -l chrome
- node ./node_modules/.bin/polymer test --npm --module-resolution=node -l firefox
- xvfb-run node ./node_modules/.bin/polymer test --npm --module-resolution=node -l firefox
- if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then travis_wait 30 ./util/travis-sauce-test.sh; fi
env:
global:
Expand Down
17 changes: 3 additions & 14 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,6 @@ gulp.task('generate-externs', gulp.series('clean', async () => {
await fs.writeFile('externs/closure-types.js', `${header}${declarations}`);
}));

gulp.task('generate-typescript', async () => {
let genTs = require('@polymer/gen-typescript-declarations').generateDeclarations;
await del(['**/*.d.ts', '!interfaces.d.ts', '!node_modules/**']);
const config = await fs.readJson(path.join(__dirname, 'gen-tsd.json'));
const files = await genTs(__dirname, config);
for (const [filePath, contents] of files) {
await fs.outputFile(path.join(__dirname, filePath), contents);
}
});

const runClosureOnly = ({lintOnly}) => () => {
let entry, splitRx, joinRx, addClosureTypes;

Expand Down Expand Up @@ -274,10 +264,9 @@ gulp.task('lint-eslint', function() {
gulp.task('lint', gulp.series('lint-eslint'));

// TODO(timvdlippe): Add back `'generate-externs',` once we can generate externs again
gulp.task('generate-types', gulp.series('generate-typescript'));

gulp.task('update-version', () => {
return gulp.src('lib/utils/boot.js')
.pipe(replace(/(window.Polymer.version = )'\d+\.\d+\.\d+'/, `$1'${require('./package.json').version}'`))
.pipe(gulp.dest('lib/utils'));
return gulp.src('lib/mixins/element-mixin.js')
.pipe(replace(/(export const version = )'\d+\.\d+\.\d+'/, `$1'${require('./package.json').version}'`))
.pipe(gulp.dest('lib/mixins'));
});
15 changes: 14 additions & 1 deletion lib/elements/dom-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,25 @@ import { strictTemplatePolicy } from '../utils/settings.js';

let modules = {};
let lcModules = {};
/**
* Sets a dom-module into the global registry by id.
*
* @param {string} id dom-module id
* @param {DomModule} module dom-module instance
* @return {void}
*/
function setModule(id, module) {
// store id separate from lowercased id so that
// in all cases mixedCase id will stored distinctly
// and lowercase version is a fallback
modules[id] = lcModules[id.toLowerCase()] = module;
}
/**
* Retrieves a dom-module from the global registry by id.
*
* @param {string} id dom-module id
* @return {DomModule!} dom-module instance
*/
function findModule(id) {
return modules[id] || lcModules[id.toLowerCase()];
}
Expand Down Expand Up @@ -133,7 +146,7 @@ export class DomModule extends HTMLElement {
id = id || this.id;
if (id) {
// Under strictTemplatePolicy, reject and null out any re-registered
// dom-module since it is ambiguous whether first-in or last-in is trusted
// dom-module since it is ambiguous whether first-in or last-in is trusted
if (strictTemplatePolicy && findModule(id) !== undefined) {
setModule(id, null);
throw new Error(`strictTemplatePolicy: dom-module ${id} re-registered`);
Expand Down
14 changes: 14 additions & 0 deletions lib/mixins/element-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ import { PropertyEffects } from './property-effects.js';
import { PropertiesMixin } from './properties-mixin.js';
import { strictTemplatePolicy, allowTemplateFromDomModule } from '../utils/settings.js';

/**
* Current Polymer version in Semver notation.
* @type {string} Semver notation of the current version of Polymer.
*/
export const version = '3.0.5';

/**
* Element class mixin that provides the core API for Polymer's meta-programming
* features including template stamping, data-binding, attribute deserialization,
Expand Down Expand Up @@ -302,6 +308,14 @@ export const ElementMixin = dedupingMixin(base => {
*/
class PolymerElement extends polymerElementBase {

/**
* Current Polymer version in Semver notation.
* @type {string} Semver notation of the current version of Polymer.
*/
static get polymerElementVersion() {
return version;
}

/**
* Override of PropertiesMixin _finalizeClass to create observers and
* find the template.
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*
* @param {string} prop Property name
* @param {?Object} obj Reference object
* @return {string} Dereferenced value
* @return {string} Potentially renamed property name
*/
window.JSCompiler_renameProperty = function(prop, obj) {
return prop;
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/debounce.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class Debouncer {
* called once. Add this method to a custom element:
*
* ```js
* import {microtask} from '@polymer/polymer/lib/utils/async.js';
* import {microTask} from '@polymer/polymer/lib/utils/async.js';
* import {Debouncer} from '@polymer/polymer/lib/utils/debounce.js';
* // ...
*
Expand Down
3 changes: 1 addition & 2 deletions lib/utils/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const setRootPath = function(path) {
*
* @type {(function(*,string,string,Node):*)|undefined}
*/
export let sanitizeDOMValue = undefined;
export let sanitizeDOMValue = window.Polymer && window.Polymer.sanitizeDOMValue || undefined;

/**
* Sets the global sanitizeDOMValue available via this module's exported
Expand All @@ -65,7 +65,6 @@ export const setSanitizeDOMValue = function(newSanitizeDOMValue) {
sanitizeDOMValue = newSanitizeDOMValue;
};


/**
* Globally settable property to make Polymer Gestures use passive TouchEvent listeners when recognizing gestures.
* When set to `true`, gestures made from touch will not be able to prevent scrolling, allowing for smoother
Expand Down
2 changes: 2 additions & 0 deletions lib/utils/templatize.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ class TemplateInstanceBase extends base {
/**
* Override point for adding custom or simulated event handling.
*
* @override
* @param {!Node} node Node to add event listener to
* @param {string} eventName Name of event
* @param {function(!Event):void} handler Listener function to add
Expand Down Expand Up @@ -247,6 +248,7 @@ class TemplateInstanceBase extends base {
* textContent bindings while children are "hidden" and cache in
* private storage for later retrieval.
*
* @override
* @param {!Node} node The node to set a property on
* @param {string} prop The property to set
* @param {*} value The value to set
Expand Down
Loading

0 comments on commit c3912b9

Please sign in to comment.