aurelia-pal-browser
Advanced tools
Comparing version 1.1.0 to 1.2.0
{ | ||
"name": "aurelia-pal-browser", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "The browser-specific implementation of Aurelia's platform abstraction layer.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -32,2 +32,3 @@ var path = require('path'); | ||
'performance.js', | ||
'console.js', | ||
'custom-event.js', | ||
@@ -34,0 +35,0 @@ 'element-matches.js', |
@@ -8,8 +8,2 @@ define(['exports', 'aurelia-pal'], function (exports, _aureliaPal) { | ||
exports._DOM = exports._FEATURE = exports._PLATFORM = undefined; | ||
exports._ensureFunctionName = _ensureFunctionName; | ||
exports._ensureClassList = _ensureClassList; | ||
exports._ensurePerformance = _ensurePerformance; | ||
exports._ensureCustomEvent = _ensureCustomEvent; | ||
exports._ensureElementMatches = _ensureElementMatches; | ||
exports._ensureHTMLTemplateElement = _ensureHTMLTemplateElement; | ||
exports.initialize = initialize; | ||
@@ -39,4 +33,4 @@ | ||
function _ensureFunctionName() { | ||
function test() {} | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
var test = function test() {}; | ||
@@ -55,3 +49,3 @@ if (!test.name) { | ||
function _ensureClassList() { | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
if (!('classList' in document.createElement('_')) || document.createElementNS && !('classList' in document.createElementNS('http://www.w3.org/2000/svg', 'g'))) { | ||
@@ -220,3 +214,3 @@ (function () { | ||
function _ensurePerformance() { | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
// @license http://opensource.org/licenses/MIT | ||
@@ -244,3 +238,21 @@ if ('performance' in window === false) { | ||
function _ensureCustomEvent() { | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
(function () { | ||
var con = window.console = window.console || {}; | ||
var nop = function nop() {}; | ||
if (!con.memory) con.memory = {}; | ||
('assert,clear,count,debug,dir,dirxml,error,exception,group,' + 'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' + 'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn').split(',').forEach(function (m) { | ||
if (!con[m]) con[m] = nop; | ||
}); | ||
if (_typeof(con.log) === 'object') { | ||
'log,info,warn,error,assert,dir,clear,profile,profileEnd'.split(',').forEach(function (method) { | ||
console[method] = this.bind(console[method], console); | ||
}, Function.prototype.call); | ||
} | ||
})(); | ||
} | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
if (!window.CustomEvent || typeof window.CustomEvent !== 'function') { | ||
@@ -264,86 +276,74 @@ var _CustomEvent = function _CustomEvent(event, params) { | ||
function _ensureElementMatches() { | ||
if (Element && !Element.prototype.matches) { | ||
var proto = Element.prototype; | ||
proto.matches = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector || proto.webkitMatchesSelector; | ||
} | ||
if (Element && !Element.prototype.matches) { | ||
var proto = Element.prototype; | ||
proto.matches = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector || proto.webkitMatchesSelector; | ||
} | ||
var _FEATURE = exports._FEATURE = {}; | ||
var _FEATURE = exports._FEATURE = { | ||
shadowDOM: !!HTMLElement.prototype.attachShadow, | ||
scopedCSS: 'scoped' in document.createElement('style'), | ||
htmlTemplateElement: 'content' in document.createElement('template'), | ||
mutationObserver: !!(window.MutationObserver || window.WebKitMutationObserver), | ||
ensureHTMLTemplateElement: function ensureHTMLTemplateElement(t) { | ||
return t; | ||
} | ||
}; | ||
_FEATURE.shadowDOM = function () { | ||
return !!HTMLElement.prototype.attachShadow; | ||
}(); | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
(function () { | ||
var isSVGTemplate = function isSVGTemplate(el) { | ||
return el.tagName === 'template' && el.namespaceURI === 'http://www.w3.org/2000/svg'; | ||
}; | ||
_FEATURE.scopedCSS = function () { | ||
return 'scoped' in document.createElement('style'); | ||
}(); | ||
var fixSVGTemplateElement = function fixSVGTemplateElement(el) { | ||
var template = el.ownerDocument.createElement('template'); | ||
var attrs = el.attributes; | ||
var length = attrs.length; | ||
var attr = void 0; | ||
_FEATURE.htmlTemplateElement = function () { | ||
return 'content' in document.createElement('template'); | ||
}(); | ||
el.parentNode.insertBefore(template, el); | ||
_FEATURE.mutationObserver = function () { | ||
return !!(window.MutationObserver || window.WebKitMutationObserver); | ||
}(); | ||
while (length-- > 0) { | ||
attr = attrs[length]; | ||
template.setAttribute(attr.name, attr.value); | ||
el.removeAttribute(attr.name); | ||
} | ||
function _ensureHTMLTemplateElement() { | ||
function isSVGTemplate(el) { | ||
return el.tagName === 'template' && el.namespaceURI === 'http://www.w3.org/2000/svg'; | ||
} | ||
el.parentNode.removeChild(el); | ||
function fixSVGTemplateElement(el) { | ||
var template = el.ownerDocument.createElement('template'); | ||
var attrs = el.attributes; | ||
var length = attrs.length; | ||
var attr = void 0; | ||
return fixHTMLTemplateElement(template); | ||
}; | ||
el.parentNode.insertBefore(template, el); | ||
var fixHTMLTemplateElement = function fixHTMLTemplateElement(template) { | ||
var content = template.content = document.createDocumentFragment(); | ||
var child = void 0; | ||
while (length-- > 0) { | ||
attr = attrs[length]; | ||
template.setAttribute(attr.name, attr.value); | ||
el.removeAttribute(attr.name); | ||
} | ||
while (child = template.firstChild) { | ||
content.appendChild(child); | ||
} | ||
el.parentNode.removeChild(el); | ||
return template; | ||
}; | ||
return fixHTMLTemplateElement(template); | ||
} | ||
var fixHTMLTemplateElementRoot = function fixHTMLTemplateElementRoot(template) { | ||
var content = fixHTMLTemplateElement(template).content; | ||
var childTemplates = content.querySelectorAll('template'); | ||
function fixHTMLTemplateElement(template) { | ||
var content = template.content = document.createDocumentFragment(); | ||
var child = void 0; | ||
for (var i = 0, ii = childTemplates.length; i < ii; ++i) { | ||
var child = childTemplates[i]; | ||
while (child = template.firstChild) { | ||
content.appendChild(child); | ||
} | ||
return template; | ||
} | ||
function fixHTMLTemplateElementRoot(template) { | ||
var content = fixHTMLTemplateElement(template).content; | ||
var childTemplates = content.querySelectorAll('template'); | ||
for (var i = 0, ii = childTemplates.length; i < ii; ++i) { | ||
var child = childTemplates[i]; | ||
if (isSVGTemplate(child)) { | ||
fixSVGTemplateElement(child); | ||
} else { | ||
fixHTMLTemplateElement(child); | ||
if (isSVGTemplate(child)) { | ||
fixSVGTemplateElement(child); | ||
} else { | ||
fixHTMLTemplateElement(child); | ||
} | ||
} | ||
} | ||
return template; | ||
} | ||
if (_FEATURE.htmlTemplateElement) { | ||
_FEATURE.ensureHTMLTemplateElement = function (template) { | ||
return template; | ||
}; | ||
} else { | ||
_FEATURE.ensureHTMLTemplateElement = fixHTMLTemplateElementRoot; | ||
} | ||
if (!_FEATURE.htmlTemplateElement) { | ||
_FEATURE.ensureHTMLTemplateElement = fixHTMLTemplateElementRoot; | ||
} | ||
})(); | ||
} | ||
@@ -461,9 +461,2 @@ | ||
_ensureCustomEvent(); | ||
_ensureFunctionName(); | ||
_ensureHTMLTemplateElement(); | ||
_ensureElementMatches(); | ||
_ensureClassList(); | ||
_ensurePerformance(); | ||
(0, _aureliaPal.initializePAL)(function (platform, feature, dom) { | ||
@@ -474,24 +467,2 @@ Object.assign(platform, _PLATFORM); | ||
(function (global) { | ||
global.console = global.console || {}; | ||
var con = global.console; | ||
var prop = void 0; | ||
var method = void 0; | ||
var empty = {}; | ||
var dummy = function dummy() {}; | ||
var properties = 'memory'.split(','); | ||
var methods = ('assert,clear,count,debug,dir,dirxml,error,exception,group,' + 'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' + 'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn').split(','); | ||
while (prop = properties.pop()) { | ||
if (!con[prop]) con[prop] = empty; | ||
}while (method = methods.pop()) { | ||
if (!con[method]) con[method] = dummy; | ||
} | ||
})(platform.global); | ||
if (platform.global.console && _typeof(console.log) === 'object') { | ||
['log', 'info', 'warn', 'error', 'assert', 'dir', 'clear', 'profile', 'profileEnd'].forEach(function (method) { | ||
console[method] = this.bind(console[method], console); | ||
}, Function.prototype.call); | ||
} | ||
Object.defineProperty(dom, 'title', { | ||
@@ -498,0 +469,0 @@ get: function get() { |
@@ -6,2 +6,11 @@ import { | ||
// DOM polyfills | ||
// Actually inlined by our build because of build/paths.js but `import "m"` is not properly removed!? | ||
// import './console'; | ||
// import './custom-event'; | ||
// import './function-name'; | ||
// import './html-template-element'; | ||
// import './element-matches'; | ||
// import './class-list'; | ||
// import './performance'; | ||
/** | ||
@@ -8,0 +17,0 @@ * Initializes the PAL with the Browser-targeted implementation. |
@@ -18,3 +18,3 @@ import {initializePAL,isInitialized} from 'aurelia-pal'; | ||
export function _ensureFunctionName(): void { | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
// Fix Function#name on browsers that do not support it (IE): | ||
@@ -36,3 +36,3 @@ function test() {} | ||
export function _ensureClassList(): void { | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
/* | ||
@@ -215,3 +215,3 @@ * classList polyfill. Forked from https://github.com/eligrey/classList.js | ||
export function _ensurePerformance(): void { | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
// performance polyfill. Copied from https://gist.github.com/paulirish/5438650 | ||
@@ -242,3 +242,32 @@ | ||
export function _ensureCustomEvent(): void { | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
// References to IE 9 in this file mean the *real* IE 9 browser, not IE 11 in 9 emulation mode. | ||
// Note that in IE 9, until the F12 are actually opened window.console is undefined! | ||
let con = window.console = window.console || {}; | ||
let nop = function() {}; | ||
// console.memory is actually Chrome-only at this point, | ||
// but Aurelia does not use it so we're cutting down on "polyfills" here. | ||
// Moreover, that object is utterly useless in other browsers, as all stats would actually be 'undefined' | ||
if (!con.memory) con.memory = {}; | ||
('assert,clear,count,debug,dir,dirxml,error,exception,group,' + | ||
'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' + | ||
'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn') | ||
.split(',') | ||
.forEach(m => { if (!con[m]) con[m] = nop; }); | ||
// This is really f***ed up IE 9 stuff. | ||
// You can be in a situation where console.log is an object, not a function. | ||
// And the magic voodoo below that should _not_ work (the Function.prototype.call.bind(object,...) part) | ||
// actually kicks IE 9 into converting that object into a real function that actually logs stuff. | ||
// See http://patik.com/blog/complete-cross-browser-console-log/ | ||
if (typeof con.log === 'object') { | ||
'log,info,warn,error,assert,dir,clear,profile,profileEnd' | ||
.split(',') | ||
.forEach(function(method) { | ||
console[method] = this.bind(console[method], console); | ||
}, Function.prototype.call); | ||
} | ||
} | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
if (!window.CustomEvent || typeof window.CustomEvent !== 'function') { | ||
@@ -262,30 +291,18 @@ let CustomEvent = function(event, params) { | ||
export function _ensureElementMatches(): void { | ||
if (Element && !Element.prototype.matches) { | ||
let proto = Element.prototype; | ||
proto.matches = proto.matchesSelector || | ||
proto.mozMatchesSelector || proto.msMatchesSelector || | ||
proto.oMatchesSelector || proto.webkitMatchesSelector; | ||
} | ||
if (Element && !Element.prototype.matches) { | ||
let proto = Element.prototype; | ||
proto.matches = proto.matchesSelector || | ||
proto.mozMatchesSelector || proto.msMatchesSelector || | ||
proto.oMatchesSelector || proto.webkitMatchesSelector; | ||
} | ||
export const _FEATURE = {}; | ||
export const _FEATURE = { | ||
shadowDOM: !!HTMLElement.prototype.attachShadow, | ||
scopedCSS: 'scoped' in document.createElement('style'), | ||
htmlTemplateElement: 'content' in document.createElement('template'), | ||
mutationObserver: !!(window.MutationObserver || window.WebKitMutationObserver), | ||
ensureHTMLTemplateElement: t => t, | ||
}; | ||
_FEATURE.shadowDOM = (function() { | ||
return !!HTMLElement.prototype.attachShadow; | ||
})(); | ||
_FEATURE.scopedCSS = (function() { | ||
return 'scoped' in document.createElement('style'); | ||
})(); | ||
_FEATURE.htmlTemplateElement = (function() { | ||
return 'content' in document.createElement('template'); | ||
})(); | ||
_FEATURE.mutationObserver = (function() { | ||
return !!(window.MutationObserver || window.WebKitMutationObserver); | ||
})(); | ||
export function _ensureHTMLTemplateElement(): void { | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
function isSVGTemplate(el) { | ||
@@ -343,5 +360,3 @@ return el.tagName === 'template' && | ||
if (_FEATURE.htmlTemplateElement) { | ||
_FEATURE.ensureHTMLTemplateElement = function(template) { return template; }; | ||
} else { | ||
if (!_FEATURE.htmlTemplateElement) { | ||
_FEATURE.ensureHTMLTemplateElement = fixHTMLTemplateElementRoot; | ||
@@ -459,2 +474,12 @@ } | ||
// DOM polyfills | ||
// Actually inlined by our build because of build/paths.js but `import "m"` is not properly removed!? | ||
// import './console'; | ||
// import './custom-event'; | ||
// import './function-name'; | ||
// import './html-template-element'; | ||
// import './element-matches'; | ||
// import './class-list'; | ||
// import './performance'; | ||
/** | ||
@@ -468,9 +493,2 @@ * Initializes the PAL with the Browser-targeted implementation. | ||
_ensureCustomEvent(); | ||
_ensureFunctionName(); | ||
_ensureHTMLTemplateElement(); | ||
_ensureElementMatches(); | ||
_ensureClassList(); | ||
_ensurePerformance(); | ||
initializePAL((platform, feature, dom) => { | ||
@@ -481,44 +499,15 @@ Object.assign(platform, _PLATFORM); | ||
(function(global) { | ||
global.console = global.console || {}; | ||
let con = global.console; | ||
let prop; | ||
let method; | ||
let empty = {}; | ||
let dummy = function() {}; | ||
let properties = 'memory'.split(','); | ||
let methods = ('assert,clear,count,debug,dir,dirxml,error,exception,group,' + | ||
'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' + | ||
'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn').split(','); | ||
while (prop = properties.pop()) if (!con[prop]) con[prop] = empty; | ||
while (method = methods.pop()) if (!con[method]) con[method] = dummy; | ||
})(platform.global); | ||
if (platform.global.console && typeof console.log === 'object') { | ||
['log', 'info', 'warn', 'error', 'assert', 'dir', 'clear', 'profile', 'profileEnd'].forEach(function(method) { | ||
console[method] = this.bind(console[method], console); | ||
}, Function.prototype.call); | ||
} | ||
Object.defineProperty(dom, 'title', { | ||
get: function() { | ||
return document.title; | ||
}, | ||
set: function(value) { | ||
document.title = value; | ||
} | ||
get: () => document.title, | ||
set: (value) => { document.title = value; } | ||
}); | ||
Object.defineProperty(dom, 'activeElement', { | ||
get: function() { | ||
return document.activeElement; | ||
} | ||
get: () => document.activeElement | ||
}); | ||
Object.defineProperty(platform, 'XMLHttpRequest', { | ||
get: function() { | ||
return platform.global.XMLHttpRequest; | ||
} | ||
get: () => platform.global.XMLHttpRequest | ||
}); | ||
}); | ||
} |
@@ -10,8 +10,2 @@ 'use strict'; | ||
exports._ensureFunctionName = _ensureFunctionName; | ||
exports._ensureClassList = _ensureClassList; | ||
exports._ensurePerformance = _ensurePerformance; | ||
exports._ensureCustomEvent = _ensureCustomEvent; | ||
exports._ensureElementMatches = _ensureElementMatches; | ||
exports._ensureHTMLTemplateElement = _ensureHTMLTemplateElement; | ||
exports.initialize = initialize; | ||
@@ -37,4 +31,4 @@ | ||
function _ensureFunctionName() { | ||
function test() {} | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
var test = function test() {}; | ||
@@ -53,3 +47,3 @@ if (!test.name) { | ||
function _ensureClassList() { | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
if (!('classList' in document.createElement('_')) || document.createElementNS && !('classList' in document.createElementNS('http://www.w3.org/2000/svg', 'g'))) { | ||
@@ -218,3 +212,3 @@ (function () { | ||
function _ensurePerformance() { | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
// @license http://opensource.org/licenses/MIT | ||
@@ -242,3 +236,21 @@ if ('performance' in window === false) { | ||
function _ensureCustomEvent() { | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
(function () { | ||
var con = window.console = window.console || {}; | ||
var nop = function nop() {}; | ||
if (!con.memory) con.memory = {}; | ||
('assert,clear,count,debug,dir,dirxml,error,exception,group,' + 'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' + 'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn').split(',').forEach(function (m) { | ||
if (!con[m]) con[m] = nop; | ||
}); | ||
if (_typeof(con.log) === 'object') { | ||
'log,info,warn,error,assert,dir,clear,profile,profileEnd'.split(',').forEach(function (method) { | ||
console[method] = this.bind(console[method], console); | ||
}, Function.prototype.call); | ||
} | ||
})(); | ||
} | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
if (!window.CustomEvent || typeof window.CustomEvent !== 'function') { | ||
@@ -262,86 +274,74 @@ var _CustomEvent = function _CustomEvent(event, params) { | ||
function _ensureElementMatches() { | ||
if (Element && !Element.prototype.matches) { | ||
var proto = Element.prototype; | ||
proto.matches = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector || proto.webkitMatchesSelector; | ||
} | ||
if (Element && !Element.prototype.matches) { | ||
var proto = Element.prototype; | ||
proto.matches = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector || proto.webkitMatchesSelector; | ||
} | ||
var _FEATURE = exports._FEATURE = {}; | ||
var _FEATURE = exports._FEATURE = { | ||
shadowDOM: !!HTMLElement.prototype.attachShadow, | ||
scopedCSS: 'scoped' in document.createElement('style'), | ||
htmlTemplateElement: 'content' in document.createElement('template'), | ||
mutationObserver: !!(window.MutationObserver || window.WebKitMutationObserver), | ||
ensureHTMLTemplateElement: function ensureHTMLTemplateElement(t) { | ||
return t; | ||
} | ||
}; | ||
_FEATURE.shadowDOM = function () { | ||
return !!HTMLElement.prototype.attachShadow; | ||
}(); | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
(function () { | ||
var isSVGTemplate = function isSVGTemplate(el) { | ||
return el.tagName === 'template' && el.namespaceURI === 'http://www.w3.org/2000/svg'; | ||
}; | ||
_FEATURE.scopedCSS = function () { | ||
return 'scoped' in document.createElement('style'); | ||
}(); | ||
var fixSVGTemplateElement = function fixSVGTemplateElement(el) { | ||
var template = el.ownerDocument.createElement('template'); | ||
var attrs = el.attributes; | ||
var length = attrs.length; | ||
var attr = void 0; | ||
_FEATURE.htmlTemplateElement = function () { | ||
return 'content' in document.createElement('template'); | ||
}(); | ||
el.parentNode.insertBefore(template, el); | ||
_FEATURE.mutationObserver = function () { | ||
return !!(window.MutationObserver || window.WebKitMutationObserver); | ||
}(); | ||
while (length-- > 0) { | ||
attr = attrs[length]; | ||
template.setAttribute(attr.name, attr.value); | ||
el.removeAttribute(attr.name); | ||
} | ||
function _ensureHTMLTemplateElement() { | ||
function isSVGTemplate(el) { | ||
return el.tagName === 'template' && el.namespaceURI === 'http://www.w3.org/2000/svg'; | ||
} | ||
el.parentNode.removeChild(el); | ||
function fixSVGTemplateElement(el) { | ||
var template = el.ownerDocument.createElement('template'); | ||
var attrs = el.attributes; | ||
var length = attrs.length; | ||
var attr = void 0; | ||
return fixHTMLTemplateElement(template); | ||
}; | ||
el.parentNode.insertBefore(template, el); | ||
var fixHTMLTemplateElement = function fixHTMLTemplateElement(template) { | ||
var content = template.content = document.createDocumentFragment(); | ||
var child = void 0; | ||
while (length-- > 0) { | ||
attr = attrs[length]; | ||
template.setAttribute(attr.name, attr.value); | ||
el.removeAttribute(attr.name); | ||
} | ||
while (child = template.firstChild) { | ||
content.appendChild(child); | ||
} | ||
el.parentNode.removeChild(el); | ||
return template; | ||
}; | ||
return fixHTMLTemplateElement(template); | ||
} | ||
var fixHTMLTemplateElementRoot = function fixHTMLTemplateElementRoot(template) { | ||
var content = fixHTMLTemplateElement(template).content; | ||
var childTemplates = content.querySelectorAll('template'); | ||
function fixHTMLTemplateElement(template) { | ||
var content = template.content = document.createDocumentFragment(); | ||
var child = void 0; | ||
for (var i = 0, ii = childTemplates.length; i < ii; ++i) { | ||
var child = childTemplates[i]; | ||
while (child = template.firstChild) { | ||
content.appendChild(child); | ||
} | ||
return template; | ||
} | ||
function fixHTMLTemplateElementRoot(template) { | ||
var content = fixHTMLTemplateElement(template).content; | ||
var childTemplates = content.querySelectorAll('template'); | ||
for (var i = 0, ii = childTemplates.length; i < ii; ++i) { | ||
var child = childTemplates[i]; | ||
if (isSVGTemplate(child)) { | ||
fixSVGTemplateElement(child); | ||
} else { | ||
fixHTMLTemplateElement(child); | ||
if (isSVGTemplate(child)) { | ||
fixSVGTemplateElement(child); | ||
} else { | ||
fixHTMLTemplateElement(child); | ||
} | ||
} | ||
} | ||
return template; | ||
} | ||
if (_FEATURE.htmlTemplateElement) { | ||
_FEATURE.ensureHTMLTemplateElement = function (template) { | ||
return template; | ||
}; | ||
} else { | ||
_FEATURE.ensureHTMLTemplateElement = fixHTMLTemplateElementRoot; | ||
} | ||
if (!_FEATURE.htmlTemplateElement) { | ||
_FEATURE.ensureHTMLTemplateElement = fixHTMLTemplateElementRoot; | ||
} | ||
})(); | ||
} | ||
@@ -459,9 +459,2 @@ | ||
_ensureCustomEvent(); | ||
_ensureFunctionName(); | ||
_ensureHTMLTemplateElement(); | ||
_ensureElementMatches(); | ||
_ensureClassList(); | ||
_ensurePerformance(); | ||
(0, _aureliaPal.initializePAL)(function (platform, feature, dom) { | ||
@@ -472,24 +465,2 @@ Object.assign(platform, _PLATFORM); | ||
(function (global) { | ||
global.console = global.console || {}; | ||
var con = global.console; | ||
var prop = void 0; | ||
var method = void 0; | ||
var empty = {}; | ||
var dummy = function dummy() {}; | ||
var properties = 'memory'.split(','); | ||
var methods = ('assert,clear,count,debug,dir,dirxml,error,exception,group,' + 'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' + 'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn').split(','); | ||
while (prop = properties.pop()) { | ||
if (!con[prop]) con[prop] = empty; | ||
}while (method = methods.pop()) { | ||
if (!con[method]) con[method] = dummy; | ||
} | ||
})(platform.global); | ||
if (platform.global.console && _typeof(console.log) === 'object') { | ||
['log', 'info', 'warn', 'error', 'assert', 'dir', 'clear', 'profile', 'profileEnd'].forEach(function (method) { | ||
console[method] = this.bind(console[method], console); | ||
}, Function.prototype.call); | ||
} | ||
Object.defineProperty(dom, 'title', { | ||
@@ -496,0 +467,0 @@ get: function get() { |
@@ -18,3 +18,3 @@ import { initializePAL, isInitialized } from 'aurelia-pal'; | ||
export function _ensureFunctionName() { | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
function test() {} | ||
@@ -34,3 +34,3 @@ | ||
export function _ensureClassList() { | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
if (!('classList' in document.createElement('_')) || document.createElementNS && !('classList' in document.createElementNS('http://www.w3.org/2000/svg', 'g'))) { | ||
@@ -195,3 +195,3 @@ let protoProp = 'prototype'; | ||
export function _ensurePerformance() { | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
// @license http://opensource.org/licenses/MIT | ||
@@ -217,3 +217,19 @@ if ('performance' in window === false) { | ||
export function _ensureCustomEvent() { | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
let con = window.console = window.console || {}; | ||
let nop = function () {}; | ||
if (!con.memory) con.memory = {}; | ||
('assert,clear,count,debug,dir,dirxml,error,exception,group,' + 'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' + 'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn').split(',').forEach(m => { | ||
if (!con[m]) con[m] = nop; | ||
}); | ||
if (typeof con.log === 'object') { | ||
'log,info,warn,error,assert,dir,clear,profile,profileEnd'.split(',').forEach(function (method) { | ||
console[method] = this.bind(console[method], console); | ||
}, Function.prototype.call); | ||
} | ||
} | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
if (!window.CustomEvent || typeof window.CustomEvent !== 'function') { | ||
@@ -237,28 +253,16 @@ let CustomEvent = function (event, params) { | ||
export function _ensureElementMatches() { | ||
if (Element && !Element.prototype.matches) { | ||
let proto = Element.prototype; | ||
proto.matches = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector || proto.webkitMatchesSelector; | ||
} | ||
if (Element && !Element.prototype.matches) { | ||
let proto = Element.prototype; | ||
proto.matches = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector || proto.webkitMatchesSelector; | ||
} | ||
export const _FEATURE = {}; | ||
export const _FEATURE = { | ||
shadowDOM: !!HTMLElement.prototype.attachShadow, | ||
scopedCSS: 'scoped' in document.createElement('style'), | ||
htmlTemplateElement: 'content' in document.createElement('template'), | ||
mutationObserver: !!(window.MutationObserver || window.WebKitMutationObserver), | ||
ensureHTMLTemplateElement: t => t | ||
}; | ||
_FEATURE.shadowDOM = function () { | ||
return !!HTMLElement.prototype.attachShadow; | ||
}(); | ||
_FEATURE.scopedCSS = function () { | ||
return 'scoped' in document.createElement('style'); | ||
}(); | ||
_FEATURE.htmlTemplateElement = function () { | ||
return 'content' in document.createElement('template'); | ||
}(); | ||
_FEATURE.mutationObserver = function () { | ||
return !!(window.MutationObserver || window.WebKitMutationObserver); | ||
}(); | ||
export function _ensureHTMLTemplateElement() { | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
function isSVGTemplate(el) { | ||
@@ -315,7 +319,3 @@ return el.tagName === 'template' && el.namespaceURI === 'http://www.w3.org/2000/svg'; | ||
if (_FEATURE.htmlTemplateElement) { | ||
_FEATURE.ensureHTMLTemplateElement = function (template) { | ||
return template; | ||
}; | ||
} else { | ||
if (!_FEATURE.htmlTemplateElement) { | ||
_FEATURE.ensureHTMLTemplateElement = fixHTMLTemplateElementRoot; | ||
@@ -435,9 +435,2 @@ } | ||
_ensureCustomEvent(); | ||
_ensureFunctionName(); | ||
_ensureHTMLTemplateElement(); | ||
_ensureElementMatches(); | ||
_ensureClassList(); | ||
_ensurePerformance(); | ||
initializePAL((platform, feature, dom) => { | ||
@@ -448,26 +441,5 @@ Object.assign(platform, _PLATFORM); | ||
(function (global) { | ||
global.console = global.console || {}; | ||
let con = global.console; | ||
let prop; | ||
let method; | ||
let empty = {}; | ||
let dummy = function () {}; | ||
let properties = 'memory'.split(','); | ||
let methods = ('assert,clear,count,debug,dir,dirxml,error,exception,group,' + 'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' + 'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn').split(','); | ||
while (prop = properties.pop()) if (!con[prop]) con[prop] = empty; | ||
while (method = methods.pop()) if (!con[method]) con[method] = dummy; | ||
})(platform.global); | ||
if (platform.global.console && typeof console.log === 'object') { | ||
['log', 'info', 'warn', 'error', 'assert', 'dir', 'clear', 'profile', 'profileEnd'].forEach(function (method) { | ||
console[method] = this.bind(console[method], console); | ||
}, Function.prototype.call); | ||
} | ||
Object.defineProperty(dom, 'title', { | ||
get: function () { | ||
return document.title; | ||
}, | ||
set: function (value) { | ||
get: () => document.title, | ||
set: value => { | ||
document.title = value; | ||
@@ -478,13 +450,9 @@ } | ||
Object.defineProperty(dom, 'activeElement', { | ||
get: function () { | ||
return document.activeElement; | ||
} | ||
get: () => document.activeElement | ||
}); | ||
Object.defineProperty(platform, 'XMLHttpRequest', { | ||
get: function () { | ||
return platform.global.XMLHttpRequest; | ||
} | ||
get: () => platform.global.XMLHttpRequest | ||
}); | ||
}); | ||
} |
@@ -21,4 +21,4 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
export function _ensureFunctionName() { | ||
function test() {} | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
var test = function test() {}; | ||
@@ -37,3 +37,3 @@ if (!test.name) { | ||
export function _ensureClassList() { | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
if (!('classList' in document.createElement('_')) || document.createElementNS && !('classList' in document.createElementNS('http://www.w3.org/2000/svg', 'g'))) { | ||
@@ -202,3 +202,3 @@ (function () { | ||
export function _ensurePerformance() { | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
// @license http://opensource.org/licenses/MIT | ||
@@ -226,3 +226,21 @@ if ('performance' in window === false) { | ||
export function _ensureCustomEvent() { | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
(function () { | ||
var con = window.console = window.console || {}; | ||
var nop = function nop() {}; | ||
if (!con.memory) con.memory = {}; | ||
('assert,clear,count,debug,dir,dirxml,error,exception,group,' + 'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' + 'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn').split(',').forEach(function (m) { | ||
if (!con[m]) con[m] = nop; | ||
}); | ||
if (_typeof(con.log) === 'object') { | ||
'log,info,warn,error,assert,dir,clear,profile,profileEnd'.split(',').forEach(function (method) { | ||
console[method] = this.bind(console[method], console); | ||
}, Function.prototype.call); | ||
} | ||
})(); | ||
} | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
if (!window.CustomEvent || typeof window.CustomEvent !== 'function') { | ||
@@ -246,86 +264,74 @@ var _CustomEvent = function _CustomEvent(event, params) { | ||
export function _ensureElementMatches() { | ||
if (Element && !Element.prototype.matches) { | ||
var proto = Element.prototype; | ||
proto.matches = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector || proto.webkitMatchesSelector; | ||
} | ||
if (Element && !Element.prototype.matches) { | ||
var proto = Element.prototype; | ||
proto.matches = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector || proto.webkitMatchesSelector; | ||
} | ||
export var _FEATURE = {}; | ||
export var _FEATURE = { | ||
shadowDOM: !!HTMLElement.prototype.attachShadow, | ||
scopedCSS: 'scoped' in document.createElement('style'), | ||
htmlTemplateElement: 'content' in document.createElement('template'), | ||
mutationObserver: !!(window.MutationObserver || window.WebKitMutationObserver), | ||
ensureHTMLTemplateElement: function ensureHTMLTemplateElement(t) { | ||
return t; | ||
} | ||
}; | ||
_FEATURE.shadowDOM = function () { | ||
return !!HTMLElement.prototype.attachShadow; | ||
}(); | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
(function () { | ||
var isSVGTemplate = function isSVGTemplate(el) { | ||
return el.tagName === 'template' && el.namespaceURI === 'http://www.w3.org/2000/svg'; | ||
}; | ||
_FEATURE.scopedCSS = function () { | ||
return 'scoped' in document.createElement('style'); | ||
}(); | ||
var fixSVGTemplateElement = function fixSVGTemplateElement(el) { | ||
var template = el.ownerDocument.createElement('template'); | ||
var attrs = el.attributes; | ||
var length = attrs.length; | ||
var attr = void 0; | ||
_FEATURE.htmlTemplateElement = function () { | ||
return 'content' in document.createElement('template'); | ||
}(); | ||
el.parentNode.insertBefore(template, el); | ||
_FEATURE.mutationObserver = function () { | ||
return !!(window.MutationObserver || window.WebKitMutationObserver); | ||
}(); | ||
while (length-- > 0) { | ||
attr = attrs[length]; | ||
template.setAttribute(attr.name, attr.value); | ||
el.removeAttribute(attr.name); | ||
} | ||
export function _ensureHTMLTemplateElement() { | ||
function isSVGTemplate(el) { | ||
return el.tagName === 'template' && el.namespaceURI === 'http://www.w3.org/2000/svg'; | ||
} | ||
el.parentNode.removeChild(el); | ||
function fixSVGTemplateElement(el) { | ||
var template = el.ownerDocument.createElement('template'); | ||
var attrs = el.attributes; | ||
var length = attrs.length; | ||
var attr = void 0; | ||
return fixHTMLTemplateElement(template); | ||
}; | ||
el.parentNode.insertBefore(template, el); | ||
var fixHTMLTemplateElement = function fixHTMLTemplateElement(template) { | ||
var content = template.content = document.createDocumentFragment(); | ||
var child = void 0; | ||
while (length-- > 0) { | ||
attr = attrs[length]; | ||
template.setAttribute(attr.name, attr.value); | ||
el.removeAttribute(attr.name); | ||
} | ||
while (child = template.firstChild) { | ||
content.appendChild(child); | ||
} | ||
el.parentNode.removeChild(el); | ||
return template; | ||
}; | ||
return fixHTMLTemplateElement(template); | ||
} | ||
var fixHTMLTemplateElementRoot = function fixHTMLTemplateElementRoot(template) { | ||
var content = fixHTMLTemplateElement(template).content; | ||
var childTemplates = content.querySelectorAll('template'); | ||
function fixHTMLTemplateElement(template) { | ||
var content = template.content = document.createDocumentFragment(); | ||
var child = void 0; | ||
for (var i = 0, ii = childTemplates.length; i < ii; ++i) { | ||
var child = childTemplates[i]; | ||
while (child = template.firstChild) { | ||
content.appendChild(child); | ||
} | ||
return template; | ||
} | ||
function fixHTMLTemplateElementRoot(template) { | ||
var content = fixHTMLTemplateElement(template).content; | ||
var childTemplates = content.querySelectorAll('template'); | ||
for (var i = 0, ii = childTemplates.length; i < ii; ++i) { | ||
var child = childTemplates[i]; | ||
if (isSVGTemplate(child)) { | ||
fixSVGTemplateElement(child); | ||
} else { | ||
fixHTMLTemplateElement(child); | ||
if (isSVGTemplate(child)) { | ||
fixSVGTemplateElement(child); | ||
} else { | ||
fixHTMLTemplateElement(child); | ||
} | ||
} | ||
} | ||
return template; | ||
} | ||
if (_FEATURE.htmlTemplateElement) { | ||
_FEATURE.ensureHTMLTemplateElement = function (template) { | ||
return template; | ||
}; | ||
} else { | ||
_FEATURE.ensureHTMLTemplateElement = fixHTMLTemplateElementRoot; | ||
} | ||
if (!_FEATURE.htmlTemplateElement) { | ||
_FEATURE.ensureHTMLTemplateElement = fixHTMLTemplateElementRoot; | ||
} | ||
})(); | ||
} | ||
@@ -443,9 +449,2 @@ | ||
_ensureCustomEvent(); | ||
_ensureFunctionName(); | ||
_ensureHTMLTemplateElement(); | ||
_ensureElementMatches(); | ||
_ensureClassList(); | ||
_ensurePerformance(); | ||
initializePAL(function (platform, feature, dom) { | ||
@@ -456,24 +455,2 @@ Object.assign(platform, _PLATFORM); | ||
(function (global) { | ||
global.console = global.console || {}; | ||
var con = global.console; | ||
var prop = void 0; | ||
var method = void 0; | ||
var empty = {}; | ||
var dummy = function dummy() {}; | ||
var properties = 'memory'.split(','); | ||
var methods = ('assert,clear,count,debug,dir,dirxml,error,exception,group,' + 'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' + 'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn').split(','); | ||
while (prop = properties.pop()) { | ||
if (!con[prop]) con[prop] = empty; | ||
}while (method = methods.pop()) { | ||
if (!con[method]) con[method] = dummy; | ||
} | ||
})(platform.global); | ||
if (platform.global.console && _typeof(console.log) === 'object') { | ||
['log', 'info', 'warn', 'error', 'assert', 'dir', 'clear', 'profile', 'profileEnd'].forEach(function (method) { | ||
console[method] = this.bind(console[method], console); | ||
}, Function.prototype.call); | ||
} | ||
Object.defineProperty(dom, 'title', { | ||
@@ -480,0 +457,0 @@ get: function get() { |
@@ -6,419 +6,386 @@ 'use strict'; | ||
var initializePAL, isInitialized, _typeof, _PLATFORM, _FEATURE, shadowPoly, _DOM; | ||
var initializePAL, isInitialized, _typeof, _PLATFORM, test, testElement, createMethod, _CustomEvent, proto, _FEATURE, shadowPoly, _DOM; | ||
function _ensureFunctionName() { | ||
function test() {} | ||
function initialize() { | ||
if (isInitialized) { | ||
return; | ||
} | ||
if (!test.name) { | ||
Object.defineProperty(Function.prototype, 'name', { | ||
initializePAL(function (platform, feature, dom) { | ||
Object.assign(platform, _PLATFORM); | ||
Object.assign(feature, _FEATURE); | ||
Object.assign(dom, _DOM); | ||
Object.defineProperty(dom, 'title', { | ||
get: function get() { | ||
var name = this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]; | ||
return document.title; | ||
}, | ||
set: function set(value) { | ||
document.title = value; | ||
} | ||
}); | ||
Object.defineProperty(this, 'name', { value: name }); | ||
return name; | ||
Object.defineProperty(dom, 'activeElement', { | ||
get: function get() { | ||
return document.activeElement; | ||
} | ||
}); | ||
} | ||
Object.defineProperty(platform, 'XMLHttpRequest', { | ||
get: function get() { | ||
return platform.global.XMLHttpRequest; | ||
} | ||
}); | ||
}); | ||
} | ||
_export('_ensureFunctionName', _ensureFunctionName); | ||
_export('initialize', initialize); | ||
function _ensureClassList() { | ||
if (!('classList' in document.createElement('_')) || document.createElementNS && !('classList' in document.createElementNS('http://www.w3.org/2000/svg', 'g'))) { | ||
(function () { | ||
var protoProp = 'prototype'; | ||
var strTrim = String.prototype.trim; | ||
var arrIndexOf = Array.prototype.indexOf; | ||
var emptyArray = []; | ||
return { | ||
setters: [function (_aureliaPal) { | ||
initializePAL = _aureliaPal.initializePAL; | ||
isInitialized = _aureliaPal.isInitialized; | ||
}], | ||
execute: function () { | ||
_typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
var DOMEx = function DOMEx(type, message) { | ||
this.name = type; | ||
this.code = DOMException[type]; | ||
this.message = message; | ||
}; | ||
_export('_PLATFORM', _PLATFORM = { | ||
location: window.location, | ||
history: window.history, | ||
addEventListener: function addEventListener(eventName, callback, capture) { | ||
this.global.addEventListener(eventName, callback, capture); | ||
}, | ||
removeEventListener: function removeEventListener(eventName, callback, capture) { | ||
this.global.removeEventListener(eventName, callback, capture); | ||
}, | ||
var checkTokenAndGetIndex = function checkTokenAndGetIndex(classList, token) { | ||
if (token === '') { | ||
throw new DOMEx('SYNTAX_ERR', 'An invalid or illegal string was specified'); | ||
} | ||
performance: window.performance, | ||
requestAnimationFrame: function requestAnimationFrame(callback) { | ||
return this.global.requestAnimationFrame(callback); | ||
} | ||
}); | ||
if (/\s/.test(token)) { | ||
throw new DOMEx('INVALID_CHARACTER_ERR', 'String contains an invalid character'); | ||
} | ||
_export('_PLATFORM', _PLATFORM); | ||
return arrIndexOf.call(classList, token); | ||
}; | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
test = function test() {}; | ||
var ClassList = function ClassList(elem) { | ||
var trimmedClasses = strTrim.call(elem.getAttribute('class') || ''); | ||
var classes = trimmedClasses ? trimmedClasses.split(/\s+/) : emptyArray; | ||
if (!test.name) { | ||
Object.defineProperty(Function.prototype, 'name', { | ||
get: function get() { | ||
var name = this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]; | ||
for (var i = 0, ii = classes.length; i < ii; ++i) { | ||
this.push(classes[i]); | ||
} | ||
Object.defineProperty(this, 'name', { value: name }); | ||
return name; | ||
} | ||
}); | ||
} | ||
} | ||
this._updateClassName = function () { | ||
elem.setAttribute('class', this.toString()); | ||
}; | ||
}; | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
if (!('classList' in document.createElement('_')) || document.createElementNS && !('classList' in document.createElementNS('http://www.w3.org/2000/svg', 'g'))) { | ||
(function () { | ||
var protoProp = 'prototype'; | ||
var strTrim = String.prototype.trim; | ||
var arrIndexOf = Array.prototype.indexOf; | ||
var emptyArray = []; | ||
var classListProto = ClassList[protoProp] = []; | ||
var DOMEx = function DOMEx(type, message) { | ||
this.name = type; | ||
this.code = DOMException[type]; | ||
this.message = message; | ||
}; | ||
DOMEx[protoProp] = Error[protoProp]; | ||
var checkTokenAndGetIndex = function checkTokenAndGetIndex(classList, token) { | ||
if (token === '') { | ||
throw new DOMEx('SYNTAX_ERR', 'An invalid or illegal string was specified'); | ||
} | ||
classListProto.item = function (i) { | ||
return this[i] || null; | ||
}; | ||
if (/\s/.test(token)) { | ||
throw new DOMEx('INVALID_CHARACTER_ERR', 'String contains an invalid character'); | ||
} | ||
classListProto.contains = function (token) { | ||
token += ''; | ||
return checkTokenAndGetIndex(this, token) !== -1; | ||
}; | ||
return arrIndexOf.call(classList, token); | ||
}; | ||
classListProto.add = function () { | ||
var tokens = arguments; | ||
var i = 0; | ||
var ii = tokens.length; | ||
var token = void 0; | ||
var updated = false; | ||
var ClassList = function ClassList(elem) { | ||
var trimmedClasses = strTrim.call(elem.getAttribute('class') || ''); | ||
var classes = trimmedClasses ? trimmedClasses.split(/\s+/) : emptyArray; | ||
do { | ||
token = tokens[i] + ''; | ||
if (checkTokenAndGetIndex(this, token) === -1) { | ||
this.push(token); | ||
updated = true; | ||
} | ||
} while (++i < ii); | ||
for (var i = 0, ii = classes.length; i < ii; ++i) { | ||
this.push(classes[i]); | ||
} | ||
if (updated) { | ||
this._updateClassName(); | ||
} | ||
}; | ||
this._updateClassName = function () { | ||
elem.setAttribute('class', this.toString()); | ||
}; | ||
}; | ||
classListProto.remove = function () { | ||
var tokens = arguments; | ||
var i = 0; | ||
var ii = tokens.length; | ||
var token = void 0; | ||
var updated = false; | ||
var index = void 0; | ||
var classListProto = ClassList[protoProp] = []; | ||
do { | ||
token = tokens[i] + ''; | ||
index = checkTokenAndGetIndex(this, token); | ||
while (index !== -1) { | ||
this.splice(index, 1); | ||
updated = true; | ||
index = checkTokenAndGetIndex(this, token); | ||
} | ||
} while (++i < ii); | ||
DOMEx[protoProp] = Error[protoProp]; | ||
if (updated) { | ||
this._updateClassName(); | ||
} | ||
}; | ||
classListProto.item = function (i) { | ||
return this[i] || null; | ||
}; | ||
classListProto.toggle = function (token, force) { | ||
token += ''; | ||
classListProto.contains = function (token) { | ||
token += ''; | ||
return checkTokenAndGetIndex(this, token) !== -1; | ||
}; | ||
var result = this.contains(token); | ||
var method = result ? force !== true && 'remove' : force !== false && 'add'; | ||
classListProto.add = function () { | ||
var tokens = arguments; | ||
var i = 0; | ||
var ii = tokens.length; | ||
var token = void 0; | ||
var updated = false; | ||
if (method) { | ||
this[method](token); | ||
} | ||
do { | ||
token = tokens[i] + ''; | ||
if (checkTokenAndGetIndex(this, token) === -1) { | ||
this.push(token); | ||
updated = true; | ||
} | ||
} while (++i < ii); | ||
if (force === true || force === false) { | ||
return force; | ||
} | ||
if (updated) { | ||
this._updateClassName(); | ||
} | ||
}; | ||
return !result; | ||
}; | ||
classListProto.remove = function () { | ||
var tokens = arguments; | ||
var i = 0; | ||
var ii = tokens.length; | ||
var token = void 0; | ||
var updated = false; | ||
var index = void 0; | ||
classListProto.toString = function () { | ||
return this.join(' '); | ||
}; | ||
do { | ||
token = tokens[i] + ''; | ||
index = checkTokenAndGetIndex(this, token); | ||
while (index !== -1) { | ||
this.splice(index, 1); | ||
updated = true; | ||
index = checkTokenAndGetIndex(this, token); | ||
} | ||
} while (++i < ii); | ||
Object.defineProperty(Element.prototype, 'classList', { | ||
get: function get() { | ||
return new ClassList(this); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
})(); | ||
} else { | ||
var testElement = document.createElement('_'); | ||
testElement.classList.add('c1', 'c2'); | ||
if (updated) { | ||
this._updateClassName(); | ||
} | ||
}; | ||
if (!testElement.classList.contains('c2')) { | ||
var createMethod = function createMethod(method) { | ||
var original = DOMTokenList.prototype[method]; | ||
classListProto.toggle = function (token, force) { | ||
token += ''; | ||
DOMTokenList.prototype[method] = function (token) { | ||
for (var i = 0, ii = arguments.length; i < ii; ++i) { | ||
token = arguments[i]; | ||
original.call(this, token); | ||
} | ||
}; | ||
}; | ||
var result = this.contains(token); | ||
var method = result ? force !== true && 'remove' : force !== false && 'add'; | ||
createMethod('add'); | ||
createMethod('remove'); | ||
} | ||
if (method) { | ||
this[method](token); | ||
} | ||
testElement.classList.toggle('c3', false); | ||
if (force === true || force === false) { | ||
return force; | ||
} | ||
if (testElement.classList.contains('c3')) { | ||
(function () { | ||
var _toggle = DOMTokenList.prototype.toggle; | ||
return !result; | ||
}; | ||
DOMTokenList.prototype.toggle = function (token, force) { | ||
if (1 in arguments && !this.contains(token) === !force) { | ||
return force; | ||
} | ||
classListProto.toString = function () { | ||
return this.join(' '); | ||
}; | ||
return _toggle.call(this, token); | ||
}; | ||
})(); | ||
} | ||
Object.defineProperty(Element.prototype, 'classList', { | ||
get: function get() { | ||
return new ClassList(this); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
})(); | ||
} else { | ||
testElement = document.createElement('_'); | ||
testElement = null; | ||
} | ||
} | ||
testElement.classList.add('c1', 'c2'); | ||
_export('_ensureClassList', _ensureClassList); | ||
if (!testElement.classList.contains('c2')) { | ||
createMethod = function createMethod(method) { | ||
var original = DOMTokenList.prototype[method]; | ||
function _ensurePerformance() { | ||
// @license http://opensource.org/licenses/MIT | ||
if ('performance' in window === false) { | ||
window.performance = {}; | ||
} | ||
DOMTokenList.prototype[method] = function (token) { | ||
for (var i = 0, ii = arguments.length; i < ii; ++i) { | ||
token = arguments[i]; | ||
original.call(this, token); | ||
} | ||
}; | ||
}; | ||
if ('now' in window.performance === false) { | ||
(function () { | ||
var nowOffset = Date.now(); | ||
createMethod('add'); | ||
createMethod('remove'); | ||
} | ||
if (performance.timing && performance.timing.navigationStart) { | ||
nowOffset = performance.timing.navigationStart; | ||
} | ||
testElement.classList.toggle('c3', false); | ||
window.performance.now = function now() { | ||
return Date.now() - nowOffset; | ||
}; | ||
})(); | ||
} | ||
if (testElement.classList.contains('c3')) { | ||
(function () { | ||
var _toggle = DOMTokenList.prototype.toggle; | ||
_PLATFORM.performance = window.performance; | ||
} | ||
DOMTokenList.prototype.toggle = function (token, force) { | ||
if (1 in arguments && !this.contains(token) === !force) { | ||
return force; | ||
} | ||
_export('_ensurePerformance', _ensurePerformance); | ||
return _toggle.call(this, token); | ||
}; | ||
})(); | ||
} | ||
function _ensureCustomEvent() { | ||
if (!window.CustomEvent || typeof window.CustomEvent !== 'function') { | ||
var _CustomEvent = function _CustomEvent(event, params) { | ||
params = params || { | ||
bubbles: false, | ||
cancelable: false, | ||
detail: undefined | ||
}; | ||
testElement = null; | ||
} | ||
} | ||
var evt = document.createEvent('CustomEvent'); | ||
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); | ||
return evt; | ||
}; | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
// @license http://opensource.org/licenses/MIT | ||
if ('performance' in window === false) { | ||
window.performance = {}; | ||
} | ||
_CustomEvent.prototype = window.Event.prototype; | ||
window.CustomEvent = _CustomEvent; | ||
} | ||
} | ||
if ('now' in window.performance === false) { | ||
(function () { | ||
var nowOffset = Date.now(); | ||
_export('_ensureCustomEvent', _ensureCustomEvent); | ||
if (performance.timing && performance.timing.navigationStart) { | ||
nowOffset = performance.timing.navigationStart; | ||
} | ||
function _ensureElementMatches() { | ||
if (Element && !Element.prototype.matches) { | ||
var proto = Element.prototype; | ||
proto.matches = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector || proto.webkitMatchesSelector; | ||
} | ||
} | ||
window.performance.now = function now() { | ||
return Date.now() - nowOffset; | ||
}; | ||
})(); | ||
} | ||
_export('_ensureElementMatches', _ensureElementMatches); | ||
function _ensureHTMLTemplateElement() { | ||
function isSVGTemplate(el) { | ||
return el.tagName === 'template' && el.namespaceURI === 'http://www.w3.org/2000/svg'; | ||
} | ||
function fixSVGTemplateElement(el) { | ||
var template = el.ownerDocument.createElement('template'); | ||
var attrs = el.attributes; | ||
var length = attrs.length; | ||
var attr = void 0; | ||
el.parentNode.insertBefore(template, el); | ||
while (length-- > 0) { | ||
attr = attrs[length]; | ||
template.setAttribute(attr.name, attr.value); | ||
el.removeAttribute(attr.name); | ||
_PLATFORM.performance = window.performance; | ||
} | ||
el.parentNode.removeChild(el); | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
(function () { | ||
var con = window.console = window.console || {}; | ||
var nop = function nop() {}; | ||
return fixHTMLTemplateElement(template); | ||
} | ||
if (!con.memory) con.memory = {}; | ||
('assert,clear,count,debug,dir,dirxml,error,exception,group,' + 'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' + 'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn').split(',').forEach(function (m) { | ||
if (!con[m]) con[m] = nop; | ||
}); | ||
function fixHTMLTemplateElement(template) { | ||
var content = template.content = document.createDocumentFragment(); | ||
var child = void 0; | ||
while (child = template.firstChild) { | ||
content.appendChild(child); | ||
if (_typeof(con.log) === 'object') { | ||
'log,info,warn,error,assert,dir,clear,profile,profileEnd'.split(',').forEach(function (method) { | ||
console[method] = this.bind(console[method], console); | ||
}, Function.prototype.call); | ||
} | ||
})(); | ||
} | ||
return template; | ||
} | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
if (!window.CustomEvent || typeof window.CustomEvent !== 'function') { | ||
_CustomEvent = function _CustomEvent(event, params) { | ||
params = params || { | ||
bubbles: false, | ||
cancelable: false, | ||
detail: undefined | ||
}; | ||
function fixHTMLTemplateElementRoot(template) { | ||
var content = fixHTMLTemplateElement(template).content; | ||
var childTemplates = content.querySelectorAll('template'); | ||
var evt = document.createEvent('CustomEvent'); | ||
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); | ||
return evt; | ||
}; | ||
for (var i = 0, ii = childTemplates.length; i < ii; ++i) { | ||
var child = childTemplates[i]; | ||
if (isSVGTemplate(child)) { | ||
fixSVGTemplateElement(child); | ||
} else { | ||
fixHTMLTemplateElement(child); | ||
_CustomEvent.prototype = window.Event.prototype; | ||
window.CustomEvent = _CustomEvent; | ||
} | ||
} | ||
return template; | ||
} | ||
if (Element && !Element.prototype.matches) { | ||
proto = Element.prototype; | ||
if (_FEATURE.htmlTemplateElement) { | ||
_FEATURE.ensureHTMLTemplateElement = function (template) { | ||
return template; | ||
}; | ||
} else { | ||
_FEATURE.ensureHTMLTemplateElement = fixHTMLTemplateElementRoot; | ||
} | ||
} | ||
_export('_ensureHTMLTemplateElement', _ensureHTMLTemplateElement); | ||
function initialize() { | ||
if (isInitialized) { | ||
return; | ||
} | ||
_ensureCustomEvent(); | ||
_ensureFunctionName(); | ||
_ensureHTMLTemplateElement(); | ||
_ensureElementMatches(); | ||
_ensureClassList(); | ||
_ensurePerformance(); | ||
initializePAL(function (platform, feature, dom) { | ||
Object.assign(platform, _PLATFORM); | ||
Object.assign(feature, _FEATURE); | ||
Object.assign(dom, _DOM); | ||
(function (global) { | ||
global.console = global.console || {}; | ||
var con = global.console; | ||
var prop = void 0; | ||
var method = void 0; | ||
var empty = {}; | ||
var dummy = function dummy() {}; | ||
var properties = 'memory'.split(','); | ||
var methods = ('assert,clear,count,debug,dir,dirxml,error,exception,group,' + 'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' + 'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn').split(','); | ||
while (prop = properties.pop()) { | ||
if (!con[prop]) con[prop] = empty; | ||
}while (method = methods.pop()) { | ||
if (!con[method]) con[method] = dummy; | ||
} | ||
})(platform.global); | ||
if (platform.global.console && _typeof(console.log) === 'object') { | ||
['log', 'info', 'warn', 'error', 'assert', 'dir', 'clear', 'profile', 'profileEnd'].forEach(function (method) { | ||
console[method] = this.bind(console[method], console); | ||
}, Function.prototype.call); | ||
proto.matches = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector || proto.webkitMatchesSelector; | ||
} | ||
Object.defineProperty(dom, 'title', { | ||
get: function get() { | ||
return document.title; | ||
}, | ||
set: function set(value) { | ||
document.title = value; | ||
_export('_FEATURE', _FEATURE = { | ||
shadowDOM: !!HTMLElement.prototype.attachShadow, | ||
scopedCSS: 'scoped' in document.createElement('style'), | ||
htmlTemplateElement: 'content' in document.createElement('template'), | ||
mutationObserver: !!(window.MutationObserver || window.WebKitMutationObserver), | ||
ensureHTMLTemplateElement: function ensureHTMLTemplateElement(t) { | ||
return t; | ||
} | ||
}); | ||
Object.defineProperty(dom, 'activeElement', { | ||
get: function get() { | ||
return document.activeElement; | ||
} | ||
}); | ||
_export('_FEATURE', _FEATURE); | ||
Object.defineProperty(platform, 'XMLHttpRequest', { | ||
get: function get() { | ||
return platform.global.XMLHttpRequest; | ||
} | ||
}); | ||
}); | ||
} | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
(function () { | ||
var isSVGTemplate = function isSVGTemplate(el) { | ||
return el.tagName === 'template' && el.namespaceURI === 'http://www.w3.org/2000/svg'; | ||
}; | ||
_export('initialize', initialize); | ||
var fixSVGTemplateElement = function fixSVGTemplateElement(el) { | ||
var template = el.ownerDocument.createElement('template'); | ||
var attrs = el.attributes; | ||
var length = attrs.length; | ||
var attr = void 0; | ||
return { | ||
setters: [function (_aureliaPal) { | ||
initializePAL = _aureliaPal.initializePAL; | ||
isInitialized = _aureliaPal.isInitialized; | ||
}], | ||
execute: function () { | ||
_typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
el.parentNode.insertBefore(template, el); | ||
_export('_PLATFORM', _PLATFORM = { | ||
location: window.location, | ||
history: window.history, | ||
addEventListener: function addEventListener(eventName, callback, capture) { | ||
this.global.addEventListener(eventName, callback, capture); | ||
}, | ||
removeEventListener: function removeEventListener(eventName, callback, capture) { | ||
this.global.removeEventListener(eventName, callback, capture); | ||
}, | ||
while (length-- > 0) { | ||
attr = attrs[length]; | ||
template.setAttribute(attr.name, attr.value); | ||
el.removeAttribute(attr.name); | ||
} | ||
performance: window.performance, | ||
requestAnimationFrame: function requestAnimationFrame(callback) { | ||
return this.global.requestAnimationFrame(callback); | ||
} | ||
}); | ||
el.parentNode.removeChild(el); | ||
_export('_PLATFORM', _PLATFORM); | ||
return fixHTMLTemplateElement(template); | ||
}; | ||
_export('_FEATURE', _FEATURE = {}); | ||
var fixHTMLTemplateElement = function fixHTMLTemplateElement(template) { | ||
var content = template.content = document.createDocumentFragment(); | ||
var child = void 0; | ||
_export('_FEATURE', _FEATURE); | ||
while (child = template.firstChild) { | ||
content.appendChild(child); | ||
} | ||
_FEATURE.shadowDOM = function () { | ||
return !!HTMLElement.prototype.attachShadow; | ||
}(); | ||
return template; | ||
}; | ||
_FEATURE.scopedCSS = function () { | ||
return 'scoped' in document.createElement('style'); | ||
}(); | ||
var fixHTMLTemplateElementRoot = function fixHTMLTemplateElementRoot(template) { | ||
var content = fixHTMLTemplateElement(template).content; | ||
var childTemplates = content.querySelectorAll('template'); | ||
_FEATURE.htmlTemplateElement = function () { | ||
return 'content' in document.createElement('template'); | ||
}(); | ||
for (var i = 0, ii = childTemplates.length; i < ii; ++i) { | ||
var child = childTemplates[i]; | ||
_FEATURE.mutationObserver = function () { | ||
return !!(window.MutationObserver || window.WebKitMutationObserver); | ||
}(); | ||
if (isSVGTemplate(child)) { | ||
fixSVGTemplateElement(child); | ||
} else { | ||
fixHTMLTemplateElement(child); | ||
} | ||
} | ||
return template; | ||
}; | ||
if (!_FEATURE.htmlTemplateElement) { | ||
_FEATURE.ensureHTMLTemplateElement = fixHTMLTemplateElementRoot; | ||
} | ||
})(); | ||
} | ||
shadowPoly = window.ShadowDOMPolyfill || null; | ||
@@ -425,0 +392,0 @@ |
@@ -1,1 +0,1 @@ | ||
{"name":"aurelia-pal-browser","children":[{"id":2,"name":"initialize","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":3,"name":"initialize","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Initializes the PAL with the Browser-targeted implementation."},"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-pal-browser.d.ts","line":9,"character":34}]}],"groups":[{"title":"Functions","kind":64,"children":[2]}]} | ||
{"name":"aurelia-pal-browser","children":[{"id":2,"name":"initialize","kind":64,"kindString":"Function","flags":{"isExported":true},"signatures":[{"id":3,"name":"initialize","kind":4096,"kindString":"Call signature","flags":{},"comment":{"shortText":"Initializes the PAL with the Browser-targeted implementation."},"type":{"type":"instrinct","name":"void"}}],"sources":[{"fileName":"aurelia-pal-browser.d.ts","line":18,"character":34}]}],"groups":[{"title":"Functions","kind":64,"children":[2]}]} |
@@ -0,1 +1,8 @@ | ||
<a name="1.2.0"></a> | ||
# [1.2.0](https://github.com/aurelia/pal-browser/compare/1.1.0...v1.2.0) (2017-03-23) | ||
### Features | ||
* add flag to opt-out of IE support | ||
<a name="1.1.0"></a> | ||
@@ -2,0 +9,0 @@ # [1.1.0](https://github.com/aurelia/pal-browser/compare/1.0.0...v1.1.0) (2016-12-07) |
{ | ||
"name": "aurelia-pal-browser", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "The browser-specific implementation of Aurelia's platform abstraction layer.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -1,2 +0,2 @@ | ||
export function _ensureClassList(): void { | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
/* | ||
@@ -3,0 +3,0 @@ * classList polyfill. Forked from https://github.com/eligrey/classList.js |
@@ -1,2 +0,2 @@ | ||
export function _ensureCustomEvent(): void { | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
if (!window.CustomEvent || typeof window.CustomEvent !== 'function') { | ||
@@ -3,0 +3,0 @@ let CustomEvent = function(event, params) { |
@@ -1,8 +0,6 @@ | ||
export function _ensureElementMatches(): void { | ||
if (Element && !Element.prototype.matches) { | ||
let proto = Element.prototype; | ||
proto.matches = proto.matchesSelector || | ||
proto.mozMatchesSelector || proto.msMatchesSelector || | ||
proto.oMatchesSelector || proto.webkitMatchesSelector; | ||
} | ||
if (Element && !Element.prototype.matches) { | ||
let proto = Element.prototype; | ||
proto.matches = proto.matchesSelector || | ||
proto.mozMatchesSelector || proto.msMatchesSelector || | ||
proto.oMatchesSelector || proto.webkitMatchesSelector; | ||
} |
@@ -1,17 +0,7 @@ | ||
export const _FEATURE = {}; | ||
_FEATURE.shadowDOM = (function() { | ||
return !!HTMLElement.prototype.attachShadow; | ||
})(); | ||
_FEATURE.scopedCSS = (function() { | ||
return 'scoped' in document.createElement('style'); | ||
})(); | ||
_FEATURE.htmlTemplateElement = (function() { | ||
return 'content' in document.createElement('template'); | ||
})(); | ||
_FEATURE.mutationObserver = (function() { | ||
return !!(window.MutationObserver || window.WebKitMutationObserver); | ||
})(); | ||
export const _FEATURE = { | ||
shadowDOM: !!HTMLElement.prototype.attachShadow, | ||
scopedCSS: 'scoped' in document.createElement('style'), | ||
htmlTemplateElement: 'content' in document.createElement('template'), | ||
mutationObserver: !!(window.MutationObserver || window.WebKitMutationObserver), | ||
ensureHTMLTemplateElement: t => t, | ||
}; |
@@ -1,2 +0,2 @@ | ||
export function _ensureFunctionName(): void { | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
// Fix Function#name on browsers that do not support it (IE): | ||
@@ -3,0 +3,0 @@ function test() {} |
import {_FEATURE} from './feature'; | ||
export function _ensureHTMLTemplateElement(): void { | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
function isSVGTemplate(el) { | ||
@@ -56,7 +56,5 @@ return el.tagName === 'template' && | ||
if (_FEATURE.htmlTemplateElement) { | ||
_FEATURE.ensureHTMLTemplateElement = function(template) { return template; }; | ||
} else { | ||
if (!_FEATURE.htmlTemplateElement) { | ||
_FEATURE.ensureHTMLTemplateElement = fixHTMLTemplateElementRoot; | ||
} | ||
} |
@@ -5,8 +5,11 @@ import {initializePAL, isInitialized} from 'aurelia-pal'; | ||
import {_DOM} from './dom'; | ||
import {_ensureCustomEvent} from './custom-event'; | ||
import {_ensureFunctionName} from './function-name'; | ||
import {_ensureHTMLTemplateElement} from './html-template-element'; | ||
import {_ensureElementMatches} from './element-matches'; | ||
import {_ensureClassList} from './class-list'; | ||
import {_ensurePerformance} from './performance'; | ||
// DOM polyfills | ||
// Actually inlined by our build because of build/paths.js but `import "m"` is not properly removed!? | ||
// import './console'; | ||
// import './custom-event'; | ||
// import './function-name'; | ||
// import './html-template-element'; | ||
// import './element-matches'; | ||
// import './class-list'; | ||
// import './performance'; | ||
@@ -21,9 +24,2 @@ /** | ||
_ensureCustomEvent(); | ||
_ensureFunctionName(); | ||
_ensureHTMLTemplateElement(); | ||
_ensureElementMatches(); | ||
_ensureClassList(); | ||
_ensurePerformance(); | ||
initializePAL((platform, feature, dom) => { | ||
@@ -34,44 +30,15 @@ Object.assign(platform, _PLATFORM); | ||
(function(global) { | ||
global.console = global.console || {}; | ||
let con = global.console; | ||
let prop; | ||
let method; | ||
let empty = {}; | ||
let dummy = function() {}; | ||
let properties = 'memory'.split(','); | ||
let methods = ('assert,clear,count,debug,dir,dirxml,error,exception,group,' + | ||
'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' + | ||
'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn').split(','); | ||
while (prop = properties.pop()) if (!con[prop]) con[prop] = empty; | ||
while (method = methods.pop()) if (!con[method]) con[method] = dummy; | ||
})(platform.global); | ||
if (platform.global.console && typeof console.log === 'object') { | ||
['log', 'info', 'warn', 'error', 'assert', 'dir', 'clear', 'profile', 'profileEnd'].forEach(function(method) { | ||
console[method] = this.bind(console[method], console); | ||
}, Function.prototype.call); | ||
} | ||
Object.defineProperty(dom, 'title', { | ||
get: function() { | ||
return document.title; | ||
}, | ||
set: function(value) { | ||
document.title = value; | ||
} | ||
get: () => document.title, | ||
set: (value) => { document.title = value; } | ||
}); | ||
Object.defineProperty(dom, 'activeElement', { | ||
get: function() { | ||
return document.activeElement; | ||
} | ||
get: () => document.activeElement | ||
}); | ||
Object.defineProperty(platform, 'XMLHttpRequest', { | ||
get: function() { | ||
return platform.global.XMLHttpRequest; | ||
} | ||
get: () => platform.global.XMLHttpRequest | ||
}); | ||
}); | ||
} |
import {_PLATFORM} from './platform'; | ||
export function _ensurePerformance(): void { | ||
if (typeof FEATURE_NO_IE === 'undefined') { | ||
// performance polyfill. Copied from https://gist.github.com/paulirish/5438650 | ||
@@ -5,0 +5,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55
142675
3484