Skip to content
This repository was archived by the owner on Sep 20, 2019. It is now read-only.

Commit 26216d9

Browse files
committed
release v0.7.16
2 parents d90a442 + e30d647 commit 26216d9

15 files changed

+842
-299
lines changed

CustomElements.js

Lines changed: 72 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Code distributed by Google as part of the polymer project is also
88
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
99
*/
10-
// @version 0.7.15
10+
// @version 0.7.16
1111
if (typeof WeakMap === "undefined") {
1212
(function() {
1313
var defineProperty = Object.defineProperty;
@@ -349,6 +349,77 @@ if (typeof WeakMap === "undefined") {
349349
}
350350
})(self);
351351

352+
(function(scope) {
353+
"use strict";
354+
if (!window.performance) {
355+
var start = Date.now();
356+
window.performance = {
357+
now: function() {
358+
return Date.now() - start;
359+
}
360+
};
361+
}
362+
if (!window.requestAnimationFrame) {
363+
window.requestAnimationFrame = function() {
364+
var nativeRaf = window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
365+
return nativeRaf ? function(callback) {
366+
return nativeRaf(function() {
367+
callback(performance.now());
368+
});
369+
} : function(callback) {
370+
return window.setTimeout(callback, 1e3 / 60);
371+
};
372+
}();
373+
}
374+
if (!window.cancelAnimationFrame) {
375+
window.cancelAnimationFrame = function() {
376+
return window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || function(id) {
377+
clearTimeout(id);
378+
};
379+
}();
380+
}
381+
var workingDefaultPrevented = function() {
382+
var e = document.createEvent("Event");
383+
e.initEvent("foo", true, true);
384+
e.preventDefault();
385+
return e.defaultPrevented;
386+
}();
387+
if (!workingDefaultPrevented) {
388+
var origPreventDefault = Event.prototype.preventDefault;
389+
Event.prototype.preventDefault = function() {
390+
if (!this.cancelable) {
391+
return;
392+
}
393+
origPreventDefault.call(this);
394+
Object.defineProperty(this, "defaultPrevented", {
395+
get: function() {
396+
return true;
397+
}
398+
});
399+
};
400+
}
401+
var isIE = /Trident/.test(navigator.userAgent);
402+
if (!window.CustomEvent || isIE && typeof window.CustomEvent !== "function") {
403+
window.CustomEvent = function(inType, params) {
404+
params = params || {};
405+
var e = document.createEvent("CustomEvent");
406+
e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);
407+
return e;
408+
};
409+
window.CustomEvent.prototype = window.Event.prototype;
410+
}
411+
if (!window.Event || isIE && typeof window.Event !== "function") {
412+
var origEvent = window.Event;
413+
window.Event = function(inType, params) {
414+
params = params || {};
415+
var e = document.createEvent("Event");
416+
e.initEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable));
417+
return e;
418+
};
419+
window.Event.prototype = origEvent.prototype;
420+
}
421+
})(window.WebComponents);
422+
352423
window.CustomElements = window.CustomElements || {
353424
flags: {}
354425
};
@@ -953,22 +1024,6 @@ window.CustomElements.addModule(function(scope) {
9531024
});
9541025
});
9551026
}
956-
if (!window.CustomEvent || isIE && typeof window.CustomEvent !== "function") {
957-
window.CustomEvent = function(inType, params) {
958-
params = params || {};
959-
var e = document.createEvent("CustomEvent");
960-
e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);
961-
e.preventDefault = function() {
962-
Object.defineProperty(this, "defaultPrevented", {
963-
get: function() {
964-
return true;
965-
}
966-
});
967-
};
968-
return e;
969-
};
970-
window.CustomEvent.prototype = window.Event.prototype;
971-
}
9721027
if (document.readyState === "complete" || scope.flags.eager) {
9731028
bootstrap();
9741029
} else if (document.readyState === "interactive" && !window.attachEvent && (!window.HTMLImports || window.HTMLImports.ready)) {

CustomElements.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

HTMLImports.js

Lines changed: 79 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Code distributed by Google as part of the polymer project is also
88
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
99
*/
10-
// @version 0.7.15
10+
// @version 0.7.16
1111
if (typeof WeakMap === "undefined") {
1212
(function() {
1313
var defineProperty = Object.defineProperty;
@@ -349,6 +349,77 @@ if (typeof WeakMap === "undefined") {
349349
}
350350
})(self);
351351

352+
(function(scope) {
353+
"use strict";
354+
if (!window.performance) {
355+
var start = Date.now();
356+
window.performance = {
357+
now: function() {
358+
return Date.now() - start;
359+
}
360+
};
361+
}
362+
if (!window.requestAnimationFrame) {
363+
window.requestAnimationFrame = function() {
364+
var nativeRaf = window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
365+
return nativeRaf ? function(callback) {
366+
return nativeRaf(function() {
367+
callback(performance.now());
368+
});
369+
} : function(callback) {
370+
return window.setTimeout(callback, 1e3 / 60);
371+
};
372+
}();
373+
}
374+
if (!window.cancelAnimationFrame) {
375+
window.cancelAnimationFrame = function() {
376+
return window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || function(id) {
377+
clearTimeout(id);
378+
};
379+
}();
380+
}
381+
var workingDefaultPrevented = function() {
382+
var e = document.createEvent("Event");
383+
e.initEvent("foo", true, true);
384+
e.preventDefault();
385+
return e.defaultPrevented;
386+
}();
387+
if (!workingDefaultPrevented) {
388+
var origPreventDefault = Event.prototype.preventDefault;
389+
Event.prototype.preventDefault = function() {
390+
if (!this.cancelable) {
391+
return;
392+
}
393+
origPreventDefault.call(this);
394+
Object.defineProperty(this, "defaultPrevented", {
395+
get: function() {
396+
return true;
397+
}
398+
});
399+
};
400+
}
401+
var isIE = /Trident/.test(navigator.userAgent);
402+
if (!window.CustomEvent || isIE && typeof window.CustomEvent !== "function") {
403+
window.CustomEvent = function(inType, params) {
404+
params = params || {};
405+
var e = document.createEvent("CustomEvent");
406+
e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);
407+
return e;
408+
};
409+
window.CustomEvent.prototype = window.Event.prototype;
410+
}
411+
if (!window.Event || isIE && typeof window.Event !== "function") {
412+
var origEvent = window.Event;
413+
window.Event = function(inType, params) {
414+
params = params || {};
415+
var e = document.createEvent("Event");
416+
e.initEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable));
417+
return e;
418+
};
419+
window.Event.prototype = origEvent.prototype;
420+
}
421+
})(window.WebComponents);
422+
352423
window.HTMLImports = window.HTMLImports || {
353424
flags: {}
354425
};
@@ -550,10 +621,14 @@ window.HTMLImports.addModule(function(scope) {
550621
request.open("GET", url, xhr.async);
551622
request.addEventListener("readystatechange", function(e) {
552623
if (request.readyState === 4) {
553-
var locationHeader = request.getResponseHeader("Location");
554624
var redirectedUrl = null;
555-
if (locationHeader) {
556-
var redirectedUrl = locationHeader.substr(0, 1) === "/" ? location.origin + locationHeader : locationHeader;
625+
try {
626+
var locationHeader = request.getResponseHeader("Location");
627+
if (locationHeader) {
628+
redirectedUrl = locationHeader.substr(0, 1) === "/" ? location.origin + locationHeader : locationHeader;
629+
}
630+
} catch (e) {
631+
console.error(e.message);
557632
}
558633
next.call(nextContext, !xhr.ok(request) && request, request.response || request.responseText, redirectedUrl);
559634
}
@@ -1067,22 +1142,6 @@ window.HTMLImports.addModule(function(scope) {
10671142
if (scope.useNative) {
10681143
return;
10691144
}
1070-
if (!window.CustomEvent || isIE && typeof window.CustomEvent !== "function") {
1071-
window.CustomEvent = function(inType, params) {
1072-
params = params || {};
1073-
var e = document.createEvent("CustomEvent");
1074-
e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);
1075-
e.preventDefault = function() {
1076-
Object.defineProperty(this, "defaultPrevented", {
1077-
get: function() {
1078-
return true;
1079-
}
1080-
});
1081-
};
1082-
return e;
1083-
};
1084-
window.CustomEvent.prototype = window.Event.prototype;
1085-
}
10861145
initializeModules();
10871146
var rootDocument = scope.rootDocument;
10881147
function bootstrap() {

HTMLImports.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MutationObserver.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Code distributed by Google as part of the polymer project is also
88
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
99
*/
10-
// @version 0.7.15
10+
// @version 0.7.16
1111
if (typeof WeakMap === "undefined") {
1212
(function() {
1313
var defineProperty = Object.defineProperty;

MutationObserver.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ShadowDOM.js

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Code distributed by Google as part of the polymer project is also
88
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
99
*/
10-
// @version 0.7.15
10+
// @version 0.7.16
1111
if (typeof WeakMap === "undefined") {
1212
(function() {
1313
var defineProperty = Object.defineProperty;
@@ -1118,6 +1118,23 @@ window.ShadowDOMPolyfill = {};
11181118
stopImmediatePropagationTable.set(this, true);
11191119
}
11201120
};
1121+
var supportsDefaultPrevented = function() {
1122+
var e = document.createEvent("Event");
1123+
e.initEvent("test", true, true);
1124+
e.preventDefault();
1125+
return e.defaultPrevented;
1126+
}();
1127+
if (!supportsDefaultPrevented) {
1128+
Event.prototype.preventDefault = function() {
1129+
if (!this.cancelable) return;
1130+
unsafeUnwrap(this).preventDefault();
1131+
Object.defineProperty(this, "defaultPrevented", {
1132+
get: function() {
1133+
return true;
1134+
}
1135+
});
1136+
};
1137+
}
11211138
registerWrapper(OriginalEvent, Event, document.createEvent("Event"));
11221139
function unwrapOptions(options) {
11231140
if (!options || !options.relatedTarget) return options;
@@ -3378,6 +3395,9 @@ window.ShadowDOMPolyfill = {};
33783395
},
33793396
elementFromPoint: function(x, y) {
33803397
return elementFromPoint(this, this.ownerDocument, x, y);
3398+
},
3399+
getSelection: function() {
3400+
return document.getSelection();
33813401
}
33823402
});
33833403
scope.wrappers.ShadowRoot = ShadowRoot;
@@ -3969,7 +3989,7 @@ window.ShadowDOMPolyfill = {};
39693989
unsafeUnwrap(this).removeRange(unwrap(range));
39703990
},
39713991
selectAllChildren: function(node) {
3972-
unsafeUnwrap(this).selectAllChildren(unwrapIfNeeded(node));
3992+
unsafeUnwrap(this).selectAllChildren(node instanceof ShadowRoot ? unsafeUnwrap(node.host) : unwrapIfNeeded(node));
39733993
},
39743994
toString: function() {
39753995
return unsafeUnwrap(this).toString();

ShadowDOM.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bower.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "webcomponentsjs",
33
"main": "webcomponents.js",
4-
"version": "0.7.15",
4+
"version": "0.7.16",
55
"homepage": "http://webcomponents.org",
66
"authors": [
77
"The Polymer Authors"
@@ -14,5 +14,8 @@
1414
"webcomponents"
1515
],
1616
"license": "BSD",
17-
"ignore": []
17+
"ignore": [],
18+
"devDependencies": {
19+
"web-component-tester": "~3.3.10"
20+
}
1821
}

0 commit comments

Comments
 (0)