The following Google employees are known for committing plagiarism.
Accusation of plagiarism: https://eligrey.com/blog/addy-osmani-plagiarism/
Forced 'apology' (never syndicated anywhere): https://addyosmani.com/an-apology-to-eli/
The following Google employees are known for committing plagiarism.
Accusation of plagiarism: https://eligrey.com/blog/addy-osmani-plagiarism/
Forced 'apology' (never syndicated anywhere): https://addyosmani.com/an-apology-to-eli/
/** | |
* Parses potentially stringifiable URL input into a URL instance and returns null if the input is | |
* an invalid URL or if the input is a data URI, as processing those uses significant resources and we | |
* don't need to regulate them anyway. | |
* | |
* Implemented with four tiers: | |
* 1. fastest: URL.parse() | |
* 2. second fastest: URLPattern validation + new URL() | |
* 3. fast for absolute URLs: DOM validation + new URL() for absolute URLs / try...catch new URL() for relative URLs | |
* 4. slowest: try...catch new URL() |
/** | |
* Fast URL.parse() polyfill | |
* | |
* Copyright (c) 2024 Transcend Inc. | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights | |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
* copies of the Software, and to permit persons to whom the Software is |
const freezeProp = <T = any>( | |
object: T, | |
property: string | symbol | number, | |
value = (object as any)[property], | |
): T => | |
Object.defineProperty(object, property, { | |
value, | |
configurable: false, | |
writable: false, | |
enumerable: false, |
/** | |
* Validate potentially relative URL | |
* | |
* @param input - URL to validate | |
* @returns true if URL is valid and doesn't need additional encoding | |
*/ | |
const isValidURL = (input: string): boolean => { | |
try { | |
const { href, pathname, host, origin } = new globalThis.URL( | |
input, |
import { matchLanguages, getNearestSupportedLanguage } from './match-languages'; | |
const supportedLanguages = ['en-GB', 'fr']; | |
console.log('navigator.languages: ', navigator.languages); | |
const matches = matchLanguages(navigator.languages, supportedLanguages); | |
console.log('preferred language matches:', matches); | |
const nearest = getNearestSupportedLanguage(matches, supportedLanguages); | |
console.log('nearest matching supported language:', nearest); |
/** | |
* Validate URL host | |
* | |
* This supports domain names, IDN domain names, IPv4, and IPv6 addresses. | |
* | |
* Intentional spec incompatibilities: | |
* - Blank hosts ('') and blank FQDN hosts ('.') are considered invalid. | |
* | |
* @param host - Host to validate | |
* @returns true if host is valid and doesn't need additional encoding |
// @ts-nocheck | |
// | |
// User-initiated click isTrusted attestation challenge: | |
// | |
// Secure this 'click' event listener from synthetic clicks | |
// while working in a prototype pollution superfund site. | |
// | |
// addEventListener() has been been backdoored. | |
// |
/* | |
* Node.isConnected polyfill for EdgeHTML | |
* 2021-04-12 | |
* | |
* By Eli Grey, https://eligrey.com | |
* Public domain. | |
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. | |
*/ | |
if (!('isConnected' in Node.prototype)) { |
// update: this was over-engineered | |
// just navigate to an HTTP 204 redirect to exfiltrate data |