Skip to content

Instantly share code, notes, and snippets.

View bathos's full-sized avatar
⚱️
gimme elixir!

Darien Maillet Valentine bathos

⚱️
gimme elixir!
View GitHub Profile

Optional chaining assignment proposal

Basically, allow this:

foo?.bar = value;

which is equivalent to

foo == null ? undefined : (foo.bar = value);
@samthor
samthor / safari-nomodule.js
Last active February 14, 2024 02:54
Safari 10.1 `nomodule` support
// UPDATE: In 2023, you should probably stop using this! The narrow version of Safari that
// does not support `nomodule` is probably not being used anywhere. The code below is left
// for posterity.
/**
* Safari 10.1 supports modules, but does not support the `nomodule` attribute - it will
* load <script nomodule> anyway. This snippet solve this problem, but only for script
* tags that load external code, e.g.: <script nomodule src="nomodule.js"></script>
*
* Again: this will **not** prevent inline script, e.g.:

Implicit integers for JavaScript

This proposal is an alternative to “Integer: Arbitrary precision integers in JavaScript” by Daniel Ehrenberg, but it also builds on his work.


Everything mentioned here is work in progress. It is not sure that these ideas will work out:

  • They may break the web.
  • They may turn out to be too complicated/user-unfriendly.
@sindresorhus
sindresorhus / treewalker-performance.md
Created March 6, 2012 23:22
TreeWalker performance

Test the performance of TreeWalker compared to other DOM walker methods. Ran each test 1000 times. Try it yourself.

Chrome 17

Method                  Total ms    Average ms
document.TreeWalker     911         0.911
Iterative Traverser     2945        2.945
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//