Skip to content

Instantly share code, notes, and snippets.

@jed
Forked from 140bytes/LICENSE.txt
Created May 12, 2011 08:46

Revisions

  1. jed revised this gist May 31, 2011. 1 changed file with 13 additions and 20 deletions.
    33 changes: 13 additions & 20 deletions LICENSE.txt
    Original file line number Diff line number Diff line change
    @@ -1,20 +1,13 @@
    Copyright (c) 2011 Jed Schmidt, http://jed.is

    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 furnished to do so, subject to
    the following conditions:

    The above copyright notice and this permission notice shall be
    included in all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
    LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
    OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
    WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
    Version 2, December 2004

    Copyright (C) 2011 Jed Schmidt <http://jed.is>

    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
    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

    0. You just DO WHAT THE FUCK YOU WANT TO.
  2. jed revised this gist May 18, 2011. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions annotated.js
    Original file line number Diff line number Diff line change
    @@ -6,12 +6,12 @@ function(
    ){
    a = a || document; // use the document by default
    d = a[ // save the current onevent handler
    b = "on" + b // prepent the event name with "on"
    b = "on" + b // prepend the event name with "on"
    ];
    b = a[b] = // cache and replace the current handler
    function(e) { // with A function that
    function(e) { // with a function that
    d = d && d( // executes/caches the previous handler
    e = e || a.event // with A cross-browser object,
    e = e || a.event // with a cross-browser object,
    );

    return (c = c && b(e)) // and executes/caches the passed function,
  3. jed revised this gist May 18, 2011. 2 changed files with 10 additions and 10 deletions.
    18 changes: 9 additions & 9 deletions annotated.js
    Original file line number Diff line number Diff line change
    @@ -1,22 +1,22 @@
    function(
    a, // a DOM element
    a, // A DOM element
    b, // an event name such as "click"
    c, // (placeholder)
    c, // a handler function
    d // (placeholder)
    ){
    c = c || document; // use the document by default
    d = c[ // save the current onevent handler
    a = a || document; // use the document by default
    d = a[ // save the current onevent handler
    b = "on" + b // prepent the event name with "on"
    ];
    a = c[b] = // cache and replace the current handler
    function(e) { // with a function that
    b = a[b] = // cache and replace the current handler
    function(e) { // with A function that
    d = d && d( // executes/caches the previous handler
    e = e || c.event // with a cross-browser object,
    e = e || a.event // with A cross-browser object,
    );

    return (a = a && b(e)) // and calls the passed function,
    return (c = c && b(e)) // and executes/caches the passed function,
    ? b // returning the current handler if it rebinds
    : d // and the previous handler otherwise.
    };
    c = this // cache the window to fetch IE events
    a = this // cache the window to fetch IE events
    }
    2 changes: 1 addition & 1 deletion index.js
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    function(a,b,c,d){c=c||document;d=c[b="on"+b];a=c[b]=function(e){d=d&&d(e=e||c.event);return(a=a&&b(e))?b:d};c=this}
    function(a,b,c,d){a=a||document;d=a[b="on"+b];b=a[b]=function(e){d=d&&d(e=e||a.event);return(c=c&&b(e))?b:d};a=this}
  4. jed revised this gist May 15, 2011. 3 changed files with 43 additions and 1 deletion.
    20 changes: 20 additions & 0 deletions LICENSE.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    Copyright (c) 2011 Jed Schmidt, http://jed.is

    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 furnished to do so, subject to
    the following conditions:

    The above copyright notice and this permission notice shall be
    included in all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
    LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
    OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
    WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    22 changes: 22 additions & 0 deletions annotated.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    function(
    a, // a DOM element
    b, // an event name such as "click"
    c, // (placeholder)
    d // (placeholder)
    ){
    c = c || document; // use the document by default
    d = c[ // save the current onevent handler
    b = "on" + b // prepent the event name with "on"
    ];
    a = c[b] = // cache and replace the current handler
    function(e) { // with a function that
    d = d && d( // executes/caches the previous handler
    e = e || c.event // with a cross-browser object,
    );

    return (a = a && b(e)) // and calls the passed function,
    ? b // returning the current handler if it rebinds
    : d // and the previous handler otherwise.
    };
    c = this // cache the window to fetch IE events
    }
    2 changes: 1 addition & 1 deletion index.js
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    function(a,b,c,d){c=c||document;d=c[a="on"+a];a=c[a]=function(e){d=d&&d(e=e||c.event);return(b=b&&b(e))?a:d};c=this}
    function(a,b,c,d){c=c||document;d=c[b="on"+b];a=c[b]=function(e){d=d&&d(e=e||c.event);return(a=a&&b(e))?b:d};c=this}
  5. jed revised this gist May 13, 2011. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions package.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    {
    "name": "on",
    "keywords": ["bind", "events", "event", "DOM"]
    }
  6. jed revised this gist May 12, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion index.js
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    function(a,b,c,d){c=c||document;d=c[a="on"+a];a=c[a]=function(e){d=d&&d(e=e||c.event);return(b=b&&b(o))?a:d};c=this}
    function(a,b,c,d){c=c||document;d=c[a="on"+a];a=c[a]=function(e){d=d&&d(e=e||c.event);return(b=b&&b(e))?a:d};c=this}
  7. jed revised this gist May 12, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion index.js
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    function(n,f,e,p){e=e||document;p=e[n="on"+n];n=e[n]=function(o){p=p&&p(o=o||e.event);return(f=f&&f(o))?n:p};e=this}
    function(a,b,c,d){c=c||document;d=c[a="on"+a];a=c[a]=function(e){d=d&&d(e=e||c.event);return(b=b&&b(o))?a:d};c=this}
  8. jed revised this gist May 12, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion index.js
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    function(){/******************************************************************************************************************************/}
    function(n,f,e,p){e=e||document;p=e[n="on"+n];n=e[n]=function(o){p=p&&p(o=o||e.event);return(f=f&&f(o))?n:p};e=this}
  9. 140bytesbot created this gist May 9, 2011.
    1 change: 1 addition & 0 deletions index.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    function(){/******************************************************************************************************************************/}