Tested on Chrome 91 Desktop/Android.
The demo on https://piotrswigon.github.io/pwa-demo/minimal-ui/ uses "display": "minimal-ui"
in its manifest:
"display": "minimal-ui",
// Highlights all custom elements on the page. | |
// 7/31/2016: updated to work with both shadow dom v0 and v1. | |
// To create a bookmarklet, use http://ted.mielczarek.org/code/mozilla/bookmarklet.html | |
var allCustomElements = []; | |
function isCustomElement(el) { | |
const isAttr = el.getAttribute('is'); | |
// Check for <super-button> and <button is="super-button">. | |
return el.localName.includes('-') || isAttr && isAttr.includes('-'); |
What's the best way to prevent large components from a tree shakeable library from being bundled | |
together in a common bundle by webpack/next's default strategy? | |
Thread at https://twitter.com/ebidel/status/1467938411772219393. | |
# Example | |
## Page1.ts | |
``` |
/** | |
* @author ebidel@ (Eric Bidelman) | |
* License Apache-2.0 | |
*/ | |
/** | |
* Finds all elements on the page, inclusive of those within shadow roots. | |
* @param {string=} selector Simple selector to filter the elements by. e.g. 'a', 'div.main' | |
* @return {!Array<string>} List of anchor hrefs. | |
*/ |
// An `Object.observe()` "polyfill" using ES6 Proxies. | |
// | |
// Current `Object.observe()` polyfills [1] rely on polling | |
// to watch for property changes. Proxies can do one better by | |
// observing property changes to an object without the need for | |
// polling. | |
// | |
// Known limitations of this technique: | |
// 1. the call signature of `Object.observe()` will return the proxy | |
// object. The original object needs to be overwritten with this return value. |
Tested on Chrome 91 Desktop/Android.
The demo on https://piotrswigon.github.io/pwa-demo/minimal-ui/ uses "display": "minimal-ui"
in its manifest:
"display": "minimal-ui",
javascript:(function(){(function printStats(){var loadTimes=window.chrome.loadTimes();firstPaint=loadTimes.firstPaintTime*1000;firstPaintTime=firstPaint-(loadTimes.startLoadTime*1000);console.info('First paint took',firstPaintTime,'ms');console.info('Load took',performance.timing.loadEventStart-performance.timing.navigationStart,'ms');var instances=0;if(parseFloat(Polymer.version)<1){instances=[].slice.call(document.querySelectorAll('html /deep/ *')).filter(function(el){return el.localName.indexOf('-')!=-1||el.getAttribute('is');}).length;}else{instances=Polymer.telemetry.instanceCount;}console.info('Custom element instances:',instances);var reflectCount=0;if(Polymer.telemetry){console.info('=== Properties set to reflectToAttribute ===');Polymer.telemetry.registrations.forEach(function(el){for(var prop in el.properties){if(el.properties[prop].reflectToAttribute){console.log(el.is+'.'+prop);reflectCount++;}}});}else{console.info('=== Properties set to reflect ===');Polymer.elements.forEach(function(el){for(var |
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
body.loading #splash { | |
opacity: 1; | |
} | |
#splash { | |
position: absolute; | |
top: 0; |
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
body.loading #splash { | |
opacity: 1; | |
} | |
#splash { | |
position: absolute; | |
top: 0; |
<!-- http://jsbin.com/rageqilava/1/edit?html,output --> | |
<script src="http://www.polymer-project.org/webcomponents.min.js"></script> | |
<script src="http://www.polymer-project.org/polymer.min.js"></script> | |
<link rel="import" href="templates.html" id="templates"> | |
<polymer-element name="foo-bar"> | |
<template> |
/** | |
* @author ebidel@ (Eric Bidelman) | |
* License Apache-2.0 | |
*/ | |
const url = require('url'); | |
const URL = url.URL; | |
const fetch = require('node-fetch'); | |
const API_KEY = '<YOUR API KEY>'; |