Skip to content

Instantly share code, notes, and snippets.

Domenic Denicola domenic

Block or report user

Report or block domenic

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@domenic
domenic / after-markdown-conversion.html
Created Apr 26, 2019
Working mode before and after
View after-markdown-conversion.html
<!DOCTYPE HTML>
<html lang="en">
<meta charset="utf-8">
<title>Working Mode — WHATWG</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#3A7908">
<link rel="icon" href="https://resources.whatwg.org/logo.svg">
<link rel="stylesheet" href="/style/shared.css">
<link rel="stylesheet" href="/style/subpages.css">
@domenic
domenic / difference.md
Last active Jan 16, 2019
Set.prototype.difference, simplified
View difference.md

Context: https://github.com/tc39/proposal-set-methods/issues/50

Proposed spec texts

Set.prototype.difference(arg), minimalist

  1. If Type(this) is not Object, or this does not have a [[SetData]] internal slot, throw a new TypeError exception.
  2. If Type(arg) is not Object, or arg does not have a [[SetData]] internal slot, throw a new TypeError exception.
  3. Let diffList be a List containing all elements that are in this.[[SetData]] but are not in arg.[[SetData]], using SameValueZero to determine identity. (Optional: formalize this with a loop that operates on the Lists.)
  4. Let newSet be ? OrdinaryCreateFromConstructor(%Set%, "%SetPrototype%", « [[SetData]] »).
@domenic
domenic / link-stuff.md
Last active Dec 22, 2018
Revamping link fetching and stuff
View link-stuff.md
@domenic
domenic / html-style.html
Created Jul 31, 2018
HTML Standard inline stylesheet
View html-style.html
<style>
.status { min-height: 0.6em; font: 1em sans-serif; width: 9em; padding: 0.3em; position: absolute; z-index: 8; right: 0.3em; background: #EEE; color: black; box-shadow: 0 0 3px #999; overflow: hidden; margin: -2em 0 0 0; border-collapse: initial; border-spacing: initial; }
.status:hover { z-index: 9; }
.status:focus-within { z-index: 9; }
.status.wrapped > :not(input) { display: none; }
.status > input { position: absolute; left: 0; top: 0; width: 1em; height: 1em; border: none; background: transparent; padding: 0; margin: 0; }
.status > p { font-size: 0.6em; margin: 0; padding: 0; }
.status > p + p { padding-top: 0.5em; }
.status > p > strong { margin-left: 1.5em; }
.status > .support { display: block; }
@domenic
domenic / transfer.js
Created Jul 26, 2018
ArrayBuffer.prototype.transfer not-really-a-polyfill
View transfer.js
// This creates a copy, but does detach the source buffer
const mc = new MessageChannel();
ArrayBuffer.prototype.transfer = function () {
const result = this.slice();
mc.port1.postMessage(this, [this]);
return result;
};
@domenic
domenic / arch.js
Created Jun 3, 2018
Mozilla arch JS code
View arch.js
function curveInArchCoords(col, rows, cols) {
const mathX = col / cols * 2 * Math.PI;
const mathY = Math.cos(mathX);
const archY = (1 + mathY) / 2 * rows;
return archY;
}
function setFrame(frame, rows, cols, colOffset) {
for (const i of frame) {
frame[i] = 0;
View HTMLMarqueeElement.js
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
function HTMLMarqueeElement() {
throw new TypeError("Illegal constructor");
@domenic
domenic / infinite-list-with-shadow-stuff.html
Last active Mar 7, 2018
infinite-list-with-shadow-stuff.html
View infinite-list-with-shadow-stuff.html
<!-- Clean light DOM: -->
<std-list id="list">
<div class="item">0 - Domenic</div>
<div class="item">1 - Ojan</div>
<div class="item">2 - Drew</div>
<div class="item">3 - Kevin</div>
<div class="item">4 - Gray</div>
</std-list>
<!-- Via this structure: -->
@domenic
domenic / contra-lawson.md
Last active Nov 30, 2017
Contra Bruce Lawson's "Editing the W3C HTML5 spec"
View contra-lawson.md

A response to http://www.brucelawson.co.uk/2017/editing-the-w3c-html5-spec/

Unfortunately this post contains a lot of inaccuracies. For example, the claim that the WHATWG HTML Standard is future-facing and for incubation is false. Such additions are explicitly against the WHATWG working mode: see the sections on Additions and New Proposals.

It also misunderstands the outline algorithm, which isn't a requirement on browsers, but instead guidance for developers as to how to structure their pages. As such it's not some kind of speculative browser feature as this post characterizes it. (It's bad guidance for developers—but the proper fix for that isn't to include some warning box saying "this feature, which isn't meant for browsers anyway, isn't implemented in browsers" like the W3C HTML fork does. The proper fix is outlined <a href="https://github.com/whatwg/html/issues/83#issuecomment

@domenic
domenic / private-static-1.js
Created Nov 30, 2017
Why private static methods are important
View private-static-1.js
// Today, with underscore-prefixed "private"
class Point {
constructor(x, y) {
this._x = x;
this._y = y;
}
length() {
return Math.sqrt(squareLengthHelper(this));
You can’t perform that action at this time.