Chromium(Google) stuff
http://www.chromium.org/
https://planet.chromium.org/
http://blog.chromium.org/
http://v8project.blogspot.com/
https://groups.google.com/forum/#!forum/v8-dev
http://chrome.blogspot.com/
http://planet.igalia.com/chromium/
http://googlechromereleases.blogspot.com/
http://peter.sh/commits/
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
// NOTE: this is specification dependent classification. It has nothing to do with formal class programming concept. | |
// The value of the [[Class]] internal property is defined by specification for every kind of built-in object. | |
// The value of the [[Class]] internal property of a host object may be any String value except one of: | |
// "Arguments", "Array", "Boolean", "Date", "Error", "Function", "JSON", "Math", "Number", "Object", "RegExp", and "String". | |
// The value of a [[Class]] internal property is used internally to distinguish different kinds of objects. | |
Object.prototype.toString.call({}); // "[object Object]" | |
Object.prototype.toString.call([]); // "[object Array]" | |
Object.prototype.toString.call(function(){}); // "[object Function]" | |
Object.prototype.toString.call(''); // "[object String]" |
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
const $ = function(selector) { return document.querySelector(selector); }; // Returns first matched element or null | |
const $$ = function(selector) { return document.querySelectorAll(selector); }; // Returns NodeList of matched elements or empty NodeList [] | |
// If you want to extend HTML DOM prototype do it this way or something like this. | |
// Check for property or method pre-existance. Obv if JS Engine already provides property or method, you don't want to override it with your own custom one. | |
// This works in IE9+ or can be done even in IE8+ | |
// Adding a new method to all HTML elements via the HTMLElement prototype | |
if(!HTMLElement.prototype.remove) { | |
// defineProperty because of enumeration |
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
NodeList.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator]; |
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
document.getElementById('btn').addEventListener('click', function() { | |
"use strict"; | |
const evens = Array.from(document.getElementsByClassName('even')); | |
for(let even of evens) { | |
even.classList.toggle('bold'); | |
even.nextElementSibling.classList.toggle('italic'); | |
} | |
}); |
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
(function () { | |
'use strict'; | |
return this === undefined; // false | |
}.call(this)); | |
(function(global){ | |
'use strict'; | |
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
// Filter out CSS properties without webkit prefixes in Chrome console | |
// To find "hidden" properties of an object we need to use Object.getOwnPropertyNames. | |
Object.getOwnPropertyNames(document.body.style).filter( | |
property => !property.startsWith('webkit') | |
); |
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
const request = new Request('https://output.jsbin.com/pasixu.js', { | |
method: 'GET', | |
requestMode: 'cors', | |
}); | |
fetch(request).then(function(response) { | |
return response.json(); | |
}).then(function(body) { | |
console.log(body); | |
}).catch(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
// Navigate to different location using different BOM && DOM API-s. Paralysis of choice :) Are there more ways ? | |
location = 'https://www.google.com/'; | |
location.href = 'https://www.google.com/'; | |
window.location = 'https://www.google.com/'; | |
document.location = 'https://www.google.com/'; | |
window.location.href = 'https://www.google.com/'; |
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> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<style> | |
body {height: 100vh;display: flex;align-items: center;justify-content: center;} | |
/* Button component - works only in FF correctly ATM */ |
NewerOlder