Overview of CSS3 Gradients
transition property for color value transitions because gradients are rendered as images, and CSS cannot transition between images.website·Indexed 30 days ago
https://daiwanxing.github.io/blog/A personal blog by Wonder Dai focusing on practical frontend technology. Content includes guides and articles on JavaScript (event loop, memory management, web-workers), TypeScript (tsconfig.json, utility types, triple-slash directives), CSS3 (gradients, aspect-ratio, pseudo-selectors), Vue 3 (ref vs shallowRef, Transition), algorithms (binary search, bubble sort), and general development tools like ESLint and Git.
transition property for color value transitions because gradients are rendered as images, and CSS cannot transition between images.TypeScript's type system is based on set theory where types are treated as sets of values.
|): Act as a set union (Supertype). A union type contains all properties of the combined types.&): Act as a set intersection. It results in a type containing only the common properties. If types have no common properties, the result is never.type SN = string | number; // Supertype: Union of string and number
type Intersection = string & number; // Results in 'never' because they share no common propertiesIntl.DateTimeFormat object provides a built-in way to format dates and times according to specific language and regional conventions without needing external libraries like moment.js or dayjs. It should be instantiated using the new keyword to avoid unexpected behavior with the this context.// Basic instantiation
const formatter = new Intl.DateTimeFormat('zh');
console.log(formatter.format(new Date()));Bubble Sort is a basic sorting algorithm that repeatedly compares adjacent elements in a list.
Each pass through the unsorted list 'bubbles' the largest (or smallest) remaining element to its correct position at the end (or beginning) of the array. For an array of length $N$, the algorithm requires $N - 1$ passes to fully sort the data.
Binary Search (also known as half-search or logarithmic search) is an efficient algorithm for finding a specific element within a sorted array.
How it works:
declare keyword in TypeScript is used to provide ambient declarations for variables, functions, classes, or modules that exist in the environment (e.g., provided by a third-party library or a global script) but are not defined within the current TypeScript project. These declarations tell the compiler about the type of the entity without providing an actual implementation. Importantly, declare statements are erased during compilation and do not generate JavaScript code.declare var foo: string; // Tells TS that 'foo' exists globally as a stringcall-stack (or invocation stack) manages the execution of functions in JavaScript. It follows a Last-In, First-Out (LIFO) structure. When a function is called, a new 'frame' is pushed onto the stack. When the function finishes executing, its frame is popped off. Functions are pushed onto the stack only when they are executed, not when the code is parsed.function foo() {
baz();
}
function baz() {
bar();
}
function bar() {
// execution happens here
}
foo(); // foo is pushed, then baz, then bar. bar pops first, then baz, then foo.Symbol.iterator, Symbol.toPrimitive, Symbol.replace, Symbol.isConcatSpreadable, and Symbol.toStringTag.