Blink aborts computing styles on descendants of display:none
nodes. If the inside of the iframe has , you make remove recalc style, no layout, no painting.
still does all that work because it's another document and the display:none
effect does not transcend into the other document.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ES6 meta programming ??? | |
// The more complex form of ES6 template strings are called | |
// "tagged" template strings. In short, they allow you to | |
// pass the final evaluated string to a function for further | |
// processing. This allows for some interesting things. For example: | |
// | |
// get`https://api.github.com/repos/${org}/${repo}/issues?sort=${sort}`; | |
// | |
// _could_ make a network request and return a Promise with the result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Know how fast your HTML Imports are. | |
// crbug.com/505279 - doesn't show sub-import resources. | |
var imports = document.querySelectorAll('link[rel="import"]'); | |
[].forEach.call(imports, function(link) { | |
var entries = performance.getEntriesByName(link.href); | |
console.info('=== HTML Imports perf ==='); | |
entries.forEach(function(e) { | |
console.log(e.name, 'took', e.duration, 'ms'); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
body.loading #splash { | |
opacity: 1; | |
} | |
#splash { | |
position: absolute; | |
top: 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
body.loading #splash { | |
opacity: 1; | |
} | |
#splash { | |
position: absolute; | |
top: 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){function isUnregisteredCustomElement(el){if(el.constructor==HTMLElement){console.error("Found unregistered custom element:",el);return true;}return false;}function isCustomEl(el){return el.localName.indexOf('-')!=-1||el.getAttribute('is');}var allCustomElements=document.querySelectorAll('html /deep/ *');allCustomElements=Array.prototype.slice.call(allCustomElements).filter(function(el){return isCustomEl(el);});var foundSome=false;for(var i=0,el;el=allCustomElements[i];++i){if(isUnregisteredCustomElement(el)){foundSome=true;}}if(foundSome){alert('Oops: found one or more unregistered custom elements in use! Check the console.');}else{alert('Good: All custom elements are registered :)');}})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://jsbin.com/zibaraju/1/edit | |
<div></div> | |
<script> | |
var div = document.querySelector('div'); | |
setInterval(function() { | |
var t0 = performance.now(); | |
navigator.getBattery().then(function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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('-'); |