test(core): update Web Platform feature detection (#24861)

PR Close #24861
This commit is contained in:
Rob Wormald
2018-07-12 15:58:13 -07:00
committed by Misko Hevery
parent 6e6489a408
commit d76a7d6f7c
5 changed files with 25 additions and 10 deletions

View File

@ -68,6 +68,23 @@ export class BrowserDetection {
return this._ua.indexOf('Chrome') > -1 && this._ua.indexOf('Chrome/3') > -1 &&
this._ua.indexOf('Edge') == -1;
}
get supportsCustomElements() { return (typeof(<any>global).customElements !== 'undefined'); }
get supportsDeprecatedCustomCustomElementsV0() {
return (typeof(document as any).registerElement !== 'undefined');
}
get supportsShadowDom() {
const testEl = document.createElement('div');
return (typeof customElements !== 'undefined') && (typeof testEl.attachShadow !== 'undefined');
}
get supportsDeprecatedShadowDomV0() {
const testEl = document.createElement('div') as any;
return (typeof customElements !== 'undefined') &&
(typeof testEl.createShadowRoot !== 'undefined');
}
}
BrowserDetection.setup();