"abc".replace(/abc/, "$&") // "abc"
"abc".replace("abc", "$&") // "abc"
"abc".replace("abc", function(){ return "$&" }) // safari: "abc", others: "$&"
"abc".replace(/abc/, function(){ return "$&" }) // "$&"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (()=>{ "use strict" | |
| let mixinHandler = { | |
| get: (t, n)=>{ | |
| if ( t[n] != void 0 ) | |
| return t[n] | |
| for ( let i = t.__parents__.length-1; ~i; i-- ) | |
| if ( t.__parents__[i][n] != void 0 ) | |
| return t.__parents__[i][n] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var enumerate = Object.keys || function(o){ | |
| var arr = [] | |
| , o = !!o.callee ? Array.prototype.slice.call(o) : o | |
| , k | |
| for ( k in o ) if ( arr.hasOwnProperty.call(o, k) ) | |
| arr.push(k) | |
| return arr | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //addEventListener polyfill with e.preventDefault and e.stopPropagation for old IEs | |
| // DO NOT PUT THAT ONE ON GLOBAL SCOPE, just saying... :D | |
| var addEventListener = (function(){ | |
| if ( window.addEventListener ) | |
| return function(el, ev, fn, c){ | |
| return el.addEventListener(ev, fn, !!c) | |
| } | |
| return function(el, ev, fn){ | |
| return el.attachEvent('on'+ev, function(e){ |