Skip to content

Instantly share code, notes, and snippets.

View termi's full-sized avatar

Егор Халимоненко termi

View GitHub Profile
@termi
termi / bug_examples.html
Created August 30, 2012 19:41
Fix Safari bug with [radio input with no form].cloneNode()
<html>
<form>
<div id="test3">
test1 :
<input id="test1" type="radio" name="test" checked />
</div>
test 2:
<input type="radio" name="test" />
</form>
@termi
termi / css3SelectorsPolyfill.js
Created May 5, 2012 19:05
getElementsByClassName/querySelector/querySelectorAll/matchesSelector Polyfill
/** @license MIT License (c) copyright Egor Halimonenko (termi1uc1@gmail.com) */
// ==ClosureCompiler==
// @compilation_level ADVANCED_OPTIMIZATIONS
// @warning_level VERBOSE
// @jscomp_warning missingProperties
// @output_file_name a.js.querySelector.min.js
// @check_types
// ==/ClosureCompiler==
@termi
termi / LICENSE.txt
Created May 1, 2012 17:32 — forked from 140bytes/LICENSE.txt
event delegation
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@termi
termi / matchesSelector_shim.js
Last active February 9, 2021 09:52
Element.prototype.matchesSelector shim
var _hasOwnProperty = Object.prototype.hasOwnProperty;
if(!Element.prototype.matchesSelector) {
Element.prototype.matchesSelector =
Element.prototype.matches ||
Element.prototype.webkitMatchesSelector ||
Element.prototype.mozMatchesSelector ||
Element.prototype.msMatchesSelector ||
Element.prototype.oMatchesSelector || function(selector) {
if(!selector)return false;
@termi
termi / event_delegation.js
Created April 12, 2012 18:19
event delegation. It is nearly 140 bytes but unsafe. For more complex solution see comments
function(
a, //CSS selector
b //callback function
) {
return function(
e, // event
c, // (placeholder)
d // (placeholder)
) {
d = e.target;