Skip to content

Instantly share code, notes, and snippets.

View yyx990803's full-sized avatar

Evan You yyx990803

View GitHub Profile
@yyx990803
yyx990803 / bind.js
Last active June 15, 2022 09:15
implementing Function.prototype.bind
Function.prototype.bind = function (context) {
if (typeof this !== 'function') {
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
}
var fn = this, // the function to bind
slice = Array.prototype.slice // cache slice method
args = slice.call(arguments, 1), // get the array of addtional arguments (to be curried)
noop = function () {}, // the intermediate function to serve as a prototype chain connector
// (assuming we don't have Object.create() here)
bound = function () {
@yyx990803
yyx990803 / commits.vue
Last active May 13, 2022 16:43
Vue examples comparisons in 2.x and function-based APIs
<template>
<div id="demo">
<h1>Latest Vue.js Commits</h1>
<template v-for="branch in branches">
<input type="radio"
:id="branch"
:value="branch"
name="branch"
v-model="currentBranch">
<label :for="branch">{{ branch }}</label>
@yyx990803
yyx990803 / repro.html
Created May 10, 2022 07:32
Weird detached element memory issue in Chrome
<div id="app">
<button id="reset">reset</button>
<button id="outer">no leak</button>
<div id="container">
<button id="inner">leak</button>
<span>1</span>
<span>2</span>
<span>3</span>
<span>4</span>
<span>5</span>
title date author gravatar twitter hidden
Vue 3 将成为新的默认版本
2022-01-20
尤雨溪
eca93da2c67aadafe35d477aa8f454b8
@youyuxi
true

划重点:Vue 3 将在 2022 年 2 月 7 日成为新的默认版本!

Features

  • Migration Build
  • compiler-core: whitespace handling strategy (dee3d6a)
  • support component-level compilerOptions when using runtime compiler (ce0bbe0)
  • config: support configuring runtime compiler via app.config.compilerOptions (091e6d6)
  • support casting plain element to component via is="vue:xxx" (af9e699)
  • devtools: improved KeepAlive support (03ae300)
  • devtools: performance events (f7c54ca)
  • onServerPrefe
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
body {
font-family: 'Helvetica Neue', Arial, 'Microsoft Yahei', sans-serif;
padding: 0 30px;
color: #333;
@yyx990803
yyx990803 / 之乎者也.md
Last active April 21, 2020 03:58
之乎者也,一个文言风的类JS玩具语言
斐波那契者 得甲
 閱甲
    零乎
      零是也
    壹乎
      壹是也
    它者乎
      前者 甲 壹 差之 遞歸之也
      前前者 甲 貳 差之 遞歸之也
<template>
<div class="jumbotron">
<div class="row">
<div class="col-md-6">
<h1>Vue.js 3.0.0-alpha4 (keyed)</h1>
</div>
<div class="col-md-6">
<div class="row">
<div class="col-sm-6 smallpad">
<button type="button" class="btn btn-primary btn-block" id="run" @click="run">Create 1,000 rows</button>